diff --git a/react/src/components/dashboard/walletsData.js b/react/src/components/dashboard/walletsData.js index 410f729..1671892 100644 --- a/react/src/components/dashboard/walletsData.js +++ b/react/src/components/dashboard/walletsData.js @@ -83,19 +83,25 @@ class WalletsData extends React.Component { } updateSocketsData(data) { - if (data && data.message && data.message.shepherd.iguanaAPI && + if (data && + data.message && + data.message.shepherd.iguanaAPI && data.message.shepherd.iguanaAPI.totalStackLength) { this.setState(Object.assign({}, this.state, { totalStackLength: data.message.shepherd.iguanaAPI.totalStackLength, })); } - if (data && data.message && data.message.shepherd.iguanaAPI && + if (data && + data.message && + data.message.shepherd.iguanaAPI && data.message.shepherd.iguanaAPI.currentStackLength) { this.setState(Object.assign({}, this.state, { currentStackLength: data.message.shepherd.iguanaAPI.currentStackLength, })); } - if (data && data.message && data.message.shepherd.method && + if (data && + data.message && + data.message.shepherd.method && data.message.shepherd.method === 'cache-one' && data.message.shepherd.status === 'done') { Store.dispatch(basiliskRefresh(false)); @@ -120,13 +126,6 @@ class WalletsData extends React.Component { 'calls': 'refresh', 'address': this.state.currentAddress, })); - console.log('_fetchUtxoCache', { - 'pubkey': this.props.Dashboard.activeHandle.pubkey, - 'allcoins': false, - 'coin': this.props.ActiveCoin.coin, - 'calls': 'refresh', - 'address': this.state.currentAddress, - }); } toggleBasiliskActionsMenu() { @@ -182,7 +181,8 @@ class WalletsData extends React.Component { } componentWillReceiveProps(props) { - if (!this.state.currentAddress && this.props.ActiveCoin.activeAddress) { + if (!this.state.currentAddress && + this.props.ActiveCoin.activeAddress) { this.setState(Object.assign({}, this.state, { currentAddress: this.props.ActiveCoin.activeAddress, })); @@ -192,7 +192,9 @@ class WalletsData extends React.Component { this.props.ActiveCoin.txhistory !== 'loading' && this.props.ActiveCoin.txhistory !== 'no data' && this.props.ActiveCoin.txhistory.length) { - if (!this.state.itemsList || (this.state.itemsList && !this.state.itemsList.length) || (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) { + if (!this.state.itemsList || + (this.state.itemsList && !this.state.itemsList.length) || + (props.ActiveCoin.txhistory !== this.props.ActiveCoin.txhistory)) { let historyToSplit = sortByDate(this.props.ActiveCoin.txhistory); historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage); @@ -202,7 +204,8 @@ class WalletsData extends React.Component { } } - if (this.props.ActiveCoin.txhistory && this.props.ActiveCoin.txhistory === 'no data') { + if (this.props.ActiveCoin.txhistory && + this.props.ActiveCoin.txhistory === 'no data') { this.setState(Object.assign({}, this.state, { itemsList: 'no data', })); @@ -228,8 +231,13 @@ class WalletsData extends React.Component { for (let i=0; i < Math.ceil(this.props.ActiveCoin.txhistory.length / this.state.itemsPerPage); i++) { items.push( -
  • - this.updateCurrentPage(i + 1) : null}>{i + 1} +
  • + this.updateCurrentPage(i + 1) : null }>{ i + 1 }
  • ); } @@ -238,18 +246,24 @@ class WalletsData extends React.Component { } renderPaginationItemsPerPageSelector() { - if (this.props.ActiveCoin.txhistory && this.state.itemsList !== 'loading' && this.props.ActiveCoin.txhistory.length > 10) { + if (this.props.ActiveCoin.txhistory && + this.state.itemsList !== 'loading' && + this.props.ActiveCoin.txhistory.length > 10) { return (
    ); @@ -259,21 +273,40 @@ class WalletsData extends React.Component { } renderPagination() { - if (this.props.ActiveCoin.txhistory && this.state.itemsList !== 'loading' && this.props.ActiveCoin.txhistory.length > 10) { + if (this.props.ActiveCoin.txhistory && + this.state.itemsList !== 'loading' && + this.props.ActiveCoin.txhistory.length > 10) { + const _paginationFrom = ((this.state.activePage - 1) * this.state.itemsPerPage) + 1; + const _paginationTo = this.state.activePage * this.state.itemsPerPage; + return (
    -
    Showing {((this.state.activePage - 1) * this.state.itemsPerPage) + 1} to {this.state.activePage * this.state.itemsPerPage} of {this.props.ActiveCoin.txhistory.length} entries
    +
    { translate('INDEX.SHOWING') } { _paginationFrom } { translate('INDEX.TO') } { _paginationTo } { translate('INDEX.OF') } { this.props.ActiveCoin.txhistory.length } { translate('INDEX.ENTRIES_SM') }
    @@ -286,38 +319,40 @@ class WalletsData extends React.Component { } renderTxType(category) { - if ( category === 'send' || category === 'sent' ) { + if (category === 'send' || + category === 'sent') { return ( - {translate('DASHBOARD.OUT')} + { translate('DASHBOARD.OUT') } ); } - if ( category === 'receive' || category === 'received' ) { + if (category === 'receive' || + category === 'received') { return ( - {translate('DASHBOARD.IN')} + { translate('DASHBOARD.IN') } ); } - if ( category === 'generate' ) { + if (category === 'generate') { return ( - {translate('DASHBOARD.MINED')} + { translate('DASHBOARD.MINED') } ); } - if ( category === 'immature' ) { + if (category === 'immature') { return ( - {translate('DASHBOARD.IMMATURE')} + { translate('DASHBOARD.IMMATURE') } ); } - if ( category === 'unknown' ) { + if (category === 'unknown') { return ( - {translate('DASHBOARD.UNKNOWN')} + { translate('DASHBOARD.UNKNOWN') } ); } @@ -326,23 +361,30 @@ class WalletsData extends React.Component { renderTxHistoryList() { if (this.state.itemsList === 'loading') { return ( -
    Loading history...
    +
    { translate('INDEX.LOADING_HISTORY') }...
    ); } else if (this.state.itemsList === 'no data') { return ( -
    No data
    +
    { translate('INDEX.NO_DATA') }
    ); } else { - if (this.state.itemsList && this.state.itemsList.length && this.state.itemsList !== 'no data') { + if (this.state.itemsList && + this.state.itemsList.length && + this.state.itemsList !== 'no data') { return this.state.itemsList.map((tx, index) => - - {this.renderTxType(tx.category || tx.type)} - {tx.confirmations} - {tx.amount || translate('DASHBOARD.UNKNOWN')} - {secondsToString(tx.blocktime || tx.timestamp)} - {tx.address} + + { this.renderTxType(tx.category || tx.type) } + { tx.confirmations } + { tx.amount || translate('DASHBOARD.UNKNOWN') } + { secondsToString(tx.blocktime || tx.timestamp) } + { tx.address } - + ); @@ -409,7 +451,7 @@ class WalletsData extends React.Component { return (
    - +
    diff --git a/react/src/components/dashboard/walletsHeader.js b/react/src/components/dashboard/walletsHeader.js index 5b2f74c..74af1d6 100644 --- a/react/src/components/dashboard/walletsHeader.js +++ b/react/src/components/dashboard/walletsHeader.js @@ -1,83 +1,152 @@ import React from 'react'; import { translate } from '../../translate/translate'; -//import { dashboardChangeSection, toggleAddcoinModal } from '../../actions/actionCreators'; -//import Store from '../../store'; +// import { dashboardChangeSection, toggleAddcoinModal } from '../../actions/actionCreators'; +// import Store from '../../store'; class WalletsHeader extends React.Component { render() { - if (this.props && this.props.coin) { + if (this.props && + this.props.coin) { return (

    EasyDEX

      -
    1. {translate('INDEX.DASHBOARD')}
    2. +
    3. { translate('INDEX.DASHBOARD') }
    -
    +
    -
    @@ -85,14 +154,14 @@ class WalletsHeader extends React.Component {
    - - BTC - - USD + - BTC + - USD
    - - BTCD - - USD + - BTCD + - USD
    diff --git a/react/src/components/dashboard/walletsNative.js b/react/src/components/dashboard/walletsNative.js index 361a4c5..1b8f5d0 100644 --- a/react/src/components/dashboard/walletsNative.js +++ b/react/src/components/dashboard/walletsNative.js @@ -15,21 +15,22 @@ class WalletsNative extends React.Component { // render() { - if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.mode === 'native') { + if (this.props && + this.props.ActiveCoin && + this.props.ActiveCoin.mode === 'native') { return ( -
    -
    -
    +
    +
    +
    1. - {this.props.ActiveCoin.coin} + { this.props.ActiveCoin.coin }
    - -
    +
    diff --git a/react/src/components/dashboard/walletsNativeBalance.js b/react/src/components/dashboard/walletsNativeBalance.js index 818cf51..313078c 100644 --- a/react/src/components/dashboard/walletsNativeBalance.js +++ b/react/src/components/dashboard/walletsNativeBalance.js @@ -3,63 +3,76 @@ import { translate } from '../../translate/translate'; class WalletsNativeBalance extends React.Component { render() { - if (this.props && this.props.ActiveCoin.nativeActiveSection === 'default') { + if (this.props && + this.props.ActiveCoin.nativeActiveSection === 'default') { return (
    -
    +
    - {translate('INDEX.TRANSPARENT_BALANCE')} + { translate('INDEX.TRANSPARENT_BALANCE') }
    - {this.props.ActiveCoin.balance.transparent ? this.props.ActiveCoin.balance.transparent : '-'} + { this.props.ActiveCoin.balance.transparent ? this.props.ActiveCoin.balance.transparent : '-' }
    -
    +
    - {translate('INDEX.Z_BALANCE')} + { translate('INDEX.Z_BALANCE') }
    - {this.props.ActiveCoin.balance.private ? this.props.ActiveCoin.balance.private : '-'} + { this.props.ActiveCoin.balance.private ? this.props.ActiveCoin.balance.private : '-' }
    -
    +
    - {translate('INDEX.INTEREST_EARNED')} + { translate('INDEX.INTEREST_EARNED') }
    - {this.props.ActiveCoin.balance.interest ? this.props.ActiveCoin.balance.interest : '-'} + { this.props.ActiveCoin.balance.interest ? this.props.ActiveCoin.balance.interest : '-' }
    -
    +
    - {translate('INDEX.ZT_BALANCE')} + { translate('INDEX.ZT_BALANCE') }
    - {this.props.ActiveCoin.balance.total ? this.props.ActiveCoin.balance.total : '-'} + { this.props.ActiveCoin.balance.total ? this.props.ActiveCoin.balance.total : '-' }
    diff --git a/react/src/components/dashboard/walletsNativeReceive.js b/react/src/components/dashboard/walletsNativeReceive.js index 0483761..2216ec5 100644 --- a/react/src/components/dashboard/walletsNativeReceive.js +++ b/react/src/components/dashboard/walletsNativeReceive.js @@ -1,6 +1,9 @@ import React from 'react'; import { translate } from '../../translate/translate'; -import { getNewKMDAddresses, copyCoinAddress } from '../../actions/actionCreators'; +import { + getNewKMDAddresses, + copyCoinAddress +} from '../../actions/actionCreators'; import Store from '../../store'; // TODO: implement sorting @@ -26,17 +29,22 @@ class WalletsNativeReceive extends React.Component { } renderAddressList(type) { - if (this.props.ActiveCoin.addresses && this.props.ActiveCoin.addresses[type] && this.props.ActiveCoin.addresses[type].length) { + if (this.props.ActiveCoin.addresses && + this.props.ActiveCoin.addresses[type] && + this.props.ActiveCoin.addresses[type].length) { return this.props.ActiveCoin.addresses[type].map((address) => - + - - {type === 'public' ? translate('IAPI.PUBLIC_SM') : translate('KMD_NATIVE.PRIVATE')} + + { type === 'public' ? translate('IAPI.PUBLIC_SM') : translate('KMD_NATIVE.PRIVATE') } - + - {type === 'public' ? address.address : address.address.substring(0, 34) + '...'} - {address.amount} + { type === 'public' ? address.address : address.address.substring(0, 34) + '...' } + { address.amount } ); @@ -50,54 +58,72 @@ class WalletsNativeReceive extends React.Component { } render() { - if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.nativeActiveSection === 'receive') { + if (this.props && + this.props.ActiveCoin && + this.props.ActiveCoin.nativeActiveSection === 'receive') { return ( -
    +
    -
    +
    - +
    - - - + + + - {this.renderAddressList('public')} - {this.renderAddressList('private')} + { this.renderAddressList('public') } + { this.renderAddressList('private') } - - - + + +
    {translate('INDEX.TYPE')}{translate('INDEX.ADDRESS')}{translate('INDEX.AMOUNT')}{ translate('INDEX.TYPE') }{ translate('INDEX.ADDRESS') }{ translate('INDEX.AMOUNT') }
    {translate('INDEX.TYPE')}{translate('INDEX.ADDRESS')}{translate('INDEX.AMOUNT')}{ translate('INDEX.TYPE') }{ translate('INDEX.ADDRESS') }{ translate('INDEX.AMOUNT') }
    diff --git a/react/src/components/dashboard/walletsNativeSend.js b/react/src/components/dashboard/walletsNativeSend.js index e2f1252..523f55b 100644 --- a/react/src/components/dashboard/walletsNativeSend.js +++ b/react/src/components/dashboard/walletsNativeSend.js @@ -30,10 +30,14 @@ class WalletsNativeSend extends React.Component { } renderAddressByType(type) { - if (this.props.ActiveCoin.addresses && this.props.ActiveCoin.addresses[type] && this.props.ActiveCoin.addresses[type].length) { + if (this.props.ActiveCoin.addresses && + this.props.ActiveCoin.addresses[type] && + this.props.ActiveCoin.addresses[type].length) { return this.props.ActiveCoin.addresses[type].map((address) => -
  • - this.updateAddressSelection(address.address, type, address.amount)}> [ {address.amount} {this.props.ActiveCoin.coin} ]  {address.address} +
  • + this.updateAddressSelection(address.address, type, address.amount) }> [ { address.amount } { this.props.ActiveCoin.coin } ]  { address.address }
  • ); } else { @@ -45,29 +49,37 @@ class WalletsNativeSend extends React.Component { if (this.state.sendFrom) { return ( - [ {this.state.sendFromAmount} {this.props.ActiveCoin.coin} ]  {this.state.sendFrom} + [ { this.state.sendFromAmount } { this.props.ActiveCoin.coin } ]  { this.state.sendFrom } ); } else { return ( - - Select Transparent or Private Address - + - { translate('SEND.SELECT_T_OR_Z_ADDR') } - ); } } renderAddressList() { return ( -
    -
    @@ -78,55 +90,55 @@ class WalletsNativeSend extends React.Component { if (opid.status === 'queued') { return ( - {translate('KMD_NATIVE.QUEUED')} + { translate('KMD_NATIVE.QUEUED') } ); } if (opid.status === 'executing') { return ( - {translate('KMD_NATIVE.EXECUTING')} + { translate('KMD_NATIVE.EXECUTING') } ); } if (opid.status === 'failed') { return ( - {translate('KMD_NATIVE.FAILED')} + { translate('KMD_NATIVE.FAILED') } ); } if (opid.status === 'success') { return ( - {translate('KMD_NATIVE.SUCCESS')} + { translate('KMD_NATIVE.SUCCESS') } ); } } renderOPIDResult(opid) { - var isWaitingStatus = true; + let isWaitingStatus = true; if (opid.status === 'queued') { isWaitingStatus = false; return ( - Awaiting in queue... + { translate('SEND.AWAITING') }... ); } if (opid.status === 'executing') { isWaitingStatus = false; return ( - Processing... + { translate('SEND.PROCESSING') }... ); } if (opid.status === 'failed') { isWaitingStatus = false; return ( - Error Code: {opid.error.code} + { translate('SEND.ERROR_CODE') }: { opid.error.code }
    - {translate('KMD_NATIVE.MESSAGE')}: {opid.error.message} + { translate('KMD_NATIVE.MESSAGE') }: { opid.error.message }
    ); } @@ -134,27 +146,28 @@ class WalletsNativeSend extends React.Component { isWaitingStatus = false; return ( - txid: {opid.result.txid} + txid: { opid.result.txid }
    - {translate('KMD_NATIVE.EXECUTION_SECONDS')}: {opid.execution_secs} + { translate('KMD_NATIVE.EXECUTION_SECONDS') }: { opid.execution_secs }
    ); } if (isWaitingStatus) { return ( - Waiting... + { translate('SEND.WAITING') }... ); } } renderOPIDList() { - if (this.props.ActiveCoin.opids && this.props.ActiveCoin.opids.length) { + if (this.props.ActiveCoin.opids && + this.props.ActiveCoin.opids.length) { return this.props.ActiveCoin.opids.map((opid) => - - {this.renderOPIDLabel(opid)} - {opid.id} - {secondsToString(opid.creation_time)} - {this.renderOPIDResult(opid)} + + { this.renderOPIDLabel(opid) } + { opid.id } + { secondsToString(opid.creation_time) } + { this.renderOPIDResult(opid) } ); } else { @@ -209,7 +222,7 @@ class WalletsNativeSend extends React.Component { } if (this.state.sendTo === '') { - Store.dispatch(triggerToaster(true, 'Couldn\'t find any ' + this.props.ActiveCoin.coin +' addresses', 'OpenAlias', 'error')); + Store.dispatch(triggerToaster(true, 'Couldn\'t find any ' + this.props.ActiveCoin.coin + ' addresses', 'OpenAlias', 'error')); } } else { Store.dispatch(triggerToaster(true, 'Couldn\'t find any addresses', 'OpenAlias', 'error')); @@ -222,11 +235,25 @@ class WalletsNativeSend extends React.Component { return (
    - - + +
    -
    @@ -238,48 +265,80 @@ class WalletsNativeSend extends React.Component { } render() { - if (this.props && this.props.ActiveCoin && this.props.ActiveCoin.nativeActiveSection === 'send') { + if (this.props && + this.props.ActiveCoin && + this.props.ActiveCoin.nativeActiveSection === 'send') { return ( -
    +

    - {translate('INDEX.SEND')} + { translate('INDEX.SEND') } { this.props.ActiveCoin.coin }

    -
    +
    - - {this.renderAddressList()} + + { this.renderAddressList() }
    - {this.renderOASendUI()} + { this.renderOASendUI() }
    - - + +
    -
    - - + +
    - - {translate('INDEX.TOTAL')}: {this.state.amount} - {this.state.fee}/kb = {Number(this.state.amount) - Number(this.state.fee)} {this.props.ActiveCoin.coin} + + { translate('INDEX.TOTAL') }: { this.state.amount } - { this.state.fee }/kb = { Number(this.state.amount) - Number(this.state.fee) } { this.props.ActiveCoin.coin }
    -
    @@ -291,31 +350,34 @@ class WalletsNativeSend extends React.Component {
    -
    +
    -

    {translate('INDEX.OPERATIONS_STATUSES')}

    +

    { translate('INDEX.OPERATIONS_STATUSES') }

    - +
    - + - - + + - {this.renderOPIDList()} + { this.renderOPIDList() } - + - - + +
    {translate('INDEX.STATUS')}{ translate('INDEX.STATUS') } ID{translate('INDEX.TIME')}{translate('INDEX.RESULT')}{ translate('INDEX.TIME') }{ translate('INDEX.RESULT') }
    {translate('INDEX.STATUS')}{ translate('INDEX.STATUS') } ID{translate('INDEX.TIME')}{translate('INDEX.RESULT')}{ translate('INDEX.TIME') }{ translate('INDEX.RESULT') }
    diff --git a/react/src/translate/en.js b/react/src/translate/en.js index fa173f3..2809aa9 100644 --- a/react/src/translate/en.js +++ b/react/src/translate/en.js @@ -403,7 +403,13 @@ export const _lang = { 'AGO': 'ago', 'PROCESSING_REQ': 'Processing requests', 'LOCKED_PLEASE_WAIT': 'Locked, please wait', - 'UPDATE': 'Update' + 'UPDATE': 'Update', + 'SELECT_T_OR_Z_ADDR': 'Select Transparent or Private Address', + 'ENTER_T_OR_Z_ADDR': 'Enter Transparent or Private address', + 'AWAITING': 'Awaiting in queue', + 'PROCESSING': 'Processing', + 'ERROR_CODE': 'Error Code', + 'WAITING': 'Waiting' } } }; \ No newline at end of file