aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/eth-balance.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-09-04 05:20:27 +0800
committerDan Finlay <dan@danfinlay.com>2016-09-04 05:20:27 +0800
commitb2ebb6032d3f99eb0e9eb90364a0cd95c7775bde (patch)
tree7147e4bc1bd3d9a688295f255be637bdc789b3f2 /ui/app/components/eth-balance.js
parenta76e198c9c23cfe93346ea7690925fe9d3be5843 (diff)
downloadtangerine-wallet-browser-b2ebb6032d3f99eb0e9eb90364a0cd95c7775bde.tar.gz
tangerine-wallet-browser-b2ebb6032d3f99eb0e9eb90364a0cd95c7775bde.tar.zst
tangerine-wallet-browser-b2ebb6032d3f99eb0e9eb90364a0cd95c7775bde.zip
Continuing fiat balance modularization
Diffstat (limited to 'ui/app/components/eth-balance.js')
-rw-r--r--ui/app/components/eth-balance.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js
index 498873faa..055cf6dd3 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')
+const FiatValue = require('./fiat-value.js')
module.exports = EthBalanceComponent
@@ -13,11 +14,12 @@ function EthBalanceComponent () {
}
EthBalanceComponent.prototype.render = function () {
- var state = this.props
- var style = state.style
+ var props = this.props
+ var style = props.style
var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true
- const value = formatBalance(state.value, 6, needsParse)
- var width = state.width
+ const value = formatBalance(props.value, 6, needsParse)
+ var width = props.width
+ const showFiat = 'showFiat' in props ? props.showFiat : true
return (
@@ -35,15 +37,15 @@ EthBalanceComponent.prototype.render = function () {
)
}
EthBalanceComponent.prototype.renderBalance = function (value) {
- var state = this.props
+ var props = this.props
if (value === 'None') return value
- var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3)
+ var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3)
var balance
var splitBalance = value.split(' ')
var ethNumber = splitBalance[0]
var ethSuffix = splitBalance[1]
- if (state.shorten) {
+ if (props.shorten) {
balance = balanceObj.shortBalance
} else {
balance = balanceObj.balance
@@ -77,6 +79,8 @@ EthBalanceComponent.prototype.renderBalance = function (value) {
},
}, label),
]),
+
+ fiatValue ? h(FiatValue, { value: props.value }) : null,
])
)
}