1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

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

This commit is contained in:
David Walsh 2021-07-29 10:14:48 -05:00 committed by GitHub
parent 6d1fb911dc
commit 0849738003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View File

@ -60,8 +60,6 @@ export default function EditGasDisplay({
}) { }) {
const t = useContext(I18nContext); const t = useContext(I18nContext);
const alwaysShowForm = !estimateToUse || hasGasErrors || false;
const dappSuggestedAndTxParamGasFeesAreTheSame = areDappSuggestedAndTxParamGasFeesTheSame( const dappSuggestedAndTxParamGasFeesAreTheSame = areDappSuggestedAndTxParamGasFeesTheSame(
transaction, transaction,
); );
@ -178,7 +176,7 @@ export default function EditGasDisplay({
onChange={setEstimateToUse} onChange={setEstimateToUse}
/> />
)} )}
{!alwaysShowForm && !requireDappAcknowledgement && ( {!requireDappAcknowledgement && (
<button <button
className="edit-gas-display__advanced-button" className="edit-gas-display__advanced-button"
onClick={() => setShowAdvancedForm(!showAdvancedForm)} onClick={() => setShowAdvancedForm(!showAdvancedForm)}
@ -191,27 +189,26 @@ export default function EditGasDisplay({
)} )}
</button> </button>
)} )}
{!requireDappAcknowledgement && {!requireDappAcknowledgement && showAdvancedForm && (
(alwaysShowForm || showAdvancedForm) && ( <AdvancedGasControls
<AdvancedGasControls gasFeeEstimates={gasFeeEstimates}
gasFeeEstimates={gasFeeEstimates} gasEstimateType={gasEstimateType}
gasEstimateType={gasEstimateType} estimateToUse={estimateToUse}
estimateToUse={estimateToUse} isGasEstimatesLoading={isGasEstimatesLoading}
isGasEstimatesLoading={isGasEstimatesLoading} gasLimit={gasLimit}
gasLimit={gasLimit} setGasLimit={setGasLimit}
setGasLimit={setGasLimit} maxPriorityFee={maxPriorityFeePerGas}
maxPriorityFee={maxPriorityFeePerGas} setMaxPriorityFee={setMaxPriorityFeePerGas}
setMaxPriorityFee={setMaxPriorityFeePerGas} maxFee={maxFeePerGas}
maxFee={maxFeePerGas} setMaxFee={setMaxFeePerGas}
setMaxFee={setMaxFeePerGas} gasPrice={gasPrice}
gasPrice={gasPrice} setGasPrice={setGasPrice}
setGasPrice={setGasPrice} maxPriorityFeeFiat={maxPriorityFeePerGasFiat}
maxPriorityFeeFiat={maxPriorityFeePerGasFiat} maxFeeFiat={maxFeePerGasFiat}
maxFeeFiat={maxFeePerGasFiat} gasErrors={gasErrors}
gasErrors={gasErrors} onManualChange={onManualChange}
onManualChange={onManualChange} />
/> )}
)}
</div> </div>
{!requireDappAcknowledgement && showEducationButton && ( {!requireDappAcknowledgement && showEducationButton && (
<div className="edit-gas-display__education"> <div className="edit-gas-display__education">

View File

@ -51,7 +51,6 @@ export default function EditGasPopover({
const [warning] = useState(null); const [warning] = useState(null);
const [showAdvancedForm, setShowAdvancedForm] = useState(false);
const [ const [
dappSuggestedGasFeeAcknowledged, dappSuggestedGasFeeAcknowledged,
setDappSuggestedGasFeeAcknowledged, setDappSuggestedGasFeeAcknowledged,
@ -81,6 +80,10 @@ export default function EditGasPopover({
onManualChange, onManualChange,
} = useGasFeeInputs(defaultEstimateToUse, transaction); } = useGasFeeInputs(defaultEstimateToUse, transaction);
const [showAdvancedForm, setShowAdvancedForm] = useState(
!estimateToUse || hasGasErrors,
);
/** /**
* Temporary placeholder, this should be managed by the parent component but * Temporary placeholder, this should be managed by the parent component but
* we will be extracting this component from the hard to maintain modal/ * we will be extracting this component from the hard to maintain modal/