mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
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
This commit is contained in:
parent
7b9b22e8a0
commit
dbc9008295
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Current Master
|
## Current Master
|
||||||
|
|
||||||
|
- Fix tool tips on Eth balance to show the 6 decimals
|
||||||
- Fix rendering of recipient SVG in tx approval notification.
|
- Fix rendering of recipient SVG in tx approval notification.
|
||||||
- New vaults now generate only one wallet instead of three.
|
- New vaults now generate only one wallet instead of three.
|
||||||
- Bumped version of web3 provider engine.
|
- Bumped version of web3 provider engine.
|
||||||
|
@ -15,7 +15,7 @@ EthBalanceComponent.prototype.render = function () {
|
|||||||
var state = this.props
|
var state = this.props
|
||||||
var style = state.style
|
var style = state.style
|
||||||
|
|
||||||
const value = formatBalance(state.value)
|
const value = formatBalance(state.value, 6)
|
||||||
var width = state.width
|
var width = state.width
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -35,7 +35,7 @@ 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, 1)
|
var balanceObj = generateBalanceObject(value, state.shorten ? 1 : 3)
|
||||||
var balance
|
var balance
|
||||||
|
|
||||||
if (state.shorten) {
|
if (state.shorten) {
|
||||||
|
@ -75,6 +75,7 @@ TransactionListItem.prototype.render = function () {
|
|||||||
value: txParams.value,
|
value: txParams.value,
|
||||||
width: '55px',
|
width: '55px',
|
||||||
shorten: true,
|
shorten: true,
|
||||||
|
style: {fontSize: '15px'},
|
||||||
}) : h('.flex-column'),
|
}) : h('.flex-column'),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
@ -122,7 +122,11 @@ function generateBalanceObject (formattedBalance, decimalsToKeep = 1) {
|
|||||||
var afterDecimal = balance.split('.')[1]
|
var afterDecimal = balance.split('.')[1]
|
||||||
var shortBalance = shortenBalance(balance, decimalsToKeep)
|
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 }
|
return { balance, label, shortBalance }
|
||||||
}
|
}
|
||||||
@ -141,7 +145,7 @@ function shortenBalance (balance, decimalsToKeep = 1) {
|
|||||||
truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep)
|
truncatedValue = (convertedBalance * Math.pow(10, exponent)).toFixed(decimalsToKeep)
|
||||||
return `<${truncatedValue}e-${exponent}`
|
return `<${truncatedValue}e-${exponent}`
|
||||||
} else {
|
} else {
|
||||||
return balance
|
return convertedBalance.toFixed(decimalsToKeep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user