diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-03-07 07:05:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-07 07:05:43 +0800 |
commit | 52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b (patch) | |
tree | f1a4851b003ed7d0d49fb4bd83585947b9b4695d /ui | |
parent | 31e7d9263f3210082c90adf3e050771bb30c7c88 (diff) | |
parent | 462d57cb6aaeab233bcade5ef1804eeaa290bae2 (diff) | |
download | tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.tar tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.tar.gz tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.tar.bz2 tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.tar.lz tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.tar.xz tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.tar.zst tangerine-wallet-browser-52b4876cf9a6dd4eb6bbac67242b0a9e1f3cc01b.zip |
Merge pull request #3446 from danjm/NewUI-handle-token-balance-on-edit
Gracefully handle null token balance in new ui send.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/send-v2.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 3667e9d73..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.' @@ -492,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', [ @@ -505,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'), ]) |