import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { PRIORITY_LEVELS } from '../../../../shared/constants/gas'; import { INSUFFICIENT_FUNDS_ERROR_KEY } from '../../../helpers/constants/error-keys'; import { submittedPendingTransactionsSelector } from '../../../selectors/transactions'; import { useGasFeeContext } from '../../../contexts/gasFee'; import { useI18nContext } from '../../../hooks/useI18nContext'; import ActionableMessage from '../../../components/ui/actionable-message/actionable-message'; import ErrorMessage from '../../../components/ui/error-message'; import I18nValue from '../../../components/ui/i18n-value'; import Typography from '../../../components/ui/typography'; import { TYPOGRAPHY } from '../../../helpers/constants/design-system'; const TransactionAlerts = ({ userAcknowledgedGasMissing, setUserAcknowledgedGasMissing, }) => { const { balanceError, estimateUsed, hasSimulationError, supportsEIP1559V2, } = useGasFeeContext(); const pendingTransactions = useSelector(submittedPendingTransactionsSelector); const t = useI18nContext(); if (!supportsEIP1559V2) return null; return (
{hasSimulationError && ( } useIcon iconFillColor="#d73a49" type="danger" primaryActionV2={ userAcknowledgedGasMissing === true ? undefined : { label: t('proceedWithTransaction'), onClick: setUserAcknowledgedGasMissing, } } /> )} {pendingTransactions?.length > 0 && ( {' '} {' '} , ]} /> } useIcon iconFillColor="#f8c000" type="warning" /> )} {balanceError && } {estimateUsed === PRIORITY_LEVELS.LOW && ( } useIcon iconFillColor="#f8c000" type="warning" /> )}
); }; TransactionAlerts.propTypes = { userAcknowledgedGasMissing: PropTypes.bool, setUserAcknowledgedGasMissing: PropTypes.func, }; export default TransactionAlerts;