1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-02-05 04:41:25 +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,
warnings,
infos,
touched,
data,
gasLimit,
gasPrice,
@ -158,6 +159,8 @@ const AdvancedForm = (props: Props) => {
gasLimitTooltipValue = network.defaultGasLimit.toString(10);
}
const showDefaultGasLimitButton = data.length === 0 && touched.gasLimit;
return (
<AdvancedSettingsWrapper>
<GasInputRow>
@ -190,13 +193,15 @@ const AdvancedForm = (props: Props) => {
/>
</Tooltip>
</Left>
<Right onClick={() => setDefaultGasLimit()}>
Set default
</Right>
{ showDefaultGasLimitButton && (
<Right onClick={() => setDefaultGasLimit()}>
Set default
</Right>)
}
</InputLabelWrapper>
)}
bottomText={errors.gasLimit || warnings.gasLimit || infos.gasLimit || (calculatingGasLimit ? 'Calculating...' : '')}
value={gasLimit}
bottomText={errors.gasLimit || warnings.gasLimit || infos.gasLimit}
value={calculatingGasLimit ? 'Calculating...' : gasLimit}
isDisabled={networkSymbol === currency && data.length > 0}
onChange={event => onGasLimitChange(event.target.value)}
/>