import React, { useContext } from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { I18nContext } from '../../../contexts/i18n'; import FormField from '../../ui/form-field'; import { GAS_ESTIMATE_TYPES } from '../../../../shared/constants/gas'; import { getGasFormErrorText } from '../../../helpers/constants/gas'; import { checkNetworkAndAccountSupports1559 } from '../../../selectors'; import { getIsGasEstimatesLoading } from '../../../ducks/metamask/metamask'; import { getGasLoadingAnimationIsShowing } from '../../../ducks/app/app'; export default function AdvancedGasControls({ gasEstimateType, maxPriorityFee, maxFee, setMaxPriorityFee, setMaxFee, onManualChange, gasLimit, setGasLimit, gasPrice, setGasPrice, maxPriorityFeeFiat, maxFeeFiat, gasErrors, minimumGasLimit, }) { const t = useContext(I18nContext); const networkAndAccountSupport1559 = useSelector( checkNetworkAndAccountSupports1559, ); const isGasEstimatesLoading = useSelector(getIsGasEstimatesLoading); const isGasLoadingAnimationIsShowing = useSelector( getGasLoadingAnimationIsShowing, ); const disableFormFields = isGasEstimatesLoading || isGasLoadingAnimationIsShowing; const showFeeMarketFields = networkAndAccountSupport1559 && (gasEstimateType === GAS_ESTIMATE_TYPES.FEE_MARKET || gasEstimateType === GAS_ESTIMATE_TYPES.ETH_GASPRICE); return (