mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Show current token balance
This commit is contained in:
parent
84d71614f6
commit
46421270bc
@ -31,6 +31,15 @@ const StyledH2 = styled(H2)`
|
|||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const AmountInputLabelWrapper = styled.div`
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const AmountInputLabel = styled.span`
|
||||||
|
color: ${colors.TEXT_SECONDARY};
|
||||||
|
`;
|
||||||
|
|
||||||
const InputRow = styled.div`
|
const InputRow = styled.div`
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
`;
|
`;
|
||||||
@ -198,7 +207,6 @@ const AccountSend = (props: Props) => {
|
|||||||
sending,
|
sending,
|
||||||
advanced,
|
advanced,
|
||||||
} = props.sendForm;
|
} = props.sendForm;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
toggleAdvanced,
|
toggleAdvanced,
|
||||||
onAddressChange,
|
onAddressChange,
|
||||||
@ -210,6 +218,14 @@ const AccountSend = (props: Props) => {
|
|||||||
onSend,
|
onSend,
|
||||||
} = props.sendFormActions;
|
} = props.sendFormActions;
|
||||||
|
|
||||||
|
const isCurrentCurrencyToken = networkSymbol !== currency;
|
||||||
|
|
||||||
|
let selectedTokenBalance = 0;
|
||||||
|
const selectedToken = tokens.find(t => t.symbol === currency);
|
||||||
|
if (selectedToken) {
|
||||||
|
selectedTokenBalance = selectedToken.balance;
|
||||||
|
}
|
||||||
|
|
||||||
if (!device || !account || !discovery || !network) return null;
|
if (!device || !account || !discovery || !network) return null;
|
||||||
|
|
||||||
let isSendButtonDisabled: boolean = Object.keys(errors).length > 0 || total === '0' || amount.length === 0 || address.length === 0 || sending;
|
let isSendButtonDisabled: boolean = Object.keys(errors).length > 0 || total === '0' || amount.length === 0 || address.length === 0 || sending;
|
||||||
@ -259,7 +275,14 @@ const AccountSend = (props: Props) => {
|
|||||||
autoCorrect="off"
|
autoCorrect="off"
|
||||||
autoCapitalize="off"
|
autoCapitalize="off"
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
topLabel="Amount"
|
topLabel={(
|
||||||
|
<AmountInputLabelWrapper>
|
||||||
|
<AmountInputLabel>Amount</AmountInputLabel>
|
||||||
|
{(isCurrentCurrencyToken && selectedToken) && (
|
||||||
|
<AmountInputLabel>You have: {selectedTokenBalance} {selectedToken.symbol}</AmountInputLabel>
|
||||||
|
)}
|
||||||
|
</AmountInputLabelWrapper>
|
||||||
|
)}
|
||||||
value={amount}
|
value={amount}
|
||||||
onChange={event => onAmountChange(event.target.value)}
|
onChange={event => onAmountChange(event.target.value)}
|
||||||
bottomText={errors.amount || warnings.amount || infos.amount}
|
bottomText={errors.amount || warnings.amount || infos.amount}
|
||||||
|
Loading…
Reference in New Issue
Block a user