diff options
author | Frankie <frankie.diamond@gmail.com> | 2016-07-14 06:46:36 +0800 |
---|---|---|
committer | Dan Finlay <somniac@me.com> | 2016-07-14 06:46:36 +0800 |
commit | dbc9008295f96b8917c5b66d8df2c2e2360c2814 (patch) | |
tree | e3d5ef6010156bbee1e9d93ce1fe8206e527916f /ui/app/util.js | |
parent | 7b9b22e8a082bf78061030d176327914a4ad54de (diff) | |
download | tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.tar tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.tar.gz tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.tar.bz2 tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.tar.lz tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.tar.xz tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.tar.zst tangerine-wallet-browser-dbc9008295f96b8917c5b66d8df2c2e2360c2814.zip |
Fix eth balance tooltip to show 6 decimals (#440)
* Fix tooltip to show to the 6 decimal place on balances ovr 0...
* Change font size for balance component in tx-list so it fits the notation
* Add to change log
* Linting
* change log
Diffstat (limited to 'ui/app/util.js')
-rw-r--r-- | ui/app/util.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/app/util.js b/ui/app/util.js index c04612455..a08006077 100644 --- a/ui/app/util.js +++ b/ui/app/util.js @@ -122,7 +122,11 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) { var afterDecimal = balance.split('.')[1] var shortBalance = shortenBalance(balance, decimalsToKeep) - if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') { balance = '<1.0e-5' } + if (beforeDecimal === '0' && afterDecimal.substr(0, 5) === '00000') { + balance = '<1.0e-5' + } else if (beforeDecimal !== '0') { + balance = `${beforeDecimal}.${afterDecimal.slice(0, decimalsToKeep)}` + } return { balance, label, shortBalance } } @@ -141,7 +145,7 @@ function shortenBalance (balance, decimalsToKeep = 1) { truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep) return `<${truncatedValue}e-${exponent}` } else { - return balance + return convertedBalance.toFixed(decimalsToKeep) } } |