mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
UX: Ensure multichain native token name is always shown (#19705)
* UX: Ensure multichain native token name is always shown * Fix lint
This commit is contained in:
parent
3df690b852
commit
9a9625d96c
@ -10,7 +10,6 @@ import {
|
|||||||
getNativeCurrencyImage,
|
getNativeCurrencyImage,
|
||||||
getDetectedTokensInCurrentNetwork,
|
getDetectedTokensInCurrentNetwork,
|
||||||
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork,
|
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork,
|
||||||
getTokenList,
|
|
||||||
} from '../../../selectors';
|
} from '../../../selectors';
|
||||||
import { getNativeCurrency } from '../../../ducks/metamask/metamask';
|
import { getNativeCurrency } from '../../../ducks/metamask/metamask';
|
||||||
import { useCurrencyDisplay } from '../../../hooks/useCurrencyDisplay';
|
import { useCurrencyDisplay } from '../../../hooks/useCurrencyDisplay';
|
||||||
@ -62,19 +61,15 @@ const AssetList = ({ onClickAsset }) => {
|
|||||||
|
|
||||||
const primaryTokenImage = useSelector(getNativeCurrencyImage);
|
const primaryTokenImage = useSelector(getNativeCurrencyImage);
|
||||||
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork) || [];
|
const detectedTokens = useSelector(getDetectedTokensInCurrentNetwork) || [];
|
||||||
const istokenDetectionInactiveOnNonMainnetSupportedNetwork = useSelector(
|
const isTokenDetectionInactiveOnNonMainnetSupportedNetwork = useSelector(
|
||||||
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork,
|
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork,
|
||||||
);
|
);
|
||||||
const tokenList = useSelector(getTokenList);
|
|
||||||
const tokenData = Object.values(tokenList).find(
|
|
||||||
(token) => token.symbol === primaryCurrencyProperties.suffix,
|
|
||||||
);
|
|
||||||
const title = tokenData?.name || primaryCurrencyProperties.suffix;
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TokenListItem
|
<TokenListItem
|
||||||
onClick={() => onClickAsset(nativeCurrency)}
|
onClick={() => onClickAsset(nativeCurrency)}
|
||||||
title={title}
|
title={nativeCurrency}
|
||||||
primary={
|
primary={
|
||||||
primaryCurrencyProperties.value ?? secondaryCurrencyProperties.value
|
primaryCurrencyProperties.value ?? secondaryCurrencyProperties.value
|
||||||
}
|
}
|
||||||
@ -96,7 +91,7 @@ const AssetList = ({ onClickAsset }) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{detectedTokens.length > 0 &&
|
{detectedTokens.length > 0 &&
|
||||||
!istokenDetectionInactiveOnNonMainnetSupportedNetwork ? (
|
!isTokenDetectionInactiveOnNonMainnetSupportedNetwork ? (
|
||||||
<DetectedTokensBanner
|
<DetectedTokensBanner
|
||||||
actionButtonOnClick={() => setShowDetectedTokens(true)}
|
actionButtonOnClick={() => setShowDetectedTokens(true)}
|
||||||
margin={4}
|
margin={4}
|
||||||
|
Loading…
Reference in New Issue
Block a user