aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pending-tx
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-14 10:32:27 +0800
committerDan <danjm.com@gmail.com>2018-03-14 10:32:27 +0800
commit798988597bd17aa73d7a20502905a453f1d51ba4 (patch)
tree69f083adbe19ce4e5b8094f1004cb1fd3a3f75c9 /ui/app/components/pending-tx
parentcc267d6c818c83b0384b569733d05efef384ac3e (diff)
parent5fbfb0b67c9eb50b6cc503e78154ab237d2d9731 (diff)
downloadtangerine-wallet-browser-798988597bd17aa73d7a20502905a453f1d51ba4.tar.gz
tangerine-wallet-browser-798988597bd17aa73d7a20502905a453f1d51ba4.tar.zst
tangerine-wallet-browser-798988597bd17aa73d7a20502905a453f1d51ba4.zip
Merge branch 'master' into retry-tx-refractor
Diffstat (limited to 'ui/app/components/pending-tx')
-rw-r--r--ui/app/components/pending-tx/confirm-deploy-contract.js29
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js21
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js39
3 files changed, 46 insertions, 43 deletions
diff --git a/ui/app/components/pending-tx/confirm-deploy-contract.js b/ui/app/components/pending-tx/confirm-deploy-contract.js
index ae6c6ef7b..49fbe6387 100644
--- a/ui/app/components/pending-tx/confirm-deploy-contract.js
+++ b/ui/app/components/pending-tx/confirm-deploy-contract.js
@@ -9,6 +9,7 @@ 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')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@@ -55,7 +56,7 @@ ConfirmDeployContract.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
+ this.props.dispatch(actions.displayWarning(t('invalidGasParams')))
this.setState({ submitting: false })
}
}
@@ -200,7 +201,7 @@ ConfirmDeployContract.prototype.renderGasFee = function () {
return (
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ 'Gas Fee' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${fiatGas} ${currentCurrency.toUpperCase()}`),
@@ -239,8 +240,8 @@ ConfirmDeployContract.prototype.renderTotalPlusGas = function () {
return (
h('section.flex-row.flex-center.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ 'Total ' ]),
- h('div.confirm-screen-total-box__subtitle', [ 'Amount + Gas' ]),
+ h('span.confirm-screen-label', [ t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -271,10 +272,10 @@ ConfirmDeployContract.prototype.render = function () {
// Main Send token Card
h('div.confirm-screen-wrapper.flex-column.flex-grow', [
h('h3.flex-center.confirm-screen-header', [
- h('button.confirm-screen-back-button', {
+ h('button.confirm-screen-back-button.allcaps', {
onClick: () => backToAccountDetail(selectedAddress),
- }, 'BACK'),
- h('div.confirm-screen-title', 'Confirm Contract'),
+ }, t('back')),
+ h('div.confirm-screen-title', t('confirmContract')),
h('div.confirm-screen-header-tip'),
]),
h('div.flex-row.flex-center.confirm-screen-identicons', [
@@ -292,7 +293,7 @@ ConfirmDeployContract.prototype.render = function () {
h('i.fa.fa-arrow-right.fa-lg'),
h('div.confirm-screen-account-wrapper', [
h('i.fa.fa-file-text-o'),
- h('span.confirm-screen-account-name', 'New Contract'),
+ h('span.confirm-screen-account-name', t('newContract')),
h('span.confirm-screen-account-number', ' '),
]),
]),
@@ -310,7 +311,7 @@ ConfirmDeployContract.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', [ 'From' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ 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)}`),
@@ -318,9 +319,9 @@ ConfirmDeployContract.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ 'To' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t('to') ]),
h('div.confirm-screen-section-column', [
- h('div.confirm-screen-row-info', 'New Contract'),
+ h('div.confirm-screen-row-info', t('newContract')),
]),
]),
@@ -335,12 +336,12 @@ ConfirmDeployContract.prototype.render = function () {
onSubmit: this.onSubmit,
}, [
// Cancel Button
- h('div.cancel.btn-light.confirm-screen-cancel-button', {
+ h('div.cancel.btn-light.confirm-screen-cancel-button.allcaps', {
onClick: (event) => this.cancel(event, txMeta),
- }, 'CANCEL'),
+ }, t('cancel')),
// Accept Button
- h('button.confirm-screen-confirm-button', ['CONFIRM']),
+ h('button.confirm-screen-confirm-button.allcaps', [t('confirm')]),
]),
])
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index 4666e047d..6624a378d 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -14,6 +14,7 @@ const {
multiplyCurrencies,
} = require('../../conversion-util')
const GasFeeDisplay = require('../send/gas-fee-display-v2')
+const t = require('../../../i18n')
const { MIN_GAS_PRICE_HEX } = require('../send/send-constants')
@@ -197,7 +198,7 @@ ConfirmSendEther.prototype.getData = function () {
},
to: {
address: txParams.to,
- name: identities[txParams.to] ? identities[txParams.to].name : 'New Recipient',
+ name: identities[txParams.to] ? identities[txParams.to].name : t('newRecipient'),
},
memo: txParams.memo || '',
gasFeeInFIAT,
@@ -311,7 +312,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', [ 'From' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ 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 +320,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ 'To' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ 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 +328,7 @@ ConfirmSendEther.prototype.render = function () {
]),
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ 'Gas Fee' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]),
h('div.confirm-screen-section-column', [
h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex,
@@ -341,8 +342,8 @@ ConfirmSendEther.prototype.render = function () {
h('section.flex-row.flex-center.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ 'Total ' ]),
- h('div.confirm-screen-total-box__subtitle', [ 'Amount + Gas' ]),
+ h('span.confirm-screen-label', [ t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -437,15 +438,15 @@ ConfirmSendEther.prototype.render = function () {
onSubmit: this.onSubmit,
}, [
// Cancel Button
- h('div.cancel.btn-light.confirm-screen-cancel-button', {
+ h('div.cancel.btn-light.confirm-screen-cancel-button.allcaps', {
onClick: (event) => {
clearSend()
this.cancel(event, txMeta)
},
- }, 'CANCEL'),
+ }, t('cancel')),
// Accept Button
- h('button.confirm-screen-confirm-button', ['CONFIRM']),
+ h('button.confirm-screen-confirm-button.allcaps', [t('confirm')]),
]),
])
)
@@ -460,7 +461,7 @@ ConfirmSendEther.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
+ this.props.dispatch(actions.displayWarning(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 476c1d259..ac773b1d2 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -6,6 +6,7 @@ const tokenAbi = require('human-standard-token-abi')
const abiDecoder = require('abi-decoder')
abiDecoder.addABI(tokenAbi)
const actions = require('../../actions')
+const t = require('../../../i18n')
const clone = require('clone')
const Identicon = require('../identicon')
const GasFeeDisplay = require('../send/gas-fee-display-v2.js')
@@ -64,8 +65,8 @@ function mapDispatchToProps (dispatch, ownProps) {
updateTokenExchangeRate: () => dispatch(actions.updateTokenExchangeRate(symbol)),
editTransaction: txMeta => {
const { token: { address } } = ownProps
- const { txParams, id } = txMeta
- const tokenData = txParams.data && abiDecoder.decodeMethod(txParams.data)
+ const { txParams = {}, id } = txMeta
+ const tokenData = txParams.data && abiDecoder.decodeMethod(txParams.data) || {}
const { params = [] } = tokenData
const { value: to } = params[0] || {}
const { value: tokenAmountInDec } = params[1] || {}
@@ -169,7 +170,7 @@ ConfirmSendToken.prototype.getAmount = function () {
? +(sendTokenAmount * tokenExchangeRate * conversionRate).toFixed(2)
: null,
token: typeof value === 'undefined'
- ? 'Unknown'
+ ? t('unknown')
: +sendTokenAmount.toFixed(decimals),
}
@@ -241,7 +242,7 @@ ConfirmSendToken.prototype.getData = function () {
},
to: {
address: value,
- name: identities[value] ? identities[value].name : 'New Recipient',
+ name: identities[value] ? identities[value].name : t('newRecipient'),
},
memo: txParams.memo || '',
}
@@ -287,7 +288,7 @@ ConfirmSendToken.prototype.renderGasFee = function () {
return (
h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ 'Gas Fee' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ t('gasFee') ]),
h('div.confirm-screen-section-column', [
h(GasFeeDisplay, {
gasTotal: gasTotal || gasFeeInHex,
@@ -309,8 +310,8 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
? (
h('section.flex-row.flex-center.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ 'Total ' ]),
- h('div.confirm-screen-total-box__subtitle', [ 'Amount + Gas' ]),
+ h('span.confirm-screen-label', [ t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
@@ -322,13 +323,13 @@ ConfirmSendToken.prototype.renderTotalPlusGas = function () {
: (
h('section.flex-row.flex-center.confirm-screen-total-box ', [
h('div.confirm-screen-section-column', [
- h('span.confirm-screen-label', [ 'Total ' ]),
- h('div.confirm-screen-total-box__subtitle', [ 'Amount + Gas' ]),
+ h('span.confirm-screen-label', [ t('total') + ' ' ]),
+ h('div.confirm-screen-total-box__subtitle', [ t('amountPlusGas') ]),
]),
h('div.confirm-screen-section-column', [
h('div.confirm-screen-row-info', `${tokenAmount} ${symbol}`),
- h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} Gas`),
+ h('div.confirm-screen-row-detail', `+ ${fiatGas} ${currentCurrency} ${t('gas')}`),
]),
])
)
@@ -350,10 +351,10 @@ ConfirmSendToken.prototype.render = function () {
this.inputs = []
- const title = txMeta.lastGasPrice ? 'Reprice Transaction' : 'Confirm'
+ const title = txMeta.lastGasPrice ? 'Reprice Transaction' : t('confirm')
const subtitle = txMeta.lastGasPrice
? 'Increase your gas fee to attempt to overwrite and speed up your transaction'
- : 'Please review your transaction.'
+ : t('pleaseReviewTransaction')
return (
h('div.confirm-screen-container.confirm-send-token', [
@@ -362,7 +363,7 @@ ConfirmSendToken.prototype.render = function () {
h('div.page-container__header', [
!txMeta.lastGasPrice && h('button.confirm-screen-back-button', {
onClick: () => editTransaction(txMeta),
- }, 'Edit'),
+ }, t('edit')),
h('div.page-container__title', title),
h('div.page-container__subtitle', subtitle),
]),
@@ -405,7 +406,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', [ 'From' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ 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)}`),
@@ -413,7 +414,7 @@ ConfirmSendToken.prototype.render = function () {
]),
toAddress && h('section.flex-row.flex-center.confirm-screen-row', [
- h('span.confirm-screen-label.confirm-screen-section-column', [ 'To' ]),
+ h('span.confirm-screen-label.confirm-screen-section-column', [ 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)}`),
@@ -431,12 +432,12 @@ ConfirmSendToken.prototype.render = function () {
onSubmit: this.onSubmit,
}, [
// Cancel Button
- h('div.cancel.btn-light.confirm-screen-cancel-button', {
+ h('div.cancel.btn-light.confirm-screen-cancel-button.allcaps', {
onClick: (event) => this.cancel(event, txMeta),
- }, 'CANCEL'),
+ }, t('cancel')),
// Accept Button
- h('button.confirm-screen-confirm-button', ['CONFIRM']),
+ h('button.confirm-screen-confirm-button.allcaps', [t('confirm')]),
]),
@@ -453,7 +454,7 @@ ConfirmSendToken.prototype.onSubmit = function (event) {
if (valid && this.verifyGasParams()) {
this.props.sendTransaction(txMeta, event)
} else {
- this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
+ this.props.dispatch(actions.displayWarning(t('invalidGasParams')))
this.setState({ submitting: false })
}
}