1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

GasDisplay: hide duplicate testnet value (#17207)

- when isTestnet && !showFiatInTestnets
This commit is contained in:
Ariella Vu 2023-01-18 22:43:40 +07:00 committed by GitHub
parent 5f6d2ba6b0
commit 2d6529bc5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ import {
getIsBuyableChain,
transactionFeeSelector,
getIsMainnet,
getIsTestnet,
getUseCurrencyRateCheck,
} from '../../../selectors';
@ -50,12 +51,15 @@ export default function GasDisplay({ gasError }) {
const dispatch = useDispatch();
const { estimateUsed } = useGasFeeContext();
const [showDepositPopover, setShowDepositPopover] = useState(false);
const currentProvider = useSelector(getProvider);
const isMainnet = useSelector(getIsMainnet);
const isTestnet = useSelector(getIsTestnet);
const isBuyableChain = useSelector(getIsBuyableChain);
const draftTransaction = useSelector(getCurrentDraftTransaction);
const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck);
const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences);
const { showFiatInTestnets, useNativeCurrencyAsPrimaryCurrency } =
useSelector(getPreferences);
const { nativeCurrency, provider, unapprovedTxs } = useSelector(
(state) => state.metamask,
);
@ -110,6 +114,9 @@ export default function GasDisplay({ gasError }) {
const primaryTotalTextOverrideMaxAmount = `${title} + ${ethTransactionTotalMaxAmount} ${nativeCurrency}`;
const showCurrencyRateCheck =
useCurrencyRateCheck && (!isTestnet || showFiatInTestnets);
let detailTotal, maxAmount;
if (draftTransaction?.asset.type === 'NATIVE') {
@ -197,7 +204,7 @@ export default function GasDisplay({ gasError }) {
}
detailTitleColor={COLORS.TEXT_DEFAULT}
detailText={
useCurrencyRateCheck && (
showCurrencyRateCheck && (
<Box className="gas-display__currency-container">
<LoadingHeartBeat estimateUsed={estimateUsed} />
<UserPreferencedCurrencyDisplay
@ -265,7 +272,7 @@ export default function GasDisplay({ gasError }) {
key="total-item"
detailTitle={t('total')}
detailText={
useCurrencyRateCheck && (
showCurrencyRateCheck && (
<Box
height={BLOCK_SIZES.MAX}
display={DISPLAY.FLEX}