aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/send-v2.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2018-03-08 05:39:44 +0800
committerDan Finlay <dan@danfinlay.com>2018-03-08 05:39:44 +0800
commitd0ba2d2d9428f13208ea54e9fa78f122ed42549b (patch)
tree7786903649241ab688b5622719cae34f804abef7 /ui/app/send-v2.js
parent423f084cb47d84e2e9063a6567454f83592f424b (diff)
parentca047b1ea0bd6778fc3b0c05b86ff23d0964f98d (diff)
downloadtangerine-wallet-browser-d0ba2d2d9428f13208ea54e9fa78f122ed42549b.tar.gz
tangerine-wallet-browser-d0ba2d2d9428f13208ea54e9fa78f122ed42549b.tar.zst
tangerine-wallet-browser-d0ba2d2d9428f13208ea54e9fa78f122ed42549b.zip
Merge branch 'master' into i3076-UseStorageLocalInstead
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r--ui/app/send-v2.js15
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'),
])