Browse Source

Transaction history improvements - visual improvements

all-modes
petitPapillon 8 years ago
parent
commit
8124d9ade1
  1. 41
      react/src/components/dashboard/walletsData/walletsData.js
  2. 17
      react/src/components/dashboard/walletsData/walletsData.render.js

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

@ -22,6 +22,7 @@ import Store from '../../../store';
import { import {
AddressTypeRender, AddressTypeRender,
TransactionDetailRender, TransactionDetailRender,
AddressRender,
AddressItemRender, AddressItemRender,
TxTypeRender, TxTypeRender,
TxHistoryListRender, TxHistoryListRender,
@ -40,8 +41,6 @@ class WalletsData extends React.Component {
super(props); super(props);
this.state = { this.state = {
basiliskActionsMenu: false, basiliskActionsMenu: false,
itemsPerPage: 10,
activePage: 1,
itemsList: [], itemsList: [],
currentAddress: null, currentAddress: null,
addressSelectorOpen: false, addressSelectorOpen: false,
@ -80,6 +79,7 @@ class WalletsData extends React.Component {
this.handleClickOutside, this.handleClickOutside,
false false
); );
socket.off('messages');
} }
generateItemsListColumns() { generateItemsListColumns() {
@ -135,7 +135,7 @@ class WalletsData extends React.Component {
id: 'destination-address', id: 'destination-address',
Header: translate('INDEX.DEST_ADDRESS'), Header: translate('INDEX.DEST_ADDRESS'),
Footer: translate('INDEX.DEST_ADDRESS'), Footer: translate('INDEX.DEST_ADDRESS'),
accessor: (tx) => this.renderAddress(tx) accessor: (tx) => AddressRender.call(this, tx)
}); });
} }
@ -332,18 +332,19 @@ class WalletsData extends React.Component {
return ( return (
<div>{ translate('INDEX.NO_DATA') }</div> <div>{ translate('INDEX.NO_DATA') }</div>
); );
} else if (this.state.itemsList) {
return TxHistoryListRender.call(this);
} }
return TxHistoryListRender.call(this); return null;
} }
updateAddressSelection(address, type, amount) { updateAddressSelection(address) {
Store.dispatch(changeActiveAddress(address)); Store.dispatch(changeActiveAddress(address));
this.setState(Object.assign({}, this.state, { this.setState(Object.assign({}, this.state, {
currentAddress: address, currentAddress: address,
addressSelectorOpen: false, addressSelectorOpen: false,
activePage: 1,
})); }));
if (this.props.ActiveCoin.mode === 'basilisk') { if (this.props.ActiveCoin.mode === 'basilisk') {
@ -373,27 +374,15 @@ class WalletsData extends React.Component {
})); }));
} }
renderAddress(tx) {
if (!tx.address) {
return (
<span>
<i className="icon fa-bullseye"></i> <span className="label label-dark">{ translate('DASHBOARD.ZADDR_NOT_LISTED') }</span>
</span>
);
}
return tx.address;
}
renderAddressByType(type) { renderAddressByType(type) {
const _addresses = this.props.ActiveCoin.addresses; const _addresses = this.props.ActiveCoin.addresses;
const _coin = this.props.ActiveCoin.coin;
if (_addresses && if (_addresses &&
_addresses[type] && _addresses[type] &&
_addresses[type].length) { _addresses[type].length) {
let items = []; let items = [];
const _cache = this.props.ActiveCoin.cache; const _cache = this.props.ActiveCoin.cache;
const _coin = this.props.ActiveCoin.coin;
for (let i = 0; i < _addresses[type].length; i++) { for (let i = 0; i < _addresses[type].length; i++) {
const address = _addresses[type][i].address; const address = _addresses[type][i].address;
@ -409,19 +398,22 @@ class WalletsData extends React.Component {
} }
return items; return items;
} else { } else if (this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]) {
return null; const address = this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin];
return AddressItemRender.call(this, address, type, null, _coin);
} }
return null;
} }
hasPublicAdresses() { hasPublicAddresses() {
return this.props.ActiveCoin.addresses && return this.props.ActiveCoin.addresses &&
this.props.ActiveCoin.addresses.public && this.props.ActiveCoin.addresses.public &&
this.props.ActiveCoin.addresses.public.length; this.props.ActiveCoin.addresses.public.length;
} }
renderAddressAmount() { renderAddressAmount() {
if (this.hasPublicAdresses()) { if (this.hasPublicAddresses()) {
const _addresses = this.props.ActiveCoin.addresses; const _addresses = this.props.ActiveCoin.addresses;
const _cache = this.props.ActiveCoin.cache; const _cache = this.props.ActiveCoin.cache;
const _coin = this.props.ActiveCoin.coin; const _coin = this.props.ActiveCoin.coin;
@ -463,8 +455,7 @@ class WalletsData extends React.Component {
renderAddressList() { renderAddressList() {
if (this.props.Dashboard && if (this.props.Dashboard &&
this.props.Dashboard.activeHandle && this.props.Dashboard.activeHandle &&
this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin] && this.props.Dashboard.activeHandle[this.props.ActiveCoin.coin]) {
this.props.ActiveCoin.mode === 'basilisk') {
return AddressListRender.call(this); return AddressListRender.call(this);
} else { } else {
return null; return null;

17
react/src/components/dashboard/walletsData/walletsData.render.js

@ -30,10 +30,25 @@ export const TransactionDetailRender = function(transactionIndex) {
); );
}; };
export const AddressRender = function(tx) {
if (!tx.address) {
return (
<span>
<i className="icon fa-bullseye"></i>
<span className="label label-dark">
{ translate('DASHBOARD.ZADDR_NOT_LISTED') }
</span>
</span>
);
}
return tx.address;
};
export const AddressItemRender = function(address, type, amount, coin) { export const AddressItemRender = function(address, type, amount, coin) {
return ( return (
<li key={address}> <li key={address}>
<a onClick={ () => this.updateAddressSelection(address, type, amount) }> <a onClick={ () => this.updateAddressSelection(address) }>
<i className={ 'icon fa-eye' + (type === 'public' ? '' : '-slash') }></i>&nbsp;&nbsp; <i className={ 'icon fa-eye' + (type === 'public' ? '' : '-slash') }></i>&nbsp;&nbsp;
<span className="text">[ { amount } { coin } ]{ address }</span> <span className="text">[ { amount } { coin } ]{ address }</span>
<span className="glyphicon glyphicon-ok check-mark"></span> <span className="glyphicon glyphicon-ok check-mark"></span>

Loading…
Cancel
Save