1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-02-05 12:51:44 +00:00

showDefaultGasLimitButton condition

This commit is contained in:
Szymon Lesisz 2018-11-21 14:26:09 +01:00 committed by Szymon Lesisz
parent a944b9287e
commit 4589bb9171

View File

@ -138,6 +138,7 @@ const AdvancedForm = (props: Props) => {
errors, errors,
warnings, warnings,
infos, infos,
touched,
data, data,
gasLimit, gasLimit,
gasPrice, gasPrice,
@ -158,6 +159,8 @@ const AdvancedForm = (props: Props) => {
gasLimitTooltipValue = network.defaultGasLimit.toString(10); gasLimitTooltipValue = network.defaultGasLimit.toString(10);
} }
const showDefaultGasLimitButton = data.length === 0 && touched.gasLimit;
return ( return (
<AdvancedSettingsWrapper> <AdvancedSettingsWrapper>
<GasInputRow> <GasInputRow>
@ -190,13 +193,15 @@ const AdvancedForm = (props: Props) => {
/> />
</Tooltip> </Tooltip>
</Left> </Left>
<Right onClick={() => setDefaultGasLimit()}> { showDefaultGasLimitButton && (
Set default <Right onClick={() => setDefaultGasLimit()}>
</Right> Set default
</Right>)
}
</InputLabelWrapper> </InputLabelWrapper>
)} )}
bottomText={errors.gasLimit || warnings.gasLimit || infos.gasLimit || (calculatingGasLimit ? 'Calculating...' : '')} bottomText={errors.gasLimit || warnings.gasLimit || infos.gasLimit}
value={gasLimit} value={calculatingGasLimit ? 'Calculating...' : 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)}
/> />