From 332c7441b656ec82ebfba863e3feb4dbf365d67b Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 18 Oct 2017 23:39:26 -0230 Subject: Get currency from state in account details, send and confirm screens. --- ui/app/components/send/account-list-item.js | 9 +++++---- ui/app/components/send/currency-display.js | 2 +- ui/app/components/send/gas-fee-display-v2.js | 4 +++- ui/app/components/send/send-v2-container.js | 8 +++++--- 4 files changed, 14 insertions(+), 9 deletions(-) (limited to 'ui/app/components/send') diff --git a/ui/app/components/send/account-list-item.js b/ui/app/components/send/account-list-item.js index 64acde767..0938f4cad 100644 --- a/ui/app/components/send/account-list-item.js +++ b/ui/app/components/send/account-list-item.js @@ -4,7 +4,7 @@ const inherits = require('util').inherits const connect = require('react-redux').connect const Identicon = require('../identicon') const CurrencyDisplay = require('./currency-display') -const { conversionRateSelector } = require('../../selectors') +const { conversionRateSelector, getCurrentCurrency } = require('../../selectors') inherits(AccountListItem, Component) function AccountListItem () { @@ -13,7 +13,8 @@ function AccountListItem () { function mapStateToProps(state) { return { - conversionRate: conversionRateSelector(state) + conversionRate: conversionRateSelector(state), + currentCurrency: getCurrentCurrency(state), } } @@ -25,6 +26,7 @@ AccountListItem.prototype.render = function () { handleClick, icon = null, conversionRate, + currentCurrency, } = this.props const { name, address, balance } = account @@ -52,10 +54,9 @@ AccountListItem.prototype.render = function () { h(CurrencyDisplay, { primaryCurrency: 'ETH', - convertedCurrency: 'USD', + convertedCurrency: currentCurrency, value: balance, conversionRate, - convertedPrefix: '$', readOnly: true, className: 'account-list-item__account-balances', primaryBalanceClassName: 'account-list-item__account-primary-balance', diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js index f7fbb2379..2c9a2d33b 100644 --- a/ui/app/components/send/currency-display.js +++ b/ui/app/components/send/currency-display.js @@ -118,7 +118,7 @@ CurrencyDisplay.prototype.render = function () { h('div', { className: convertedBalanceClassName, - }, `${convertedPrefix}${convertedValue} ${convertedCurrency}`), + }, `${convertedValue} ${convertedCurrency.toUpperCase()}`), ]) diff --git a/ui/app/components/send/gas-fee-display-v2.js b/ui/app/components/send/gas-fee-display-v2.js index 3b39312ec..0e23b63ac 100644 --- a/ui/app/components/send/gas-fee-display-v2.js +++ b/ui/app/components/send/gas-fee-display-v2.js @@ -15,6 +15,8 @@ GasFeeDisplay.prototype.render = function () { conversionRate, gasTotal, onClick, + primaryCurrency = 'ETH', + convertedCurrency, } = this.props return h('div.send-v2__gas-fee-display', [ @@ -22,7 +24,7 @@ GasFeeDisplay.prototype.render = function () { gasTotal ? h(CurrencyDisplay, { primaryCurrency: 'ETH', - convertedCurrency: 'USD', + convertedCurrency, value: gasTotal, conversionRate, convertedPrefix: '$', diff --git a/ui/app/components/send/send-v2-container.js b/ui/app/components/send/send-v2-container.js index ebe2b878b..c14865e9f 100644 --- a/ui/app/components/send/send-v2-container.js +++ b/ui/app/components/send/send-v2-container.js @@ -16,6 +16,7 @@ const { getGasLimit, getAddressBook, getSendFrom, + getCurrentCurrency, } = require('../../selectors') module.exports = connect(mapStateToProps, mapDispatchToProps)(SendEther) @@ -30,7 +31,7 @@ function mapStateToProps (state) { let data; let primaryCurrency; - let tokenToUSDRate; + let tokenToFiatRate; if (selectedToken) { data = Array.prototype.map.call( abi.rawEncode(['address', 'uint256'], [selectedAddress, '0x0']), @@ -39,7 +40,7 @@ function mapStateToProps (state) { primaryCurrency = selectedToken.symbol - tokenToUSDRate = multiplyCurrencies( + tokenToFiatRate = multiplyCurrencies( conversionRate, selectedTokenExchangeRate, { toNumericBase: 'dec' } @@ -54,8 +55,9 @@ function mapStateToProps (state) { conversionRate, selectedToken, primaryCurrency, + convertedCurrency: getCurrentCurrency(state), data, - amountConversionRate: selectedToken ? tokenToUSDRate : conversionRate, + amountConversionRate: selectedToken ? tokenToFiatRate : conversionRate, } } -- cgit