diff options
Diffstat (limited to 'ui/app/components/eth-balance.js')
-rw-r--r-- | ui/app/components/eth-balance.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 612ef7779..498873faa 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -4,6 +4,7 @@ const inherits = require('util').inherits const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject const Tooltip = require('./tooltip.js') + module.exports = EthBalanceComponent inherits(EthBalanceComponent, Component) @@ -14,29 +15,33 @@ function EthBalanceComponent () { EthBalanceComponent.prototype.render = function () { var state = this.props var style = state.style - - const value = formatBalance(state.value, 6) + var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true + const value = formatBalance(state.value, 6, needsParse) var width = state.width return ( - h('.ether-balance', { + h('.ether-balance.ether-balance-amount', { style: style, }, [ - h('.ether-balance-amount', { + h('div', { style: { display: 'inline', width: width, }, - }, this.renderBalance(value, state)), + }, this.renderBalance(value)), ]) ) } -EthBalanceComponent.prototype.renderBalance = function (value, state) { +EthBalanceComponent.prototype.renderBalance = function (value) { + var state = this.props if (value === 'None') return value var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3) var balance + var splitBalance = value.split(' ') + var ethNumber = splitBalance[0] + var ethSuffix = splitBalance[1] if (state.shorten) { balance = balanceObj.shortBalance @@ -49,7 +54,7 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { return ( h(Tooltip, { position: 'bottom', - title: value.split(' ')[0], + title: `${ethNumber} ${ethSuffix}`, }, [ h('.flex-column', { style: { @@ -64,7 +69,7 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) { width: '100%', textAlign: 'right', }, - }, balance), + }, this.props.incoming ? `+${balance}` : balance), h('div', { style: { color: ' #AEAEAE', |