diff options
author | Dan <danjm.com@gmail.com> | 2018-03-29 23:00:44 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-03-29 23:12:38 +0800 |
commit | 0a711f0de0e342b24988a5da4ca5c64342153210 (patch) | |
tree | 9dd6014e6389cfad02d5380e6810a12fdf747b0a /ui/app/components/tx-list-item.js | |
parent | 650b716f55fcfa809b22708b9ad43c8a0716f9fc (diff) | |
download | dexon-wallet-0a711f0de0e342b24988a5da4ca5c64342153210.tar.gz dexon-wallet-0a711f0de0e342b24988a5da4ca5c64342153210.tar.zst dexon-wallet-0a711f0de0e342b24988a5da4ca5c64342153210.zip |
Removes t from props via metamask-connect and instead places it on context via a provider.
Diffstat (limited to 'ui/app/components/tx-list-item.js')
-rw-r--r-- | ui/app/components/tx-list-item.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/ui/app/components/tx-list-item.js b/ui/app/components/tx-list-item.js index 5e88d38d..62266478 100644 --- a/ui/app/components/tx-list-item.js +++ b/ui/app/components/tx-list-item.js @@ -1,6 +1,7 @@ const Component = require('react').Component +const PropTypes = require('prop-types') const h = require('react-hyperscript') -const connect = require('../metamask-connect') +const connect = require('react-redux').connect const inherits = require('util').inherits const classnames = require('classnames') const abi = require('human-standard-token-abi') @@ -15,8 +16,13 @@ const { calcTokenAmount } = require('../token-util') const { getCurrentCurrency } = require('../selectors') +TxListItem.contextTypes = { + t: PropTypes.func, +} + module.exports = connect(mapStateToProps, mapDispatchToProps)(TxListItem) + function mapStateToProps (state) { return { tokens: state.metamask.tokens, @@ -74,7 +80,7 @@ TxListItem.prototype.getAddressText = function () { default: return address ? `${address.slice(0, 10)}...${address.slice(-4)}` - : this.props.t('contractDeployment') + : this.context.t('contractDeployment') } } @@ -306,21 +312,21 @@ TxListItem.prototype.txStatusIndicator = function () { let name if (transactionStatus === 'unapproved') { - name = this.props.t('unapproved') + name = this.context.t('unapproved') } else if (transactionStatus === 'rejected') { - name = this.props.t('rejected') + name = this.context.t('rejected') } else if (transactionStatus === 'approved') { - name = this.props.t('approved') + name = this.context.t('approved') } else if (transactionStatus === 'signed') { - name = this.props.t('signed') + name = this.context.t('signed') } else if (transactionStatus === 'submitted') { - name = this.props.t('submitted') + name = this.context.t('submitted') } else if (transactionStatus === 'confirmed') { - name = this.props.t('confirmed') + name = this.context.t('confirmed') } else if (transactionStatus === 'failed') { - name = this.props.t('failed') + name = this.context.t('failed') } else if (transactionStatus === 'dropped') { - name = this.props.t('dropped') + name = this.context.t('dropped') } return name } |