diff --git a/react/src/actions/addCoin.js b/react/src/actions/addCoin.js index dfa13a0..2b5f5c7 100644 --- a/react/src/actions/addCoin.js +++ b/react/src/actions/addCoin.js @@ -49,10 +49,10 @@ export function addCoin(coin, mode, syncOnly, port) { }; return dispatch => { - startIguanaInstance(modeToValue[mode] + '/sync', coin) + startIguanaInstance(`${modeToValue[mode]}/sync`, coin) .then(function(json) { setTimeout(function() { - console.log('started ' + coin + ' / ' + modeToValue[mode] + ' fork', json); + console.log(`started ${coin} / ${modeToValue[mode]} fork`, json); dispatch(iguanaAddCoin(coin, mode, _acData, json.result)); }, 2000); }); @@ -79,12 +79,12 @@ export function iguanaAddCoin(coin, mode, acData, port) { 'timestamp': _timestamp, 'function': 'iguanaAddCoin', 'type': 'post', - 'url': 'http://127.0.0.1:' + (port ? port : Config.iguanaCorePort), + 'url': `http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, 'payload': acData, 'status': 'pending', })); - return fetch('http://127.0.0.1:' + (port ? port : Config.iguanaCorePort), { + return fetch(`http://127.0.0.1:${(port ? port : Config.iguanaCorePort)}`, { method: 'POST', body: JSON.stringify(acData), }) @@ -160,12 +160,12 @@ export function shepherdHerd(coin, mode, path) { if (checkCoinType(coin) === 'ac') { acData = startAssetChain(path.result, coin, mode); const supply = startAssetChain(path.result, coin, mode, true); - herdData.ac_options.push('-ac_supply=' + supply); + herdData.ac_options.push(`-ac_supply=${supply}`); } console.log('herdData', herdData); return dispatch => { - return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/herd', { + return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/herd`, { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -192,7 +192,7 @@ export function addCoinResult(coin, mode) { }; return dispatch => { - dispatch(triggerToaster(true, coin + ' ' + translate('TOASTR.STARTED_IN') + ' ' + modeToValue[mode] + ' ' + translate('TOASTR.MODE'), translate('TOASTR.COIN_NOTIFICATION'), 'success')); + dispatch(triggerToaster(true, `${coin} ${translate('TOASTR.STARTED_IN')} ${modeToValue[mode]} ${translate('TOASTR.MODE')}`, translate('TOASTR.COIN_NOTIFICATION'), 'success')); dispatch(toggleAddcoinModal(false, false)); dispatch(getDexCoins()); } @@ -200,7 +200,7 @@ export function addCoinResult(coin, mode) { export function _shepherdGetConfig(coin, mode) { return dispatch => { - return fetch('http://127.0.0.1:' + Config.agamaPort + '/shepherd/getconf', { + return fetch(`http://127.0.0.1:${Config.agamaPort}/shepherd/getconf`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/react/src/components/toaster/toaster-item.js b/react/src/components/toaster/toaster-item.js index 94904d7..b422710 100644 --- a/react/src/components/toaster/toaster-item.js +++ b/react/src/components/toaster/toaster-item.js @@ -1,6 +1,6 @@ -import React from "react"; -import {dismissToasterMessage} from "../../actions/actionCreators"; -import Store from "../../store"; +import React from 'react'; +import { dismissToasterMessage } from '../../actions/actionCreators'; +import Store from '../../store'; // each toast will be displayed for 5 seconds const DISPLAY_LENGTH_MILLIS = 5000; @@ -10,7 +10,6 @@ const DISPLAY_LENGTH_MILLIS = 5000; * each messages has a type, title and a content message */ class ToasterItem extends React.Component { - constructor(props) { super(props); this.state = { @@ -60,9 +59,10 @@ class ToasterItem extends React.Component { } return ( -
-
{ this.state.title }
{ this.state.message }
diff --git a/react/src/components/toaster/toaster.js b/react/src/components/toaster/toaster.js index d8fdf6d..5fa72fa 100644 --- a/react/src/components/toaster/toaster.js +++ b/react/src/components/toaster/toaster.js @@ -1,7 +1,7 @@ -import React from "react"; -import {dismissToasterMessage} from "../../actions/actionCreators"; -import Store from "../../store"; -import ToasterItem from "./toaster-item"; +import React from 'react'; +import { dismissToasterMessage } from '../../actions/actionCreators'; +import Store from '../../store'; +import ToasterItem from './toaster-item'; /** * Container component used for creating multiple toasts @@ -17,7 +17,7 @@ class Toaster extends React.Component { componentWillReceiveProps(props) { if (props && - props.toasts) { + props.toasts) { this.setState({ toasts: props.toasts, toastId: props.toasts.length @@ -34,24 +34,33 @@ class Toaster extends React.Component { Store.dispatch(dismissToasterMessage(toastId)); } + renderToasts() { + if (this.state.toasts && + this.state.toasts.length) { + this.state.toasts.map((toast) => { + // sets the toastId for all new toasts + if (!toast.toastId) { + toast.toastId = this.toastId++; + } + + return ( + + ); + }); + } else { + return null; + } + } + // render all current toasts render() { return ( -