Browse Source

remaining es6 fat arrows

all-modes
pbca26 8 years ago
parent
commit
8563d273d2
  1. 8
      react/src/components/addcoin/addcoin.js
  2. 24
      react/src/components/dashboard/coinTileItem.js
  3. 7
      react/src/components/login/login.js

8
react/src/components/addcoin/addcoin.js

@ -97,12 +97,12 @@ class AddCoin extends React.Component {
modalClassName: props.display ? 'show fade' : 'show fade',
}));
setTimeout(function() {
setTimeout(() => {
this.setState(Object.assign({}, this.state, {
display: props.display,
modalClassName: props.display ? 'show in' : 'hide',
}));
}.bind(this), 100);
}, 100);
}
}
@ -216,7 +216,7 @@ class AddCoin extends React.Component {
for (let i = 1; i < this.state.coins.length; i++) {
const _item = this.state.coins[i];
setTimeout(function() {
setTimeout(() => {
Store.dispatch(addCoin(
_item.selectedCoin.split('|')[0],
_item.mode,
@ -233,7 +233,7 @@ class AddCoin extends React.Component {
Store.dispatch(toggleAddcoinModal(false, false));
}
}.bind(this), 2000 * i);
}, 2000 * i);
}
}

24
react/src/components/dashboard/coinTileItem.js

@ -22,6 +22,9 @@ import {
import Store from '../../store';
const BASILISK_CACHE_UPDATE_TIMEOUT = 240000;
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_HANDLE_TIMEOUT_KMD_NATIVE = 15000;
const NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD = 90;
class CoinTileItem extends React.Component {
constructor(props) {
@ -41,10 +44,13 @@ class CoinTileItem extends React.Component {
dispatchCoinActions(coin, mode) {
if (mode === 'native') {
Store.dispatch(iguanaActiveHandle(true));
const syncPercentage = this.props.Dashboard && this.props.Dashboard.progress && (parseFloat(parseInt(this.props.Dashboard.progress.blocks, 10) * 100 / parseInt(this.props.Dashboard.progress.longestchain, 10)).toFixed(2)).replace('NaN', 0);
if (this.props.Dashboard.progress &&
this.props.Dashboard.progress.blocks &&
this.props.Dashboard.progress.longestchain &&
this.props.Dashboard.progress.blocks === this.props.Dashboard.progress.longestchain) {
syncPercentage &&
syncPercentage >= NATIVE_MIN_SYNC_PERCENTAGE_THRESHOLD) {
Store.dispatch(getSyncInfoNative(coin, true));
Store.dispatch(getKMDBalanceTotal(coin));
Store.dispatch(getNativeTxHistory(coin));
@ -63,6 +69,7 @@ class CoinTileItem extends React.Component {
}
if (mode === 'basilisk') {
const useAddress = this.props.ActiveCoin.mainBasiliskAddress ? this.props.ActiveCoin.mainBasiliskAddress : this.props.Dashboard.activeHandle[coin];
Store.dispatch(iguanaActiveHandle(true));
Store.dispatch(getKMDAddressesNative(coin, mode, useAddress));
Store.dispatch(getShepherdCache(JSON.parse(sessionStorage.getItem('IguanaActiveAccount')).pubkey, coin));
@ -74,8 +81,8 @@ class CoinTileItem extends React.Component {
if (!this.props.ActiveCoin.addresses) {
Store.dispatch(getAddressesByAccount(coin, mode));
}
Store.dispatch(getBasiliskTransactionsList(coin, useAddress));
//Store.dispatch(iguanaEdexBalance(coin, mode));
}
}
}
@ -89,15 +96,15 @@ class CoinTileItem extends React.Component {
this.dispatchCoinActions(coin, mode);
if (mode === 'full') {
const _iguanaActiveHandle = setInterval(function() {
const _iguanaActiveHandle = setInterval(() => {
this.dispatchCoinActions(coin, mode);
}.bind(this), 3000);
}, IGUNA_ACTIVE_HANDLE_TIMEOUT);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
}
if (mode === 'native') {
const _iguanaActiveHandle = setInterval(function() {
const _iguanaActiveHandle = setInterval(() => {
this.dispatchCoinActions(coin, mode);
}.bind(this), coin === 'KMD' ? 15000 : 3000);
}, coin === 'KMD' ? IGUNA_ACTIVE_HANDLE_TIMEOUT_KMD_NATIVE : IGUNA_ACTIVE_HANDLE_TIMEOUT);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
}
if (mode === 'basilisk') {
@ -113,9 +120,9 @@ class CoinTileItem extends React.Component {
'address': _basiliskMainAddress,
}));
const _iguanaActiveHandle = setInterval(function() {
const _iguanaActiveHandle = setInterval(() => {
this.dispatchCoinActions(coin, mode);
}.bind(this), 3000);
}, IGUNA_ACTIVE_HANDLE_TIMEOUT);
const _basiliskCache = setInterval(() => {
Store.dispatch(fetchNewCacheData({
@ -128,7 +135,6 @@ class CoinTileItem extends React.Component {
}, BASILISK_CACHE_UPDATE_TIMEOUT);
Store.dispatch(startInterval('sync', _iguanaActiveHandle));
Store.dispatch(startInterval('basilisk', _basiliskCache));
// basilisk
}
}
}

7
react/src/components/login/login.js

@ -14,6 +14,9 @@ import {
import Store from '../../store';
import { PassPhraseGenerator } from '../../util/crypto/passphrasegenerator';
const IGUNA_ACTIVE_HANDLE_TIMEOUT = 3000;
const IGUNA_ACTIVE_COINS_TIMEOUT = 10000;
class Login extends React.Component {
constructor(props) {
super(props);
@ -43,7 +46,7 @@ class Login extends React.Component {
const _iguanaActiveHandle = setInterval(() => {
Store.dispatch(getSyncOnlyForks());
}, 3000);
}, IGUNA_ACTIVE_HANDLE_TIMEOUT);
Store.dispatch(startInterval('syncOnly', _iguanaActiveHandle));
Store.dispatch(toggleSyncOnlyModal(true));
@ -85,7 +88,7 @@ class Login extends React.Component {
if (!this.props.Interval.interval.activeCoins) {
const _iguanaActiveCoins = setInterval(() => {
Store.dispatch(getDexCoins());
}, 10000);
}, IGUNA_ACTIVE_COINS_TIMEOUT);
Store.dispatch(startInterval('activeCoins', _iguanaActiveCoins));
}

Loading…
Cancel
Save