From 08497380030bd43a1178b986473a2ec0bf8789bc Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 29 Jul 2021 10:14:48 -0500 Subject: [PATCH] EIP-1559 - Don't hide advanced form when radio button is chosen (#11643) --- .../edit-gas-display.component.js | 45 +++++++++---------- .../edit-gas-popover.component.js | 5 ++- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ui/components/app/edit-gas-display/edit-gas-display.component.js b/ui/components/app/edit-gas-display/edit-gas-display.component.js index de010c90c..0de705a02 100644 --- a/ui/components/app/edit-gas-display/edit-gas-display.component.js +++ b/ui/components/app/edit-gas-display/edit-gas-display.component.js @@ -60,8 +60,6 @@ export default function EditGasDisplay({ }) { const t = useContext(I18nContext); - const alwaysShowForm = !estimateToUse || hasGasErrors || false; - const dappSuggestedAndTxParamGasFeesAreTheSame = areDappSuggestedAndTxParamGasFeesTheSame( transaction, ); @@ -178,7 +176,7 @@ export default function EditGasDisplay({ onChange={setEstimateToUse} /> )} - {!alwaysShowForm && !requireDappAcknowledgement && ( + {!requireDappAcknowledgement && ( )} - {!requireDappAcknowledgement && - (alwaysShowForm || showAdvancedForm) && ( - - )} + {!requireDappAcknowledgement && showAdvancedForm && ( + + )} {!requireDappAcknowledgement && showEducationButton && (
diff --git a/ui/components/app/edit-gas-popover/edit-gas-popover.component.js b/ui/components/app/edit-gas-popover/edit-gas-popover.component.js index 665e81639..fc55ec9a2 100644 --- a/ui/components/app/edit-gas-popover/edit-gas-popover.component.js +++ b/ui/components/app/edit-gas-popover/edit-gas-popover.component.js @@ -51,7 +51,6 @@ export default function EditGasPopover({ const [warning] = useState(null); - const [showAdvancedForm, setShowAdvancedForm] = useState(false); const [ dappSuggestedGasFeeAcknowledged, setDappSuggestedGasFeeAcknowledged, @@ -81,6 +80,10 @@ export default function EditGasPopover({ onManualChange, } = useGasFeeInputs(defaultEstimateToUse, transaction); + const [showAdvancedForm, setShowAdvancedForm] = useState( + !estimateToUse || hasGasErrors, + ); + /** * Temporary placeholder, this should be managed by the parent component but * we will be extracting this component from the hard to maintain modal/