Merge branch 'master' into i390-TransactionLimit

feature/default_network_editable
Dan Finlay 8 years ago
commit 8592ffd855
  1. 1
      CHANGELOG.md
  2. 17
      ui/app/components/account-eth-balance.js
  3. 15
      ui/app/util.js

@ -5,6 +5,7 @@
- Added feature to reflect current conversion rates of current vault balance. - Added feature to reflect current conversion rates of current vault balance.
- Transaction history now has a hard limit. - Transaction history now has a hard limit.
- Added a link to view more account info after transaction history. - Added a link to view more account info after transaction history.
- Modify balance display logic.
## 2.8.0 2016-08-15 ## 2.8.0 2016-08-15

@ -46,16 +46,17 @@ EthBalanceComponent.prototype.render = function () {
EthBalanceComponent.prototype.renderBalance = function (value, state) { EthBalanceComponent.prototype.renderBalance = function (value, state) {
if (value === 'None') return value if (value === 'None') return value
var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3) var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3)
var balance, fiatNumber var balance, fiatDisplayNumber, fiatTooltipNumber
var splitBalance = value.split(' ') var splitBalance = value.split(' ')
var ethNumber = splitBalance[0] var ethNumber = splitBalance[0]
var ethSuffix = splitBalance[1] var ethSuffix = splitBalance[1]
if (state.conversionRate !== 0) { if (state.conversionRate !== 0) {
fiatNumber = (Number(splitBalance[0]) * state.conversionRate).toFixed(2) fiatTooltipNumber = Number(splitBalance[0]) * state.conversionRate
fiatDisplayNumber = fiatTooltipNumber.toFixed(2)
} else { } else {
fiatNumber = 'N/A' fiatDisplayNumber = 'N/A'
} }
var fiatSuffix = state.currentFiat var fiatSuffix = state.currentFiat
@ -99,16 +100,16 @@ EthBalanceComponent.prototype.renderBalance = function (value, state) {
]), ]),
h(Tooltip, { h(Tooltip, {
position: 'bottom', position: 'bottom',
title: `${fiatNumber} ${fiatSuffix}`, title: `${fiatTooltipNumber} ${fiatSuffix}`,
}, [ }, [
fiatDisplay(fiatNumber, fiatSuffix), fiatDisplay(fiatDisplayNumber, fiatSuffix),
]), ]),
]) ])
) )
} }
function fiatDisplay (fiatNumber, fiatSuffix) { function fiatDisplay (fiatDisplayNumber, fiatSuffix) {
if (fiatNumber !== 'N/A') { if (fiatDisplayNumber !== 'N/A') {
return h('.flex-row', { return h('.flex-row', {
style: { style: {
alignItems: 'flex-end', alignItems: 'flex-end',
@ -124,7 +125,7 @@ function fiatDisplay (fiatNumber, fiatSuffix) {
fontSize: '12px', fontSize: '12px',
color: '#333333', color: '#333333',
}, },
}, fiatNumber), }, fiatDisplayNumber),
h('div', { h('div', {
style: { style: {
color: '#AEAEAE', color: '#AEAEAE',

@ -141,16 +141,21 @@ function shortenBalance (balance, decimalsToKeep = 1) {
var convertedBalance = parseFloat(balance) var convertedBalance = parseFloat(balance)
if (convertedBalance > 1000000) { if (convertedBalance > 1000000) {
truncatedValue = (balance / 1000000).toFixed(decimalsToKeep) truncatedValue = (balance / 1000000).toFixed(decimalsToKeep)
return `>${truncatedValue}m` return `${truncatedValue}m`
} else if (convertedBalance > 1000) { } else if (convertedBalance > 1000) {
truncatedValue = (balance / 1000).toFixed(decimalsToKeep) truncatedValue = (balance / 1000).toFixed(decimalsToKeep)
return `>${truncatedValue}k` return `${truncatedValue}k`
} else if (convertedBalance === 0) { } else if (convertedBalance === 0) {
return '0' return '0'
} else if (convertedBalance < 0.001) {
return '<0.001'
} else if (convertedBalance < 1) { } else if (convertedBalance < 1) {
var exponent = balance.match(/\.0*/)[0].length var stringBalance = convertedBalance.toString()
truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep) if (stringBalance.split('.')[1].length > 3) {
return `<${truncatedValue}e-${exponent}` return convertedBalance.toFixed(3)
} else {
return stringBalance
}
} else { } else {
return convertedBalance.toFixed(decimalsToKeep) return convertedBalance.toFixed(decimalsToKeep)
} }

Loading…
Cancel
Save