aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/account-eth-balance.js
diff options
context:
space:
mode:
authorKevin Serrano <kevgagser@gmail.com>2016-08-17 05:49:21 +0800
committerKevin Serrano <kevgagser@gmail.com>2016-08-17 05:49:21 +0800
commit0b052e94ccd718afe8b0a148085875409e30eb76 (patch)
treeded5d284c2cb2811d0eb9b3ee9f66fce97767c2a /ui/app/components/account-eth-balance.js
parent9afa9781216ed3dcf17d1b71bb7db4a05b0235cf (diff)
downloadtangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.tar
tangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.tar.gz
tangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.tar.bz2
tangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.tar.lz
tangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.tar.xz
tangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.tar.zst
tangerine-wallet-browser-0b052e94ccd718afe8b0a148085875409e30eb76.zip
Hide conversions when API fails.
Diffstat (limited to 'ui/app/components/account-eth-balance.js')
-rw-r--r--ui/app/components/account-eth-balance.js71
1 files changed, 42 insertions, 29 deletions
diff --git a/ui/app/components/account-eth-balance.js b/ui/app/components/account-eth-balance.js
index 260444688..ad6033716 100644
--- a/ui/app/components/account-eth-balance.js
+++ b/ui/app/components/account-eth-balance.js
@@ -44,13 +44,22 @@ EthBalanceComponent.prototype.render = function () {
)
}
EthBalanceComponent.prototype.renderBalance = function (value, state) {
+ console.log("THIS IS VALUE")
+ console.log(value)
+ console.log(state.conversionRate)
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]
- var fiatNumber = Number(splitBalance[0]) * state.conversionRate
+
+ if (state.conversionRate !== 'N/A') {
+ var fiatNumber = (Number(splitBalance[0]) * state.conversionRate).toFixed(2)
+ } else {
+ var fiatNumber = 'N/A'
+ }
+
var fiatSuffix = state.currentFiat
if (state.shorten) {
@@ -59,10 +68,6 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) {
balance = balanceObj.balance
}
- if (fiatNumber !== 'N/A') {
- fiatNumber = fiatNumber.toFixed(2)
- }
-
var label = balanceObj.label
return (
@@ -98,31 +103,39 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) {
position: 'bottom',
title: `${fiatNumber} ${fiatSuffix}`,
}, [
- h('.flex-row', {
- style: {
- alignItems: 'flex-end',
- lineHeight: '13px',
- fontFamily: 'Montserrat Light',
- textRendering: 'geometricPrecision',
- },
- }, [
- h('div', {
- style: {
- width: '100%',
- textAlign: 'right',
- fontSize: '12px',
- color: '#333333',
- },
- }, `= ${fiatNumber}`),
- h('div', {
- style: {
- color: '#AEAEAE',
- marginLeft: '5px',
- fontSize: '12px',
- },
- }, fiatSuffix),
- ]),
+ fiatDisplay (fiatNumber, fiatSuffix)
]),
])
)
}
+
+function fiatDisplay (fiatNumber, fiatSuffix) {
+ if (fiatNumber !== 'N/A') {
+ return h('.flex-row', {
+ style: {
+ alignItems: 'flex-end',
+ lineHeight: '13px',
+ fontFamily: 'Montserrat Light',
+ textRendering: 'geometricPrecision',
+ },
+ }, [
+ h('div', {
+ style: {
+ width: '100%',
+ textAlign: 'right',
+ fontSize: '12px',
+ color: '#333333',
+ },
+ }, fiatNumber),
+ h('div', {
+ style: {
+ color: '#AEAEAE',
+ marginLeft: '5px',
+ fontSize: '12px',
+ },
+ }, fiatSuffix),
+ ])
+ } else {
+ return h('div')
+ }
+}