Browse Source

added activeCoin check to walletsData tx history render

all-modes
pbca26 8 years ago
parent
commit
9298698468
  1. 39
      react/src/components/dashboard/walletsData/walletsData.js

39
react/src/components/dashboard/walletsData/walletsData.js

@ -248,6 +248,11 @@ class WalletsData extends React.Component {
} }
componentWillReceiveProps(props) { componentWillReceiveProps(props) {
let historyToSplit;
if (this.props &&
this.props.ActiveCoin &&
this.props.ActiveCoin.coin) {
if (!this.state.currentAddress && if (!this.state.currentAddress &&
this.props.ActiveCoin.activeAddress) { this.props.ActiveCoin.activeAddress) {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
@ -262,7 +267,7 @@ class WalletsData extends React.Component {
if (!this.state.itemsList || if (!this.state.itemsList ||
(this.state.itemsList && !this.state.itemsList.length) || (this.state.itemsList && !this.state.itemsList.length) ||
(props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) { (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) {
let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory); historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice( historyToSplit = historyToSplit.slice(
(this.state.activePage - 1) * this.state.itemsPerPage, (this.state.activePage - 1) * this.state.itemsPerPage,
this.state.activePage * this.state.itemsPerPage this.state.activePage * this.state.itemsPerPage
@ -274,15 +279,33 @@ class WalletsData extends React.Component {
} }
} }
if (this.props.ActiveCoin.txhistory && if (!historyToSplit &&
this.props.ActiveCoin.txhistory &&
this.props.ActiveCoin.txhistory === 'no data') { this.props.ActiveCoin.txhistory === 'no data') {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
itemsList: 'no data', itemsList: 'no data',
})); }));
} else if (this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory === 'loading') { } else if (!historyToSplit && this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory === 'loading') {
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
itemsList: 'loading', itemsList: 'loading',
})); }));
} else if ( // dirty first txhistory load workaround
!historyToSplit &&
this.props.ActiveCoin.txhistory &&
this.props.ActiveCoin.txhistory !== 'loading' &&
this.props.ActiveCoin.txhistory !== 'no data' &&
this.props.ActiveCoin.txhistory.length
) {
historyToSplit = sortByDate(this.props.ActiveCoin.txhistory);
historyToSplit = historyToSplit.slice(
(this.state.activePage - 1) * this.state.itemsPerPage,
this.state.activePage * this.state.itemsPerPage
);
this.setState(Object.assign({}, this.state, {
itemsList: historyToSplit,
}));
}
} }
} }
@ -395,15 +418,15 @@ class WalletsData extends React.Component {
if (this.state.itemsList === 'loading') { if (this.state.itemsList === 'loading') {
if (!this.isNativeMode() || this.isFullySynced()) { if (!this.isNativeMode() || this.isFullySynced()) {
return ( return (
<tr> <tr className="hover--none">
<td colSpan="6">{ translate('INDEX.LOADING_HISTORY') }...</td> <td colSpan="7">{ translate('INDEX.LOADING_HISTORY') }...</td>
</tr> </tr>
); );
} }
} else if (this.state.itemsList === 'no data') { } else if (this.state.itemsList === 'no data') {
return ( return (
<tr> <tr className="hover--none">
<td colSpan="6">{ translate('INDEX.NO_DATA') }</td> <td colSpan="7">{ translate('INDEX.NO_DATA') }</td>
</tr> </tr>
); );
} else { } else {
@ -484,7 +507,7 @@ class WalletsData extends React.Component {
let _amount = address.amount; let _amount = address.amount;
if (this.props.ActiveCoin.mode === 'basilisk') { if (this.props.ActiveCoin.mode === 'basilisk') {
_amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A'; _amount = _cache && _cache[_coin] && _cache[_coin][address] && _cache[_coin][address].getbalance && _cache[_coin][address].getbalance.data && _cache[_coin][address].getbalance.data.balance ? _cache[_coin][address].getbalance.data.balance : 'N/A';
} }
if (_amount !== 'N/A') { if (_amount !== 'N/A') {

Loading…
Cancel
Save