import React, { useContext } from 'react'; import { COLORS, FONT_WEIGHT, TYPOGRAPHY, } from '../../../../helpers/constants/design-system'; import { isNullish } from '../../../../helpers/utils/util'; import { formatGasFeeOrFeeRange } from '../../../../helpers/utils/gas'; import { I18nContext } from '../../../../contexts/i18n'; import { useGasFeeContext } from '../../../../contexts/gasFee'; import Typography from '../../../ui/typography/typography'; import { BaseFeeTooltip, PriorityFeeTooltip } from './tooltips'; import StatusSlider from './status-slider'; const NetworkStatistics = () => { const t = useContext(I18nContext); const { gasFeeEstimates } = useGasFeeContext(); const formattedLatestBaseFee = formatGasFeeOrFeeRange( gasFeeEstimates?.estimatedBaseFee, { precision: 0, }, ); const formattedLatestPriorityFeeRange = formatGasFeeOrFeeRange( gasFeeEstimates?.latestPriorityFeeRange, { precision: [1, 0] }, ); const networkCongestion = gasFeeEstimates?.networkCongestion; return (
{t('networkStatus')}
{isNullish(formattedLatestBaseFee) ? null : (
{formattedLatestBaseFee} {t('baseFee')}
)} {isNullish(formattedLatestPriorityFeeRange) ? null : (
{formattedLatestPriorityFeeRange} {t('priorityFee')}
)} {isNullish(networkCongestion) ? null : (
)}
); }; export default NetworkStatistics;