diff --git a/react/src/components/dashboard/walletsData/pagination.render.js b/react/src/components/dashboard/walletsData/pagination.render.js index e7535de..c4d1de6 100644 --- a/react/src/components/dashboard/walletsData/pagination.render.js +++ b/react/src/components/dashboard/walletsData/pagination.render.js @@ -2,7 +2,10 @@ import React from 'react'; import classnames from 'classnames'; const defaultButton = props => - @@ -72,7 +75,9 @@ const PaginationRender = function() { value={pageSize}> { pageSizeOptions.map((option, i) => { return ( - ); @@ -85,7 +90,7 @@ const PaginationRender = function() { { if (!canNext) return; - this.changePage(page + 1) + this.changePage(page + 1); }} disabled={!canNext}> {this.props.nextText} diff --git a/react/src/components/dashboard/walletsData/walletsData.js b/react/src/components/dashboard/walletsData/walletsData.js index 2480162..43c0e1d 100644 --- a/react/src/components/dashboard/walletsData/walletsData.js +++ b/react/src/components/dashboard/walletsData/walletsData.js @@ -53,8 +53,9 @@ class WalletsData extends React.Component { totalStackLength: 0, useCache: true, itemsListColumns: this.generateItemsListColumns(), + defaultPageSize: 10, pageSize: 10, - showPagination: false, + showPagination: true, searchTerm: null, coin: null, txhistory: null @@ -108,6 +109,9 @@ class WalletsData extends React.Component { columns.push({ Header: translate('INDEX.TYPE'), Footer: translate('INDEX.TYPE'), + className: 'colum--type', + headerClassName: 'colum--type', + footerClassName: 'colum--type', Cell: AddressTypeRender() }); } @@ -329,7 +333,7 @@ class WalletsData extends React.Component { indexTxHistory(txhistoryArr) { if (txhistoryArr.length > 1) { for (let i = 0; i < txhistoryArr.length; i++) { - this.props.ActiveCoin.txhistory[i]['index'] = i + 1; + this.props.ActiveCoin.txhistory[i].index = i + 1; } } @@ -338,7 +342,8 @@ class WalletsData extends React.Component { componentWillReceiveProps(props) { if (!this.state.currentAddress && - this.props.ActiveCoin.activeAddress) { + this.props.ActiveCoin.activeAddress && + this.props.ActiveCoin.mode === 'basilisk') { this.setState(Object.assign({}, this.state, { currentAddress: this.props.ActiveCoin.activeAddress, })); @@ -357,7 +362,7 @@ class WalletsData extends React.Component { itemsList: sortedItemsList, filteredItemsList: this.filterTransactions(sortedItemsList, this.state.searchTerm), txhistory: this.props.ActiveCoin.txhistory, - showPagination: this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory.length >= this.state.pageSize + showPagination: this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory.length >= this.state.defaultPageSize })); } } @@ -392,7 +397,8 @@ class WalletsData extends React.Component { // TODO: add basilisk first run check, display no data if second run renderTxHistoryList() { - if (this.state.itemsList === 'loading' || this.state.itemsList.length == 0) { + if (this.state.itemsList === 'loading' || + this.state.itemsList.length == 0) { if (this.isFullySynced()) { return ( @@ -422,7 +428,7 @@ class WalletsData extends React.Component { onPageSizeChange(pageSize, pageIndex) { this.setState(Object.assign({}, this.state, { pageSize: pageSize, - showPagination: this.state.itemsList && this.state.itemsList.length >= pageSize, + showPagination: this.state.itemsList && this.state.itemsList.length >= defaultPageSize, })) } @@ -473,7 +479,7 @@ class WalletsData extends React.Component { for (let i = 0; i < _addresses[type].length; i++) { const address = _addresses[type][i].address; - let _amount = address.amount; + let _amount = _addresses[type][i].amount; if (this.props.ActiveCoin.mode === 'basilisk') { _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'; @@ -489,8 +495,9 @@ class WalletsData extends React.Component { } return items; - } else if (this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]) { + } else if (this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] && this.props.ActiveCoin.mode === 'basilisk') { const address = this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]; + return AddressItemRender.call(this, address, type, null, _coin); } @@ -522,7 +529,13 @@ class WalletsData extends React.Component { return _amount; } else { const address = _addresses.public[i].address; - let _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'; + let _amount; + + 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'; + } else { + _amount = _addresses.public[i].amount; + } if (_amount !== 'N/A') { _amount = formatValue('round', _amount, -6); @@ -550,16 +563,17 @@ class WalletsData extends React.Component { ); } else { return ( - - { translate('KMD_NATIVE.SELECT_ADDRESS') } - + Filter by address ); } } shouldDisplayAddressList() { - //return true; - return this.props.Dashboard && + if (this.props.ActiveCoin.mode === 'basilisk') { + return this.props.Dashboard && this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]; + } } renderAddressList() { @@ -594,7 +608,7 @@ class WalletsData extends React.Component { } contains(value, property) { - return (value + "").indexOf(property) !== -1; + return (value + '').indexOf(property) !== -1; } isActiveCoinMode(coinMode) { diff --git a/react/src/components/dashboard/walletsData/walletsData.render.js b/react/src/components/dashboard/walletsData/walletsData.render.js index 792db46..51f0f8a 100644 --- a/react/src/components/dashboard/walletsData/walletsData.render.js +++ b/react/src/components/dashboard/walletsData/walletsData.render.js @@ -9,8 +9,6 @@ import TablePaginationRenderer from './pagination'; import { formatValue } from '../../../util/formatValue'; import Config from '../../../config'; -// TODO: clean basilisk dropdown menu - export const AddressTypeRender = function() { return ( @@ -72,7 +70,7 @@ export const AddressListRender = function() {
@@ -96,7 +102,7 @@ export const AddressListRender = function() { export const TxTypeRender = function(category) { if (category === 'send' || - category === 'sent') { + category === 'sent') { return ( { translate('DASHBOARD.OUT') } @@ -104,10 +110,10 @@ export const TxTypeRender = function(category) { ); } if (category === 'receive' || - category === 'received') { + category === 'received') { return ( - { translate('DASHBOARD.IN') } + { translate('DASHBOARD.IN') }     ); } @@ -134,32 +140,43 @@ export const TxTypeRender = function(category) { } }; -export const TxAmountRender = function (tx) { +export const TxAmountRender = function(tx) { + let _amountNegative; + + if ((tx.category === 'send' || + tx.category === 'sent') || + (tx.type === 'send' || + tx.type === 'sent')) { + _amountNegative = -1; + } else { + _amountNegative = 1; + } + if (Config.roundValues) { return ( - { formatValue('round', tx.amount, -6) || translate('DASHBOARD.UNKNOWN') } + { formatValue('round', tx.amount, -6) * _amountNegative || translate('DASHBOARD.UNKNOWN') } ); } return ( - { tx.amount || translate('DASHBOARD.UNKNOWN') } + { tx.amount * _amountNegative || translate('DASHBOARD.UNKNOWN') } ); }; export const TxHistoryListRender = function() { return ( this.onPageSizeChange(pageSize, pageIndex)} /> + PaginationComponent={ TablePaginationRenderer } + nextText={ translate('INDEX.NEXT_PAGE') } + previousText={ translate('INDEX.PREVIOUS_PAGE') } + showPaginationBottom={ this.state.showPagination } + pageSize={ this.pageSize } + onPageSizeChange={ (pageSize, pageIndex) => this.onPageSizeChange(pageSize, pageIndex) } /> ); }; @@ -245,16 +262,16 @@ export const WalletsDataRender = function() {

{ translate('INDEX.TRANSACTION_HISTORY') }

-
+
{ this.shouldDisplayAddressList() && -
- {this.renderAddressList()} +
+ { this.renderAddressList() }
} -
+
this.onSearchTermChange(e.target.value)} + onChange={ e => this.onSearchTermChange(e.target.value) } placeholder="Search" />
diff --git a/react/src/components/dashboard/walletsNative/walletsNative.render.js b/react/src/components/dashboard/walletsNative/walletsNative.render.js index e9202c2..deacd2f 100644 --- a/react/src/components/dashboard/walletsNative/walletsNative.render.js +++ b/react/src/components/dashboard/walletsNative/walletsNative.render.js @@ -14,7 +14,7 @@ const WalletsNativeRender = function() { id="easydex-header-div" className="background-color-white" style={ this.getCoinStyle('transparent') }> -
    +
    1. { this.getCoinStyle('title') && diff --git a/react/src/components/dashboard/walletsNav/walletsNav.render.js b/react/src/components/dashboard/walletsNav/walletsNav.render.js index 76fc023..58e7cf1 100644 --- a/react/src/components/dashboard/walletsNav/walletsNav.render.js +++ b/react/src/components/dashboard/walletsNav/walletsNav.render.js @@ -27,7 +27,7 @@ export const WalletsNavWithWalletRender = function() { className={ 'page-header page-header-bordered header-easydex padding-bottom-' + (this.state.nativeOnly ? '40 page-header--native' : '20') } id="header-dashboard" style={{ marginBottom: this.props.ActiveCoin.mode === 'basilisk' ? '30px' : (this.state.nativeOnly ? '30px' : '0') }}> -
        +
          { translate('INDEX.MY') } { this.props && this.props.ActiveCoin ? this.props.ActiveCoin.coin : '-' } { translate('INDEX.ADDRESS') }: { this.props && this.props.Dashboard && this.props.Dashboard.activeHandle ? this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] : '-' }