aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pending-tx
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-22 08:41:47 +0800
committerDan <danjm.com@gmail.com>2018-03-22 08:41:47 +0800
commitd24a0590d363dbe88d383c8faec8eb28809242f0 (patch)
tree189e54ca9ea117804c96afa551cfca8158f36974 /ui/app/components/pending-tx
parent29cc2f8ab9628d21cc32962666879c71be4e69d1 (diff)
downloadtangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.gz
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.tar.zst
tangerine-wallet-browser-d24a0590d363dbe88d383c8faec8eb28809242f0.zip
i18n redux solution doesn't require importing t() and passing state to each t() call; t is just available on props.
Diffstat (limited to 'ui/app/components/pending-tx')
-rw-r--r--ui/app/components/pending-tx/confirm-deploy-contract.js25
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js19
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js35
3 files changed, 38 insertions, 41 deletions
diff --git a/ui/app/components/pending-tx/confirm-deploy-contract.js b/ui/app/components/pending-tx/confirm-deploy-contract.js
index 8e04fb84d..6b912af7f 100644
--- a/ui/app/components/pending-tx/confirm-deploy-contract.js
+++ b/ui/app/components/pending-tx/confirm-deploy-contract.js
@@ -8,7 +8,6 @@ const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
const hexToBn = require('../../../../app/scripts/lib/hex-to-bn')
const { conversionUtil } = require('../../conversion-util')
-const t = require('../../../i18n-helper').getMessage
const SenderToRecipient = require('../sender-to-recipient')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@@ -177,7 +176,7 @@ class ConfirmDeployContract extends Component {
return (
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'gasFee') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`),
@@ -216,8 +215,8 @@ class ConfirmDeployContract extends Component {
return (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
+ h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -246,9 +245,9 @@ class ConfirmDeployContract extends Component {
h('.page-container__header', [
h('.page-container__back-button', {
onClick: () => backToAccountDetail(selectedAddress),
- }, t(this.props.localeMessages, 'back')),
- h('.page-container__title', t(this.props.localeMessages, 'confirmContract')),
- h('.page-container__subtitle', t(this.props.localeMessages, 'pleaseReviewTransaction')),
+ }, this.props.t('back')),
+ h('.page-container__title', this.props.t('confirmContract')),
+ h('.page-container__subtitle', this.props.t('pleaseReviewTransaction')),
]),
// Main Send token Card
h('.page-container__content', [
@@ -271,7 +270,7 @@ class ConfirmDeployContract extends Component {
h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'from') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@@ -279,9 +278,9 @@ class ConfirmDeployContract extends Component {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'to') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]),
h('div.confirm-screen-section-column', [
- h('div.confirm-screen-row-info', t(this.props.localeMessages, 'newContract')),
+ h('div.confirm-screen-row-info', this.props.t('newContract')),
]),
]),
@@ -299,12 +298,12 @@ class ConfirmDeployContract extends Component {
// Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: event => this.cancel(event, txMeta),
- }, t(this.props.localeMessages, 'cancel')),
+ }, this.props.t('cancel')),
// Accept Button
h('button.btn-confirm.page-container__footer-button.allcaps', {
onClick: event => this.onSubmit(event),
- }, t(this.props.localeMessages, 'confirm')),
+ }, this.props.t('confirm')),
]),
]),
])
@@ -344,7 +343,7 @@ const mapDispatchToProps = dispatch => {
return {
backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })),
- displayWarning: warning => actions.displayWarning(t(this.props.localeMessages, warning)),
+ displayWarning: warning => actions.displayWarning(this.props.t(warning)),
}
}
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index 253b69b7a..02394b0c5 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -14,7 +14,6 @@ const {
multiplyCurrencies,
} = require('../../conversion-util')
const GasFeeDisplay = require('../send/gas-fee-display-v2')
-const t = require('../../../i18n-helper').getMessage
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@@ -196,7 +195,7 @@ ConfirmSendEther.prototype.getData = function () {
},
to: {
address: txParams.to,
- name: identities[txParams.to] ? identities[txParams.to].name : t(this.props.localeMessages, 'newRecipient'),
+ name: identities[txParams.to] ? identities[txParams.to].name : this.props.t('newRecipient'),
},
memo: txParams.memo || '',
gasFeeInFIAT,
@@ -311,7 +310,7 @@ ConfirmSendEther.prototype.render = function () {
h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'from') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@@ -319,7 +318,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'to') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@@ -327,7 +326,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'gasFee') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]),
h('div.confirm-screen-section-column', [
h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex,
@@ -340,8 +339,8 @@ ConfirmSendEther.prototype.render = function () {
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
+ h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -442,10 +441,10 @@ ConfirmSendEther.prototype.render = function () {
clearSend()
this.cancel(event, txMeta)
},
- }, t(this.props.localeMessages, 'cancel')),
+ }, this.props.t('cancel')),
// Accept Button
- h('button.btn-confirm.page-container__footer-button.allcaps', [t(this.props.localeMessages, 'confirm')]),
+ h('button.btn-confirm.page-container__footer-button.allcaps', [this.props.t('confirm')]),
]),
]),
]),
@@ -462,7 +461,7 @@ ConfirmSendEther.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning(t(this.props.localeMessages, 'invalidGasParams')))
+ this.props.dispatch(actions.displayWarning(this.props.t('invalidGasParams')))
this.setState({ submitting: false })
}
}
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index 54963ae9a..d53f8b32f 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -6,7 +6,6 @@ const tokenAbi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder')
abiDecoder.addABI(tokenAbi)
const actions = require('../../actions')
-const t = require('../../../i18n-helper').getMessage
const clone = require('clone')
const Identicon = require('../identicon')
const GasFeeDisplay = require('../send/gas-fee-display-v2.js')
@@ -22,7 +21,7 @@ const {
} = require('../../token-util')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
-
+//
const {
getTokenExchangeRate,
getSelectedAddress,
@@ -168,7 +167,7 @@ ConfirmSendToken.prototype.getAmount = function () {
? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2)
: null,
token: typeof value === 'undefined'
- ? t(this.props.localeMessages, 'unknown')
+ ? this.props.t('unknown')
: +sendTokenAmount.toFixed(decimals),
}
@@ -240,7 +239,7 @@ ConfirmSendToken.prototype.getData = function () {
},
to: {
address: value,
- name: identities[value] ? identities[value].name : t(this.props.localeMessages, 'newRecipient'),
+ name: identities[value] ? identities[value].name : this.props.t('newRecipient'),
},
memo: txParams.memo || '',
}
@@ -286,7 +285,7 @@ ConfirmSendToken.prototype.renderGasFee = function () {
return (
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'gasFee') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('gasFee') ]),
h('div.confirm-screen-section-column', [
h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex,
@@ -308,8 +307,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
? (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
+ h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -321,8 +320,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
: (
h('section.flex-row.flex-center.confirm-screen-row.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ t(this.props.localeMessages, 'total') + ' ' ]),
- h('div.confirm-screen-total-box__subtitle', [ t(this.props.localeMessages, 'amountPlusGas') ]),
+ h('span.confirm-screen-label', [ this.props.t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ this.props.t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -350,10 +349,10 @@ ConfirmSendToken.prototype.render = function () {
this.inputs = []
const isTxReprice = Boolean(txMeta.lastGasPrice)
- const title = isTxReprice ? t(this.props.localeMessages, 'reprice:title') : t(this.props.localeMessages, 'confirm')
+ const title = isTxReprice ? this.props.t('reprice:title') : this.props.t('confirm')
const subtitle = isTxReprice
- ? t(this.props.localeMessages, 'reprice:subtitle')
- : t(this.props.localeMessages, 'pleaseReviewTransaction')
+ ? this.props.t('reprice:subtitle')
+ : this.props.t('pleaseReviewTransaction')
return (
h('div.confirm-screen-container.confirm-send-token', [
@@ -362,7 +361,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.page-container__header', [
!txMeta.lastGasPrice && h('button.confirm-screen-back-button', {
onClick: () => editTransaction(txMeta),
- }, t(this.props.localeMessages, 'edit')),
+ }, this.props.t('edit')),
h('div.page-container__title', title),
h('div.page-container__subtitle', subtitle),
]),
@@ -406,7 +405,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.confirm-screen-rows', [
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'from') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('from') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', fromName),
h('div.confirm-screen-row-detail', `...${fromAddress.slice(fromAddress.length - 4)}`),
@@ -414,7 +413,7 @@ ConfirmSendToken.prototype.render = function () {
]),
toAddress && h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ t(this.props.localeMessages, 'to') ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ this.props.t('to') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', toName),
h('div.confirm-screen-row-detail', `...${toAddress.slice(toAddress.length - 4)}`),
@@ -436,10 +435,10 @@ ConfirmSendToken.prototype.render = function () {
// Cancel Button
h('button.btn-cancel.page-container__footer-button.allcaps', {
onClick: (event) => this.cancel(event, txMeta),
- }, t(this.props.localeMessages, 'cancel')),
+ }, this.props.t('cancel')),
// Accept Button
- h('button.btn-confirm.page-container__footer-button.allcaps', [t(this.props.localeMessages, 'confirm')]),
+ h('button.btn-confirm.page-container__footer-button.allcaps', [this.props.t('confirm')]),
]),
]),
]),
@@ -456,7 +455,7 @@ ConfirmSendToken.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning(t(this.props.localeMessages, 'invalidGasParams')))
+ this.props.dispatch(actions.displayWarning(this.props.t('invalidGasParams')))
this.setState({ submitting: false })
}
}