diff options
Nearly finished factoring fiat value into eth-balance
Diffstat (limited to 'ui/app/components')
-rw-r--r-- | ui/app/components/account-eth-balance.js | 89 | ||||
-rw-r--r-- | ui/app/components/eth-balance.js | 4 | ||||
-rw-r--r-- | ui/app/components/fiat-value.js | 3 | ||||
-rw-r--r-- | ui/app/components/network.js | 1 | ||||
-rw-r--r-- | ui/app/components/tooltip.js | 7 | ||||
-rw-r--r-- | ui/app/components/transaction-list-item.js | 1 |
6 files changed, 8 insertions, 97 deletions
diff --git a/ui/app/components/account-eth-balance.js b/ui/app/components/account-eth-balance.js deleted file mode 100644 index 1e4437405..000000000 --- a/ui/app/components/account-eth-balance.js +++ /dev/null @@ -1,89 +0,0 @@ -const Component = require('react').Component -const h = require('react-hyperscript') -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') - -module.exports = EthBalanceComponent - -inherits(EthBalanceComponent, Component) -function EthBalanceComponent () { - Component.call(this) -} - -EthBalanceComponent.prototype.render = function () { - var props = this.props - var style = props.style - - var width = props.width - - return ( - - h('.ether-balance', { - style: style, - }, [ - h('.ether-balance-amount', { - style: { - display: 'inline', - width: width, - }, - }, this.renderBalance()), - ]) - ) -} - -EthBalanceComponent.prototype.renderBalance = function () { - const props = this.props - const value = formatBalance(props.value, 6) - - if (value === 'None') return value - var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) - var balance - var splitBalance = value.split(' ') - var ethNumber = splitBalance[0] - var ethSuffix = splitBalance[1] - - if (props.shorten) { - balance = balanceObj.shortBalance - } else { - balance = balanceObj.balance - } - - var label = balanceObj.label - - return ( - h('.flex-column', [ - h(Tooltip, { - position: 'bottom', - title: `${ethNumber} ${ethSuffix}`, - }, [ - h('.flex-row', { - style: { - alignItems: 'flex-end', - lineHeight: '13px', - fontFamily: 'Montserrat Light', - textRendering: 'geometricPrecision', - marginBottom: '5px', - }, - }, [ - h('div', { - style: { - width: '100%', - textAlign: 'right', - }, - }, balance), - h('div', { - style: { - color: '#AEAEAE', - marginLeft: '5px', - }, - }, label), - ]), - ]), - h(FiatValue, { value: props.value }), - ]) - ) -} - diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js index 055cf6dd3..c77bda626 100644 --- a/ui/app/components/eth-balance.js +++ b/ui/app/components/eth-balance.js @@ -19,7 +19,6 @@ EthBalanceComponent.prototype.render = function () { var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true const value = formatBalance(props.value, 6, needsParse) var width = props.width - const showFiat = 'showFiat' in props ? props.showFiat : true return ( @@ -44,6 +43,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) { var splitBalance = value.split(' ') var ethNumber = splitBalance[0] var ethSuffix = splitBalance[1] + const showFiat = 'showFiat' in props ? props.showFiat : true if (props.shorten) { balance = balanceObj.shortBalance @@ -80,7 +80,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) { }, label), ]), - fiatValue ? h(FiatValue, { value: props.value }) : null, + showFiat ? h(FiatValue, { value: props.value }) : null, ]) ) } diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 0aa7d0bc5..7322e43e8 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -4,7 +4,7 @@ const inherits = require('util').inherits const connect = require('react-redux').connect const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject -const Tooltip = require('./tooltip.js') +const Tooltip = require('./tooltip') module.exports = connect(mapStateToProps)(FiatValue) @@ -25,7 +25,6 @@ FiatValue.prototype.render = function () { const value = formatBalance(props.value, 6) if (value === 'None') return value - var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3) var fiatDisplayNumber, fiatTooltipNumber var splitBalance = value.split(' ') diff --git a/ui/app/components/network.js b/ui/app/components/network.js index 6826e0685..845861396 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -75,7 +75,6 @@ Network.prototype.render = function () { default: return h('.network-indicator', [ h('i.fa.fa-question-circle.fa-lg', { - ariaHidden: true, style: { margin: '10px', color: 'rgb(125, 128, 130)', diff --git a/ui/app/components/tooltip.js b/ui/app/components/tooltip.js index fb67c717e..440393b08 100644 --- a/ui/app/components/tooltip.js +++ b/ui/app/components/tooltip.js @@ -12,11 +12,12 @@ function Tooltip () { Tooltip.prototype.render = function () { const props = this.props + const { position, title, children } = props return h(ReactTooltip, { - position: props.position ? props.position : 'left', - title: props.title, + position: position || 'left', + title, fixed: false, - }, props.children) + }, children) } diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js index 1b85464e1..66a232981 100644 --- a/ui/app/components/transaction-list-item.js +++ b/ui/app/components/transaction-list-item.js @@ -77,6 +77,7 @@ TransactionListItem.prototype.render = function () { value: txParams.value, width: '55px', shorten: true, + showFiat: false, style: {fontSize: '15px'}, }) : h('.flex-column'), ]) |