Browse Source

receive hide zero-balance toggle if balance is 0

all-modes
pbca26 8 years ago
parent
commit
1a71c93f2b
  1. 38
      react/src/components/dashboard/receiveCoin/receiveCoin.js
  2. 35
      react/src/components/dashboard/receiveCoin/receiveCoin.render.js
  3. 2
      react/src/components/dashboard/walletsNative/walletsNative.render.js

38
react/src/components/dashboard/receiveCoin/receiveCoin.js

@ -27,6 +27,7 @@ class ReceiveCoin extends React.Component {
this.openDropMenu = this.openDropMenu.bind(this);
this.handleClickOutside = this.handleClickOutside.bind(this);
this.toggleVisibleAddress = this.toggleVisibleAddress.bind(this);
this.checkTotalBalance = this.checkTotalBalance.bind(this);
}
componentWillMount() {
@ -115,7 +116,42 @@ class ReceiveCoin extends React.Component {
hideZeroAddresses: !this.state.hideZeroAddresses,
}));
}
checkTotalBalance() {
let _balance = '0';
const _mode = this.props.mode;
if (_mode === 'full') {
_balance = this.props.balance || 0;
} else if (_mode === 'basilisk') {
if (this.props.cache) {
const _cache = this.props.cache;
const _coin = this.props.coin;
const _address = this.props.activeAddress;
if (_address &&
_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.interest)) {
const _regBalance = _cache[_coin][_address].getbalance.data.balance ? _cache[_coin][_address].getbalance.data.balance : 0;
const _regInterest = _cache[_coin][_address].getbalance.data.interest ? _cache[_coin][_address].getbalance.data.interest : 0;
_balance = _regBalance + _regInterest;
}
}
} else if (_mode === 'native') {
if (this.props.balance &&
this.props.balance.total) {
_balance = this.props.balance.total;
}
}
return _balance;
}
renderAddressList(type) {
const _addresses = this.props.addresses;
const _cache = this.props.cache;

35
react/src/components/dashboard/receiveCoin/receiveCoin.render.js

@ -76,8 +76,9 @@ export const ReceiveCoinRender = function() {
<header className="panel-heading">
{this.isNativeMode() &&
<div className="panel-actions">
<div className={ 'dropdown' + (this.state.openDropMenu ? ' open' : '') }
onClick={ this.openDropMenu }>
<div
className={ 'dropdown' + (this.state.openDropMenu ? ' open' : '') }
onClick={ this.openDropMenu }>
<a className="dropdown-toggle white btn btn-warning">
<i className="icon md-arrows margin-right-10"></i> { translate('INDEX.GET_NEW_ADDRESS') }
<span className="caret"></span>
@ -101,21 +102,23 @@ export const ReceiveCoinRender = function() {
<h4 className="panel-title">{ translate('INDEX.RECEIVING_ADDRESS') }</h4>
</header>
<div className="panel-body">
<div className="text-right">
<div
className="toggle-label margin-right-15 pointer"
onClick={ this.toggleVisibleAddress }>
{ translate('INDEX.TOGGLE_ZERO_ADDRESSES') }
</div>
<label className="switch">
<input
type="checkbox"
checked={ this.state.hideZeroAddresses } />
{ this.checkTotalBalance() === 0 &&
<div className="text-left padding-top-10 padding-bottom-10">
<div
className="slider"
onClick={ this.toggleVisibleAddress }></div>
</label>
</div>
className="toggle-label margin-right-15 pointer"
onClick={ this.toggleVisibleAddress }>
{ translate('INDEX.TOGGLE_ZERO_ADDRESSES') }
</div>
<label className="switch">
<input
type="checkbox"
checked={ this.state.hideZeroAddresses } />
<div
className="slider"
onClick={ this.toggleVisibleAddress }></div>
</label>
</div>
}
<table className="table table-hover dataTable table-striped">
<thead>
{ this.isNativeMode() ?

2
react/src/components/dashboard/walletsNative/walletsNative.render.js

@ -16,7 +16,7 @@ const WalletsNativeRender = function() {
style={{ 'backgroundImage': `url("assets/images/bg/${this.defaultBG()}_transparent_header_bg.png")` }}>
<ol className="breadcrumb">
<li className="header-easydex-section">
<img src={ `assets/images/native/${this.defaultBG()}_header_title_logo.png` } />
<img src={ `assets/images/native/${this.defaultBG()}_header_title_logo.png` } />
<span
className={ `easydex-section-image ${(this.props.ActiveCoin.coin === 'KMD' ? 'hide' : '')}` }
style={{ marginLeft: '20px' }}>

Loading…
Cancel
Save