import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { PRIORITY_LEVELS } from '../../../../shared/constants/gas'; import { submittedPendingTransactionsSelector } from '../../../selectors/transactions'; import { useGasFeeContext } from '../../../contexts/gasFee'; import { useI18nContext } from '../../../hooks/useI18nContext'; import ActionableMessage from '../../ui/actionable-message/actionable-message'; import Typography from '../../ui/typography'; import { TYPOGRAPHY } from '../../../helpers/constants/design-system'; import ZENDESK_URLS from '../../../helpers/constants/zendesk-url'; const TransactionAlerts = ({ userAcknowledgedGasMissing, setUserAcknowledgedGasMissing, }) => { const { estimateUsed, hasSimulationError, supportsEIP1559, isNetworkBusy } = useGasFeeContext(); const pendingTransactions = useSelector(submittedPendingTransactionsSelector); const t = useI18nContext(); return (
{supportsEIP1559 && hasSimulationError && ( )} {supportsEIP1559 && pendingTransactions?.length > 0 && ( {pendingTransactions?.length === 1 ? t('pendingTransactionSingle', [pendingTransactions?.length]) : t('pendingTransactionMultiple', [ pendingTransactions?.length, ])} {' '} {t('pendingTransactionInfo')} {t('learnCancelSpeeedup', [ {t('cancelSpeedUp')} , ])} } useIcon iconFillColor="var(--color-warning-default)" type="warning" /> )} {estimateUsed === PRIORITY_LEVELS.LOW && ( {t('lowPriorityMessage')} } useIcon iconFillColor="var(--color-warning-default)" type="warning" /> )} {supportsEIP1559 && isNetworkBusy ? ( {t('networkIsBusy')} } iconFillColor="var(--color-warning-default)" type="warning" useIcon /> ) : null}
); }; TransactionAlerts.propTypes = { userAcknowledgedGasMissing: PropTypes.bool, setUserAcknowledgedGasMissing: PropTypes.func, }; export default TransactionAlerts;