mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
GasDisplay: hide duplicate testnet value (#17207)
- when isTestnet && !showFiatInTestnets
This commit is contained in:
parent
5f6d2ba6b0
commit
2d6529bc5c
@ -34,6 +34,7 @@ import {
|
|||||||
getIsBuyableChain,
|
getIsBuyableChain,
|
||||||
transactionFeeSelector,
|
transactionFeeSelector,
|
||||||
getIsMainnet,
|
getIsMainnet,
|
||||||
|
getIsTestnet,
|
||||||
getUseCurrencyRateCheck,
|
getUseCurrencyRateCheck,
|
||||||
} from '../../../selectors';
|
} from '../../../selectors';
|
||||||
|
|
||||||
@ -50,12 +51,15 @@ export default function GasDisplay({ gasError }) {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { estimateUsed } = useGasFeeContext();
|
const { estimateUsed } = useGasFeeContext();
|
||||||
const [showDepositPopover, setShowDepositPopover] = useState(false);
|
const [showDepositPopover, setShowDepositPopover] = useState(false);
|
||||||
|
|
||||||
const currentProvider = useSelector(getProvider);
|
const currentProvider = useSelector(getProvider);
|
||||||
const isMainnet = useSelector(getIsMainnet);
|
const isMainnet = useSelector(getIsMainnet);
|
||||||
|
const isTestnet = useSelector(getIsTestnet);
|
||||||
const isBuyableChain = useSelector(getIsBuyableChain);
|
const isBuyableChain = useSelector(getIsBuyableChain);
|
||||||
const draftTransaction = useSelector(getCurrentDraftTransaction);
|
const draftTransaction = useSelector(getCurrentDraftTransaction);
|
||||||
const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck);
|
const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck);
|
||||||
const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences);
|
const { showFiatInTestnets, useNativeCurrencyAsPrimaryCurrency } =
|
||||||
|
useSelector(getPreferences);
|
||||||
const { nativeCurrency, provider, unapprovedTxs } = useSelector(
|
const { nativeCurrency, provider, unapprovedTxs } = useSelector(
|
||||||
(state) => state.metamask,
|
(state) => state.metamask,
|
||||||
);
|
);
|
||||||
@ -110,6 +114,9 @@ export default function GasDisplay({ gasError }) {
|
|||||||
|
|
||||||
const primaryTotalTextOverrideMaxAmount = `${title} + ${ethTransactionTotalMaxAmount} ${nativeCurrency}`;
|
const primaryTotalTextOverrideMaxAmount = `${title} + ${ethTransactionTotalMaxAmount} ${nativeCurrency}`;
|
||||||
|
|
||||||
|
const showCurrencyRateCheck =
|
||||||
|
useCurrencyRateCheck && (!isTestnet || showFiatInTestnets);
|
||||||
|
|
||||||
let detailTotal, maxAmount;
|
let detailTotal, maxAmount;
|
||||||
|
|
||||||
if (draftTransaction?.asset.type === 'NATIVE') {
|
if (draftTransaction?.asset.type === 'NATIVE') {
|
||||||
@ -197,7 +204,7 @@ export default function GasDisplay({ gasError }) {
|
|||||||
}
|
}
|
||||||
detailTitleColor={COLORS.TEXT_DEFAULT}
|
detailTitleColor={COLORS.TEXT_DEFAULT}
|
||||||
detailText={
|
detailText={
|
||||||
useCurrencyRateCheck && (
|
showCurrencyRateCheck && (
|
||||||
<Box className="gas-display__currency-container">
|
<Box className="gas-display__currency-container">
|
||||||
<LoadingHeartBeat estimateUsed={estimateUsed} />
|
<LoadingHeartBeat estimateUsed={estimateUsed} />
|
||||||
<UserPreferencedCurrencyDisplay
|
<UserPreferencedCurrencyDisplay
|
||||||
@ -265,7 +272,7 @@ export default function GasDisplay({ gasError }) {
|
|||||||
key="total-item"
|
key="total-item"
|
||||||
detailTitle={t('total')}
|
detailTitle={t('total')}
|
||||||
detailText={
|
detailText={
|
||||||
useCurrencyRateCheck && (
|
showCurrencyRateCheck && (
|
||||||
<Box
|
<Box
|
||||||
height={BLOCK_SIZES.MAX}
|
height={BLOCK_SIZES.MAX}
|
||||||
display={DISPLAY.FLEX}
|
display={DISPLAY.FLEX}
|
||||||
|
Loading…
Reference in New Issue
Block a user