aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/send-v2.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-30 10:28:45 +0800
committerDan <danjm.com@gmail.com>2018-03-30 10:28:45 +0800
commit893f82491d549c9d61dfa1fb30ae1954c4efab68 (patch)
tree3c73dd4c565c773341a44ddfd8d23101d31d4ad3 /ui/app/send-v2.js
parenta4594f6838a9ff38a9a6f1998850b27beebb2fbb (diff)
parent9d4be1842e7c56e3bfde529ff555dcae8dec3dbd (diff)
downloadtangerine-wallet-browser-893f82491d549c9d61dfa1fb30ae1954c4efab68.tar.gz
tangerine-wallet-browser-893f82491d549c9d61dfa1fb30ae1954c4efab68.tar.zst
tangerine-wallet-browser-893f82491d549c9d61dfa1fb30ae1954c4efab68.zip
Merge branch 'master' into i3471-checkbalanceonconfirmscreen
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r--ui/app/send-v2.js33
1 files changed, 19 insertions, 14 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js
index df3ec6585..bcc5cb03d 100644
--- a/ui/app/send-v2.js
+++ b/ui/app/send-v2.js
@@ -1,4 +1,5 @@
const { inherits } = require('util')
+const PropTypes = require('prop-types')
const PersistentForm = require('../lib/persistent-form')
const h = require('react-hyperscript')
@@ -30,6 +31,10 @@ const {
} = require('./components/send/send-utils')
const { isValidAddress } = require('./util')
+SendTransactionScreen.contextTypes = {
+ t: PropTypes.func,
+}
+
module.exports = SendTransactionScreen
inherits(SendTransactionScreen, PersistentForm)
@@ -181,9 +186,9 @@ SendTransactionScreen.prototype.renderHeader = function () {
return h('div.page-container__header', [
- h('div.page-container__title', selectedToken ? this.props.t('sendTokens') : this.props.t('sendETH')),
+ h('div.page-container__title', selectedToken ? this.context.t('sendTokens') : this.context.t('sendETH')),
- h('div.page-container__subtitle', this.props.t('onlySendToEtherAddress')),
+ h('div.page-container__subtitle', this.context.t('onlySendToEtherAddress')),
h('div.page-container__header-close', {
onClick: () => {
@@ -254,11 +259,11 @@ SendTransactionScreen.prototype.handleToChange = function (to, nickname = '') {
let toError = null
if (!to) {
- toError = this.props.t('required')
+ toError = this.context.t('required')
} else if (!isValidAddress(to)) {
- toError = this.props.t('invalidAddressRecipient')
+ toError = this.context.t('invalidAddressRecipient')
} else if (to === from) {
- toError = this.props.t('fromToSame')
+ toError = this.context.t('fromToSame')
}
updateSendTo(to, nickname)
@@ -274,9 +279,9 @@ SendTransactionScreen.prototype.renderToRow = function () {
h('div.send-v2__form-label', [
- this.props.t('to'),
+ this.context.t('to'),
- this.renderErrorMessage(this.props.t('to')),
+ this.renderErrorMessage(this.context.t('to')),
]),
@@ -377,11 +382,11 @@ SendTransactionScreen.prototype.validateAmount = function (value) {
)
if (conversionRate && !sufficientBalance) {
- amountError = this.props.t('insufficientFunds')
+ amountError = this.context.t('insufficientFunds')
} else if (verifyTokenBalance && !sufficientTokens) {
- amountError = this.props.t('insufficientTokens')
+ amountError = this.context.t('insufficientTokens')
} else if (amountLessThanZero) {
- amountError = this.props.t('negativeETH')
+ amountError = this.context.t('negativeETH')
}
updateSendErrors({ amount: amountError })
@@ -411,7 +416,7 @@ SendTransactionScreen.prototype.renderAmountRow = function () {
setMaxModeTo(true)
this.setAmountToMax()
},
- }, [ !maxModeOn ? this.props.t('max') : '' ]),
+ }, [ !maxModeOn ? this.context.t('max') : '' ]),
]),
h('div.send-v2__form-field', [
@@ -440,7 +445,7 @@ SendTransactionScreen.prototype.renderGasRow = function () {
return h('div.send-v2__form-row', [
- h('div.send-v2__form-label', h('gasFee')),
+ h('div.send-v2__form-label', this.context.t('gasFee')),
h('div.send-v2__form-field', [
@@ -510,11 +515,11 @@ SendTransactionScreen.prototype.renderFooter = function () {
clearSend()
goHome()
},
- }, this.props.t('cancel')),
+ }, this.context.t('cancel')),
h('button.btn-primary--lg.page-container__footer-button', {
disabled: !noErrors || !gasTotal || missingTokenBalance,
onClick: event => this.onSubmit(event),
- }, this.props.t('next')),
+ }, this.context.t('next')),
])
}