EIP-1559 - Don't hide advanced form when radio button is chosen (#11643)

feature/default_network_editable
David Walsh 3 years ago committed by GitHub
parent 6d1fb911dc
commit 0849738003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 45
      ui/components/app/edit-gas-display/edit-gas-display.component.js
  2. 5
      ui/components/app/edit-gas-popover/edit-gas-popover.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 && (
<button
className="edit-gas-display__advanced-button"
onClick={() => setShowAdvancedForm(!showAdvancedForm)}
@ -191,27 +189,26 @@ export default function EditGasDisplay({
)}
</button>
)}
{!requireDappAcknowledgement &&
(alwaysShowForm || showAdvancedForm) && (
<AdvancedGasControls
gasFeeEstimates={gasFeeEstimates}
gasEstimateType={gasEstimateType}
estimateToUse={estimateToUse}
isGasEstimatesLoading={isGasEstimatesLoading}
gasLimit={gasLimit}
setGasLimit={setGasLimit}
maxPriorityFee={maxPriorityFeePerGas}
setMaxPriorityFee={setMaxPriorityFeePerGas}
maxFee={maxFeePerGas}
setMaxFee={setMaxFeePerGas}
gasPrice={gasPrice}
setGasPrice={setGasPrice}
maxPriorityFeeFiat={maxPriorityFeePerGasFiat}
maxFeeFiat={maxFeePerGasFiat}
gasErrors={gasErrors}
onManualChange={onManualChange}
/>
)}
{!requireDappAcknowledgement && showAdvancedForm && (
<AdvancedGasControls
gasFeeEstimates={gasFeeEstimates}
gasEstimateType={gasEstimateType}
estimateToUse={estimateToUse}
isGasEstimatesLoading={isGasEstimatesLoading}
gasLimit={gasLimit}
setGasLimit={setGasLimit}
maxPriorityFee={maxPriorityFeePerGas}
setMaxPriorityFee={setMaxPriorityFeePerGas}
maxFee={maxFeePerGas}
setMaxFee={setMaxFeePerGas}
gasPrice={gasPrice}
setGasPrice={setGasPrice}
maxPriorityFeeFiat={maxPriorityFeePerGasFiat}
maxFeeFiat={maxFeePerGasFiat}
gasErrors={gasErrors}
onManualChange={onManualChange}
/>
)}
</div>
{!requireDappAcknowledgement && showEducationButton && (
<div className="edit-gas-display__education">

@ -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/

Loading…
Cancel
Save