mirror of
https://github.com/trezor/trezor-wallet
synced 2025-06-27 18:32:35 +00:00
Better input bottomText handling
This commit is contained in:
parent
8208245e1b
commit
e135e103c5
@ -221,16 +221,6 @@ class AccountSend extends Component<Props, State> {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAmountInputBottomText(amountErrors: string, amountWarnings: string) {
|
|
||||||
let text = '';
|
|
||||||
if (amountWarnings && !amountErrors) {
|
|
||||||
text = amountWarnings;
|
|
||||||
} else if (amountErrors) {
|
|
||||||
text = amountErrors;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
getGasLimitInputState(gasLimitErrors: string, gasLimitWarnings: string) {
|
getGasLimitInputState(gasLimitErrors: string, gasLimitWarnings: string) {
|
||||||
let state = '';
|
let state = '';
|
||||||
if (gasLimitWarnings && !gasLimitErrors) {
|
if (gasLimitWarnings && !gasLimitErrors) {
|
||||||
@ -290,6 +280,7 @@ class AccountSend extends Component<Props, State> {
|
|||||||
total,
|
total,
|
||||||
errors,
|
errors,
|
||||||
warnings,
|
warnings,
|
||||||
|
infos,
|
||||||
data,
|
data,
|
||||||
sending,
|
sending,
|
||||||
gasLimit,
|
gasLimit,
|
||||||
@ -355,7 +346,7 @@ class AccountSend extends Component<Props, State> {
|
|||||||
autoCapitalize="off"
|
autoCapitalize="off"
|
||||||
spellCheck="false"
|
spellCheck="false"
|
||||||
topLabel="Address"
|
topLabel="Address"
|
||||||
bottomText={errors.address ? 'Wrong Address' : ''}
|
bottomText={errors.address || warnings.address || infos.address}
|
||||||
value={address}
|
value={address}
|
||||||
onChange={event => onAddressChange(event.target.value)}
|
onChange={event => onAddressChange(event.target.value)}
|
||||||
/>
|
/>
|
||||||
@ -371,7 +362,7 @@ class AccountSend extends Component<Props, State> {
|
|||||||
topLabel="Amount"
|
topLabel="Amount"
|
||||||
value={amount}
|
value={amount}
|
||||||
onChange={event => onAmountChange(event.target.value)}
|
onChange={event => onAmountChange(event.target.value)}
|
||||||
bottomText={this.getAmountInputBottomText(errors.amount, warnings.amount)}
|
bottomText={errors.amount || warnings.amount || infos.amount}
|
||||||
sideAddons={[
|
sideAddons={[
|
||||||
(
|
(
|
||||||
<SetMaxAmountButton
|
<SetMaxAmountButton
|
||||||
@ -502,7 +493,7 @@ class AccountSend extends Component<Props, State> {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</InputLabelWrapper>
|
</InputLabelWrapper>
|
||||||
)}
|
)}
|
||||||
bottomText={errors.gasLimit ? errors.gasLimit : warnings.gasLimit}
|
bottomText={errors.gasLimit || warnings.gasLimit || infos.gasLimit}
|
||||||
value={gasLimit}
|
value={gasLimit}
|
||||||
isDisabled={networkSymbol === currency && data.length > 0}
|
isDisabled={networkSymbol === currency && data.length > 0}
|
||||||
onChange={event => onGasLimitChange(event.target.value)}
|
onChange={event => onGasLimitChange(event.target.value)}
|
||||||
@ -536,7 +527,7 @@ class AccountSend extends Component<Props, State> {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</InputLabelWrapper>
|
</InputLabelWrapper>
|
||||||
)}
|
)}
|
||||||
bottomText={errors.gasPrice ? errors.gasPrice : warnings.gasPrice}
|
bottomText={errors.gasPrice || warnings.gasPrice || infos.gasPrice}
|
||||||
value={gasPrice}
|
value={gasPrice}
|
||||||
onChange={event => onGasPriceChange(event.target.value)}
|
onChange={event => onGasPriceChange(event.target.value)}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user