From 4e2ec131320b8ba6822744b19e3a9048d21730b2 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 21 Nov 2018 14:26:09 +0100 Subject: [PATCH] showDefaultGasLimitButton condition --- .../Account/Send/components/AdvancedForm/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/views/Wallet/views/Account/Send/components/AdvancedForm/index.js b/src/views/Wallet/views/Account/Send/components/AdvancedForm/index.js index 0e9ea9e0..6af73ddd 100644 --- a/src/views/Wallet/views/Account/Send/components/AdvancedForm/index.js +++ b/src/views/Wallet/views/Account/Send/components/AdvancedForm/index.js @@ -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 ( @@ -190,13 +193,15 @@ const AdvancedForm = (props: Props) => { /> - setDefaultGasLimit()}> - Set default - + { showDefaultGasLimitButton && ( + setDefaultGasLimit()}> + Set default + ) + } )} - 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)} />