From b9c04fcd0090a93fe0365a5d5bc2dafac184d6e4 Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Sat, 10 Dec 2016 01:26:47 +0100 Subject: [PATCH] Fixes to the Wallet UI (#3787) * Correct number of transactions for contracts * Remove daily limit info if set to 0 * Hide tx count for contracts --- js/src/views/Account/Header/header.js | 10 ++++++---- js/src/views/Contract/contract.js | 1 + js/src/views/Wallet/wallet.js | 9 ++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/js/src/views/Account/Header/header.js b/js/src/views/Account/Header/header.js index b126951b2..6ce88aef4 100644 --- a/js/src/views/Account/Header/header.js +++ b/js/src/views/Account/Header/header.js @@ -31,12 +31,14 @@ export default class Header extends Component { account: PropTypes.object, balance: PropTypes.object, className: PropTypes.string, - children: PropTypes.node + children: PropTypes.node, + isContract: PropTypes.bool }; static defaultProps = { className: '', - children: null + children: null, + isContract: false }; render () { @@ -88,9 +90,9 @@ export default class Header extends Component { } renderTxCount () { - const { balance } = this.props; + const { balance, isContract } = this.props; - if (!balance) { + if (!balance || isContract) { return null; } diff --git a/js/src/views/Contract/contract.js b/js/src/views/Contract/contract.js index 4f7570ebd..e501e4fe5 100644 --- a/js/src/views/Contract/contract.js +++ b/js/src/views/Contract/contract.js @@ -134,6 +134,7 @@ class Contract extends Component {
{ this.renderInfos() }
@@ -152,7 +153,13 @@ class Wallet extends Component { return null; } - const limit = api.util.fromWei(dailylimit.limit).toFormat(3); + const _limit = api.util.fromWei(dailylimit.limit); + + if (_limit.equals(0)) { + return null; + } + + const limit = _limit.toFormat(3); const spent = api.util.fromWei(dailylimit.spent).toFormat(3); const date = moment(dailylimit.last.toNumber() * 24 * 3600 * 1000);