diff options
author | Dan Finlay <dan@danfinlay.com> | 2016-09-07 07:45:06 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2016-09-07 07:45:06 +0800 |
commit | 09dd854a96c2756be02d5043be40089a097cadc1 (patch) | |
tree | 6655bd79eb0ae35d3630fa88995cb15b2f5f26d0 | |
parent | 58a8f02294eb1079d92cdf1e6d05a74a224029c3 (diff) | |
download | tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.tar tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.tar.gz tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.tar.bz2 tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.tar.lz tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.tar.xz tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.tar.zst tangerine-wallet-browser-09dd854a96c2756be02d5043be40089a097cadc1.zip |
Nearly finished factoring fiat value into eth-balance
-rw-r--r-- | ui/app/account-detail.js | 4 | ||||
-rw-r--r-- | ui/app/accounts/account-list-item.js | 4 | ||||
-rw-r--r-- | ui/app/app.js | 15 | ||||
-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 |
9 files changed, 19 insertions, 109 deletions
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js index 486a1a633..cc956fed3 100644 --- a/ui/app/account-detail.js +++ b/ui/app/account-detail.js @@ -10,7 +10,7 @@ const ReactCSSTransitionGroup = require('react-addons-css-transition-group') const valuesFor = require('./util').valuesFor const Identicon = require('./components/identicon') -const AccountEtherBalance = require('./components/account-eth-balance') +const EthBalance = require('./components/eth-balance') const TransactionList = require('./components/transaction-list') const ExportAccountView = require('./components/account-export') const ethUtil = require('ethereumjs-util') @@ -168,7 +168,7 @@ AccountDetailScreen.prototype.render = function () { }, }, [ - h(AccountEtherBalance, { + h(EthBalance, { value: account && account.balance, style: { lineHeight: '7px', diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js index aa80e0e23..0b4acdfec 100644 --- a/ui/app/accounts/account-list-item.js +++ b/ui/app/accounts/account-list-item.js @@ -3,7 +3,7 @@ const h = require('react-hyperscript') const inherits = require('util').inherits const ethUtil = require('ethereumjs-util') -const AccountEtherBalance = require('../components/account-eth-balance') +const EthBalance = require('../components/eth-balance') const CopyButton = require('../components/copyButton') const Identicon = require('../components/identicon') @@ -50,7 +50,7 @@ NewComponent.prototype.render = function () { textOverflow: 'ellipsis', }, }, ethUtil.toChecksumAddress(identity.address)), - h(AccountEtherBalance, { + h(EthBalance, { value: account.balance, style: { lineHeight: '7px', diff --git a/ui/app/app.js b/ui/app/app.js index b674efff1..2e05f0038 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -245,7 +245,7 @@ App.prototype.renderNetworkDropdown = function () { label: 'Localhost 8545', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), action: () => props.dispatch(actions.setRpcTarget('http://localhost:8545')), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), activeNetworkRender: props.provider.rpcTarget, }), @@ -253,7 +253,7 @@ App.prototype.renderNetworkDropdown = function () { label: 'Custom RPC', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), }), this.renderCustomOption(props.provider.rpcTarget), @@ -289,21 +289,21 @@ App.prototype.renderDropdown = function () { label: 'Settings', closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-gear.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-gear.fa-lg'), }), h(DropMenuItem, { label: 'Lock', closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), action: () => this.props.dispatch(actions.lockMetamask()), - icon: h('i.fa.fa-lock.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-lock.fa-lg'), }), h(DropMenuItem, { label: 'Help', closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }), action: () => this.props.dispatch(actions.showInfoPage()), - icon: h('i.fa.fa-question.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question.fa-lg'), }), ]) } @@ -312,7 +312,6 @@ App.prototype.renderBackButton = function (style, justArrow = false) { return ( h('.flex-row', { key: 'leftArrow', - transForward: false, style: style, onClick: () => props.dispatch(actions.goBackToInitView()), }, [ @@ -515,14 +514,14 @@ App.prototype.renderCustomOption = function (rpcTarget) { label: 'Custom RPC', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), action: () => this.props.dispatch(actions.showConfigPage()), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), }) default: return h(DropMenuItem, { label: `${rpcTarget}`, closeMenu: () => this.setState({ isNetworkMenuOpen: false }), - icon: h('i.fa.fa-question-circle.fa-lg', { ariaHidden: true }), + icon: h('i.fa.fa-question-circle.fa-lg'), activeNetworkRender: 'custom', }) } 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'), ]) |