aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/currency-display/currency-display.container.js
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2018-10-18 08:30:07 +0800
committerGitHub <noreply@github.com>2018-10-18 08:30:07 +0800
commitc2f97717c0fbf9a64cf527891f7a1f35049fb023 (patch)
treef62dabf7a62798ad82641305422fb4e0bcc0a74a /ui/app/components/currency-display/currency-display.container.js
parent85884b21afe6e5e85b58123b24e72776d1437cc6 (diff)
parent17372e150d7070e9f4870e65a7d6c1d88568f2f5 (diff)
downloadtangerine-wallet-browser-c2f97717c0fbf9a64cf527891f7a1f35049fb023.tar.gz
tangerine-wallet-browser-c2f97717c0fbf9a64cf527891f7a1f35049fb023.tar.zst
tangerine-wallet-browser-c2f97717c0fbf9a64cf527891f7a1f35049fb023.zip
Merge pull request #5539 from MetaMask/v4.16.0
Version 4.16.0
Diffstat (limited to 'ui/app/components/currency-display/currency-display.container.js')
-rw-r--r--ui/app/components/currency-display/currency-display.container.js25
1 files changed, 22 insertions, 3 deletions
diff --git a/ui/app/components/currency-display/currency-display.container.js b/ui/app/components/currency-display/currency-display.container.js
index 6644a1099..b387229b5 100644
--- a/ui/app/components/currency-display/currency-display.container.js
+++ b/ui/app/components/currency-display/currency-display.container.js
@@ -2,10 +2,26 @@ import { connect } from 'react-redux'
import CurrencyDisplay from './currency-display.component'
import { getValueFromWeiHex, formatCurrency } from '../../helpers/confirm-transaction/util'
-const mapStateToProps = (state, ownProps) => {
- const { value, numberOfDecimals = 2, currency, denomination, hideLabel } = ownProps
+const mapStateToProps = state => {
const { metamask: { currentCurrency, conversionRate } } = state
+ return {
+ currentCurrency,
+ conversionRate,
+ }
+}
+
+const mergeProps = (stateProps, dispatchProps, ownProps) => {
+ const { currentCurrency, conversionRate, ...restStateProps } = stateProps
+ const {
+ value,
+ numberOfDecimals = 2,
+ currency,
+ denomination,
+ hideLabel,
+ ...restOwnProps
+ } = ownProps
+
const toCurrency = currency || currentCurrency
const convertedValue = getValueFromWeiHex({
value, toCurrency, conversionRate, numberOfDecimals, toDenomination: denomination,
@@ -14,8 +30,11 @@ const mapStateToProps = (state, ownProps) => {
const displayValue = hideLabel ? formattedValue : `${formattedValue} ${toCurrency.toUpperCase()}`
return {
+ ...restStateProps,
+ ...dispatchProps,
+ ...restOwnProps,
displayValue,
}
}
-export default connect(mapStateToProps)(CurrencyDisplay)
+export default connect(mapStateToProps, null, mergeProps)(CurrencyDisplay)