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
This commit is contained in:
Nicolas Gotchac 2016-12-10 01:26:47 +01:00 committed by Jaco Greeff
parent 6655e7e3c0
commit b9c04fcd00
3 changed files with 15 additions and 5 deletions

View File

@ -31,12 +31,14 @@ export default class Header extends Component {
account: PropTypes.object, account: PropTypes.object,
balance: PropTypes.object, balance: PropTypes.object,
className: PropTypes.string, className: PropTypes.string,
children: PropTypes.node children: PropTypes.node,
isContract: PropTypes.bool
}; };
static defaultProps = { static defaultProps = {
className: '', className: '',
children: null children: null,
isContract: false
}; };
render () { render () {
@ -88,9 +90,9 @@ export default class Header extends Component {
} }
renderTxCount () { renderTxCount () {
const { balance } = this.props; const { balance, isContract } = this.props;
if (!balance) { if (!balance || isContract) {
return null; return null;
} }

View File

@ -134,6 +134,7 @@ class Contract extends Component {
<Header <Header
account={ account } account={ account }
balance={ balance } balance={ balance }
isContract
/> />
<Queries <Queries

View File

@ -127,6 +127,7 @@ class Wallet extends Component {
className={ styles.header } className={ styles.header }
account={ wallet } account={ wallet }
balance={ balance } balance={ balance }
isContract
> >
{ this.renderInfos() } { this.renderInfos() }
</Header> </Header>
@ -152,7 +153,13 @@ class Wallet extends Component {
return null; 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 spent = api.util.fromWei(dailylimit.spent).toFormat(3);
const date = moment(dailylimit.last.toNumber() * 24 * 3600 * 1000); const date = moment(dailylimit.last.toNumber() * 24 * 3600 * 1000);