Skip to content

Commit

Permalink
fix: fix display amount when price checker off (#28612)
Browse files Browse the repository at this point in the history
## **Description**

I eventually did not cherry pick
#28569 because it
tried to add code related to Portfolio View which is not yet in this
version, so i added the fix manually.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28612?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to Settings=> Security and privacy and disable price checker
setting
2. Go back to home page and you should see correct balance in crypto


## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->



https://github.com/user-attachments/assets/55931f93-962f-4e30-bc47-56755147c95d


### **After**

<!-- [screenshots/recordings] -->



https://github.com/user-attachments/assets/48b3efd2-46f5-43a6-9d10-a4765879cd83


## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
sahar-fehri authored Nov 21, 2024
1 parent 5c48902 commit 4c3f46c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ui/components/app/wallet-overview/coin-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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 { useAccountTotalFiatBalance } from '../../../hooks/useAccountTotalFiatBalance';
import {
setAggregatedBalancePopoverShown,
Expand All @@ -69,6 +72,7 @@ import {
import { useTheme } from '../../../hooks/useTheme';
import { getSpecificSettingsRoute } from '../../../helpers/utils/settings-search';
import { useI18nContext } from '../../../hooks/useI18nContext';
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 @@ -144,9 +148,14 @@ export const CoinOverview = ({
shouldHideZeroBalanceTokens,
);

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 @@ -278,7 +287,9 @@ export const CoinOverview = ({
hideTitle
shouldCheckShowNativeToken
isAggregatedFiatOverviewBalance={
!showNativeTokenAsMainBalance && !isTestnet
!showNativeTokenAsMainBalance &&
!isTestnet &&
shouldShowFiat
}
privacyMode={privacyMode}
/>
Expand Down

0 comments on commit 4c3f46c

Please sign in to comment.