diff options
author | frankiebee <frankie.diamond@gmail.com> | 2018-03-14 06:27:26 +0800 |
---|---|---|
committer | frankiebee <frankie.diamond@gmail.com> | 2018-03-14 06:27:26 +0800 |
commit | a2c14ad02b6f080efe18535d64efe4acdaa5f310 (patch) | |
tree | a4f10bab758b35c5344557907c7c95a396e4fbb9 /ui/app/send-v2.js | |
parent | c465d510b100fdf9926413751df04cbd59de68eb (diff) | |
parent | c83a9ceb04a485149fe65fbb2b44f0adeda696b1 (diff) | |
download | tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.tar tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.tar.gz tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.tar.bz2 tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.tar.lz tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.tar.xz tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.tar.zst tangerine-wallet-browser-a2c14ad02b6f080efe18535d64efe4acdaa5f310.zip |
Merge remote-tracking branch 'origin/i#3509' into i#3509
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r-- | ui/app/send-v2.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 1d67150e3..fc1df1f51 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -361,8 +361,9 @@ SendTransactionScreen.prototype.validateAmount = function (value) { }) } + const verifyTokenBalance = selectedToken && tokenBalance !== null let sufficientTokens - if (selectedToken) { + if (verifyTokenBalance) { sufficientTokens = isTokenBalanceSufficient({ tokenBalance, amount, @@ -377,7 +378,7 @@ SendTransactionScreen.prototype.validateAmount = function (value) { if (conversionRate && !sufficientBalance) { amountError = 'Insufficient funds.' - } else if (selectedToken && !sufficientTokens) { + } else if (verifyTokenBalance && !sufficientTokens) { amountError = 'Insufficient tokens.' } else if (amountLessThanZero) { amountError = 'Can not send negative amounts of ETH.' @@ -396,14 +397,15 @@ SendTransactionScreen.prototype.renderAmountRow = function () { amount, setMaxModeTo, maxModeOn, + gasTotal, } = this.props return h('div.send-v2__form-row', [ - h('div.send-v2__form-label', [ + h('div.send-v2__form-label', [ 'Amount:', this.renderErrorMessage('amount'), - !errors.amount && h('div.send-v2__amount-max', { + !errors.amount && gasTotal && h('div.send-v2__amount-max', { onClick: (event) => { event.preventDefault() setMaxModeTo(true) @@ -491,9 +493,12 @@ SendTransactionScreen.prototype.renderFooter = function () { goHome, clearSend, gasTotal, + tokenBalance, + selectedToken, errors: { amount: amountError, to: toError }, } = this.props + const missingTokenBalance = selectedToken && !tokenBalance const noErrors = !amountError && toError === null return h('div.page-container__footer', [ @@ -504,7 +509,7 @@ SendTransactionScreen.prototype.renderFooter = function () { }, }, 'Cancel'), h('button.btn-clear.page-container__footer-button', { - disabled: !noErrors || !gasTotal, + disabled: !noErrors || !gasTotal || missingTokenBalance, onClick: event => this.onSubmit(event), }, 'Next'), ]) |