import React from 'react'; import { useSelector } from 'react-redux'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import { getIsMainnet, getPreferences, getUnapprovedTransactions, getUseCurrencyRateCheck, transactionFeeSelector, txDataSelector, } from '../../../../selectors'; import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'; import TransactionDetailItem from '../../transaction-detail-item'; import UserPreferencedCurrencyDisplay from '../../user-preferenced-currency-display'; import InfoTooltip from '../../../ui/info-tooltip'; import LoadingHeartBeat from '../../../ui/loading-heartbeat'; import { Text } from '../../../component-library/text'; import { FONT_STYLE, TextVariant, TextColor, } from '../../../../helpers/constants/design-system'; import { useDraftTransactionGasValues } from '../../../../hooks/useDraftTransactionGasValues'; const renderHeartBeatIfNotInTest = () => process.env.IN_TEST ? null : ; const ConfirmLegacyGasDisplay = () => { const t = useI18nContext(); // state selectors const isMainnet = useSelector(getIsMainnet); const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck); const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences); const unapprovedTxs = useSelector(getUnapprovedTransactions); const { transactionData } = useDraftTransactionGasValues(); const txData = useSelector((state) => txDataSelector(state)); const { id: transactionId, dappSuggestedGasFees } = txData; const transaction = Object.keys(transactionData).length ? transactionData : unapprovedTxs[transactionId] || {}; const { hexMinimumTransactionFee, hexMaximumTransactionFee } = useSelector( (state) => transactionFeeSelector(state, transaction), ); return ( {t('transactionDetailGasHeading')} ) : ( <> {t('transactionDetailGasHeading')}

{t('transactionDetailGasTooltipIntro', [ isMainnet ? t('networkNameEthereum') : '', ])}

{t('transactionDetailGasTooltipExplanation')}

{t('transactionDetailGasTooltipConversion')}

} position="top" >
) } detailText={ useCurrencyRateCheck && (
{renderHeartBeatIfNotInTest()}
) } detailTotal={
{renderHeartBeatIfNotInTest()}
} subText={ <> {t('editGasSubTextFeeLabel')}
{renderHeartBeatIfNotInTest()}
} subTitle={ <> {dappSuggestedGasFees && ( {t('transactionDetailDappGasMoreInfo')} )} } /> ); }; export default ConfirmLegacyGasDisplay;