Skip to content

Commit

Permalink
fix: fix coin-overview display when price setting is off
Browse files Browse the repository at this point in the history
  • Loading branch information
sahar-fehri committed Nov 20, 2024
1 parent 4cfd133 commit 6ee9cec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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

0 comments on commit 6ee9cec

Please sign in to comment.