From 1c14e1057f0b8f7e01ab7acecbcd415b677ee975 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 3 Oct 2018 17:59:08 +0200 Subject: [PATCH] fixing SendForm --- src/views/Wallet/views/AccountSend/index.js | 27 ++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/views/Wallet/views/AccountSend/index.js b/src/views/Wallet/views/AccountSend/index.js index eeb9dbd8..21e09c4a 100644 --- a/src/views/Wallet/views/AccountSend/index.js +++ b/src/views/Wallet/views/AccountSend/index.js @@ -25,6 +25,16 @@ const SmallScreenWidth = '850px'; const Wrapper = styled.section``; +const AmountInputLabelWrapper = styled.div` + display: flex; + justify-content: space-between; +`; + +const AmountInputLabel = styled.span` + text-align: right; + color: ${colors.TEXT_SECONDARY}; +`; + const InputRow = styled.div` margin: 20px 0; `; @@ -207,6 +217,14 @@ const AccountSend = (props: Props) => { if (!device || !account || !discovery || !network || !shouldRender) return null; + const isCurrentCurrencyToken = networkSymbol !== currency; + + let selectedTokenBalance = 0; + const selectedToken = tokens.find(t => t.symbol === currency); + if (selectedToken) { + selectedTokenBalance = selectedToken.balance; + } + let isSendButtonDisabled: boolean = Object.keys(errors).length > 0 || total === '0' || amount.length === 0 || address.length === 0 || sending; let sendButtonText: string = 'Send'; if (networkSymbol !== currency && amount.length > 0 && !errors.amount) { @@ -254,7 +272,14 @@ const AccountSend = (props: Props) => { autoCorrect="off" autoCapitalize="off" spellCheck="false" - topLabel="Amount" + topLabel={( + + Amount + {(isCurrentCurrencyToken && selectedToken) && ( + You have: {selectedTokenBalance} {selectedToken.symbol} + )} + + )} value={amount} onChange={event => onAmountChange(event.target.value)} bottomText={errors.amount || warnings.amount || infos.amount}