aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-05-17 02:34:53 +0800
committerDan Finlay <dan@danfinlay.com>2017-05-17 02:36:21 +0800
commitb4e6ea9db787cbf7839d9caad6e1ea0385cc588e (patch)
treea476d521bc8d17f9598b8e1fdc98e51dded88cbf /ui/app/components
parentd165f3a2b6f55cd1f4d4809c61ab3a4af5f8b070 (diff)
downloadtangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.tar
tangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.tar.gz
tangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.tar.bz2
tangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.tar.lz
tangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.tar.xz
tangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.tar.zst
tangerine-wallet-browser-b4e6ea9db787cbf7839d9caad6e1ea0385cc588e.zip
Fix fiat rendering
Fixes #1439. When reorganizing fiat-value component to not use global state, had missed its necessary `currentCurrency` parameter. This now passes it in wherever it's used.
Diffstat (limited to 'ui/app/components')
-rw-r--r--ui/app/components/eth-balance.js4
-rw-r--r--ui/app/components/fiat-value.js6
-rw-r--r--ui/app/components/pending-tx.js9
-rw-r--r--ui/app/components/shift-list-item.js8
-rw-r--r--ui/app/components/transaction-list-item.js7
5 files changed, 20 insertions, 14 deletions
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js
index 21906aa09..4f538fd31 100644
--- a/ui/app/components/eth-balance.js
+++ b/ui/app/components/eth-balance.js
@@ -37,7 +37,7 @@ EthBalanceComponent.prototype.render = function () {
}
EthBalanceComponent.prototype.renderBalance = function (value) {
var props = this.props
- const { conversionRate, shorten, incoming } = props
+ const { conversionRate, shorten, incoming, currentCurrency } = props
if (value === 'None') return value
if (value === '...') return value
var balanceObj = generateBalanceObject(value, shorten ? 1 : 3)
@@ -83,7 +83,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) {
}, label),
]),
- showFiat ? h(FiatValue, { value, conversionRate }) : null,
+ showFiat ? h(FiatValue, { value: props.value, conversionRate, currentCurrency }) : null,
]))
)
}
diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js
index 6e306c9e6..8a64a1cfc 100644
--- a/ui/app/components/fiat-value.js
+++ b/ui/app/components/fiat-value.js
@@ -12,7 +12,7 @@ function FiatValue () {
FiatValue.prototype.render = function () {
const props = this.props
- const { conversionRate } = props
+ const { conversionRate, currentCurrency } = props
const value = formatBalance(props.value, 6)
@@ -28,9 +28,7 @@ FiatValue.prototype.render = function () {
fiatTooltipNumber = 'Unknown'
}
- var fiatSuffix = props.currentCurrency
-
- return fiatDisplay(fiatDisplayNumber, fiatSuffix)
+ return fiatDisplay(fiatDisplayNumber, currentCurrency)
}
function fiatDisplay (fiatDisplayNumber, fiatSuffix) {
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index b084a1d2a..0d1f06ba6 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -31,6 +31,8 @@ function PendingTx () {
PendingTx.prototype.render = function () {
const props = this.props
+ const { currentCurrency } = props
+
const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {}
@@ -104,6 +106,7 @@ PendingTx.prototype.render = function () {
h(EthBalance, {
value: balance,
conversionRate,
+ currentCurrency,
inline: true,
labelColor: '#F7861C',
}),
@@ -141,7 +144,7 @@ PendingTx.prototype.render = function () {
// in the way that gas and gasLimit currently are.
h('.row', [
h('.cell.label', 'Amount'),
- h(EthBalance, { value: txParams.value }),
+ h(EthBalance, { value: txParams.value, currentCurrency, conversionRate }),
]),
// Gas Limit (customizable)
@@ -189,7 +192,7 @@ PendingTx.prototype.render = function () {
// Max Transaction Fee (calculated)
h('.cell.row', [
h('.cell.label', 'Max Transaction Fee'),
- h(EthBalance, { value: txFeeBn.toString(16) }),
+ h(EthBalance, { value: txFeeBn.toString(16), currentCurrency, conversionRate }),
]),
h('.cell.row', {
@@ -208,6 +211,8 @@ PendingTx.prototype.render = function () {
}, [
h(EthBalance, {
value: maxCost.toString(16),
+ currentCurrency,
+ conversionRate,
inline: true,
labelColor: 'black',
fontSize: '16px',
diff --git a/ui/app/components/shift-list-item.js b/ui/app/components/shift-list-item.js
index db5fda5cb..32bfbeda4 100644
--- a/ui/app/components/shift-list-item.js
+++ b/ui/app/components/shift-list-item.js
@@ -8,7 +8,7 @@ const actions = require('../actions')
const addressSummary = require('../util').addressSummary
const CopyButton = require('./copyButton')
-const EtherBalance = require('./eth-balance')
+const EthBalance = require('./eth-balance')
const Tooltip = require('./tooltip')
@@ -17,6 +17,7 @@ module.exports = connect(mapStateToProps)(ShiftListItem)
function mapStateToProps (state) {
return {
conversionRate: state.metamask.conversionRate,
+ currentCurrency: state.metamask.currentCurrency,
}
}
@@ -66,7 +67,7 @@ function formatDate (date) {
ShiftListItem.prototype.renderUtilComponents = function () {
var props = this.props
- const { conversionRate } = props
+ const { conversionRate, currentCurrency } = props
switch (props.response.status) {
case 'no_deposits':
@@ -97,9 +98,10 @@ ShiftListItem.prototype.renderUtilComponents = function () {
h(CopyButton, {
value: this.props.response.transaction,
}),
- h(EtherBalance, {
+ h(EthBalance, {
value: `${props.response.outgoingCoin}`,
conversionRate,
+ currentCurrency,
width: '55px',
shorten: true,
needsParse: false,
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index 3db4c016e..c2a585003 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -2,7 +2,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const EtherBalance = require('./eth-balance')
+const EthBalance = require('./eth-balance')
const addressSummary = require('../util').addressSummary
const explorerLink = require('../../lib/explorer-link')
const CopyButton = require('./copyButton')
@@ -19,7 +19,7 @@ function TransactionListItem () {
}
TransactionListItem.prototype.render = function () {
- const { transaction, network, conversionRate } = this.props
+ const { transaction, network, conversionRate, currentCurrency } = this.props
if (transaction.key === 'shapeshift') {
if (network === '1') return h(ShiftListItem, transaction)
}
@@ -78,9 +78,10 @@ TransactionListItem.prototype.render = function () {
// Places a copy button if tx is successful, else places a placeholder empty div.
transaction.hash ? h(CopyButton, { value: transaction.hash }) : h('div', {style: { display: 'flex', alignItems: 'center', width: '26px' }}),
- isTx ? h(EtherBalance, {
+ isTx ? h(EthBalance, {
value: txParams.value,
conversionRate,
+ currentCurrency,
width: '55px',
shorten: true,
showFiat: false,