Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix coin-overview display when price setting is off #28569

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions ui/components/app/wallet-overview/coin-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ import {
import Spinner from '../../ui/spinner';

import { PercentageAndAmountChange } from '../../multichain/token-list-item/price/percentage-and-amount-change/percentage-and-amount-change';
import { getMultichainIsEvm } from '../../../selectors/multichain';
import {
getMultichainIsEvm,
getMultichainShouldShowFiat,
} from '../../../selectors/multichain';
import {
setAggregatedBalancePopoverShown,
setPrivacyMode,
Expand All @@ -73,6 +76,7 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
import { useAccountTotalCrossChainFiatBalance } from '../../../hooks/useAccountTotalCrossChainFiatBalance';

import { useGetFormattedTokensPerChain } from '../../../hooks/useGetFormattedTokensPerChain';
import { useMultichainSelector } from '../../../hooks/useMultichainSelector';
import WalletOverview from './wallet-overview';
import CoinButtons from './coin-buttons';
import { AggregatedPercentageOverview } from './aggregated-percentage-overview';
Expand Down Expand Up @@ -160,9 +164,15 @@ export const CoinOverview = ({
formattedTokensWithBalancesPerChain,
);

const shouldShowFiat = useMultichainSelector(
getMultichainShouldShowFiat,
account,
);

const isEvm = useSelector(getMultichainIsEvm);
const isNotAggregatedFiatBalance =
showNativeTokenAsMainBalance || isTestnet || !isEvm;
!shouldShowFiat || showNativeTokenAsMainBalance || isTestnet || !isEvm;

let balanceToDisplay;
if (isNotAggregatedFiatBalance) {
balanceToDisplay = balance;
Expand Down Expand Up @@ -300,7 +310,9 @@ export const CoinOverview = ({
hideTitle
shouldCheckShowNativeToken
isAggregatedFiatOverviewBalance={
!showNativeTokenAsMainBalance && !isTestnet
!showNativeTokenAsMainBalance &&
!isTestnet &&
shouldShowFiat
}
privacyMode={privacyMode}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const AccountListItem = ({
let balanceToTranslate;
if (isEvmNetwork) {
balanceToTranslate =
isTestnet || !process.env.PORTFOLIO_VIEW
shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
? account.balance
: totalFiatBalance;
} else {
Expand Down
Loading