import React from 'react'; import { EDIT_GAS_MODES, PRIORITY_LEVELS, } from '../../../../shared/constants/gas'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { useTransactionModalContext } from '../../../contexts/transaction-modal'; import ErrorMessage from '../../ui/error-message'; import I18nValue from '../../ui/i18n-value'; import Popover from '../../ui/popover'; import Typography from '../../ui/typography/typography'; import { COLORS, TYPOGRAPHY } from '../../../helpers/constants/design-system'; import { INSUFFICIENT_FUNDS_ERROR_KEY } from '../../../helpers/constants/error-keys'; import { useGasFeeContext } from '../../../contexts/gasFee'; import AppLoadingSpinner from '../app-loading-spinner'; import EditGasItem from './edit-gas-item'; import NetworkStatistics from './network-statistics'; const EditGasFeePopover = () => { const { balanceError, editGasMode } = useGasFeeContext(); const t = useI18nContext(); const { closeAllModals, closeModal, currentModal, openModalCount, } = useTransactionModalContext(); if (currentModal !== 'editGasFee') return null; let popupTitle = 'editGasFeeModalTitle'; if (editGasMode === EDIT_GAS_MODES.CANCEL) { popupTitle = 'editCancellationGasFeeModalTitle'; } else if (editGasMode === EDIT_GAS_MODES.SPEED_UP) { popupTitle = 'editSpeedUpEditGasFeeModalTitle'; } return ( closeModal('editGasFee')} onClose={closeAllModals} className="edit-gas-fee-popover" > <>
{balanceError && ( )}
{editGasMode !== EDIT_GAS_MODES.SWAPS && ( )}
{(editGasMode === EDIT_GAS_MODES.CANCEL || editGasMode === EDIT_GAS_MODES.SPEED_UP) && ( )} {editGasMode === EDIT_GAS_MODES.MODIFY_IN_PLACE && ( )}
{editGasMode === EDIT_GAS_MODES.MODIFY_IN_PLACE && ( )} , ]} />
); }; export default EditGasFeePopover;