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: label main and secondary balances #13462

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bergarces
Copy link
Contributor

@bergarces bergarces commented Feb 12, 2025

Description

It's been reported that setting the primary currency to "Native" was displaying fiat as the main currency and the native currency as secondary. The opposite would happen when setting the primary currency to "Fiat".

This was due to using the wrong nomenclature as the properties of the component responsible for that behaviour (balance was the primary balance and mainBalance was the secondary balance).

The chosen solution to fix nomenclature is leaving balance as the primary balance changing the name of mainBalance to secondaryBalance.

This component is used in three different places:

  • Token list items in the home wallet.
  • Balance in the asset overview.
  • Staking balance in the asset overview.

The behaviour for the token list and balance have been fixed to work as the setting suggests. The staking balance has been left as it currently is pending confirmation of whether it needs to follow the same behaviour.

Related issues

Fixes: No open GitHub issue for the ticket

Manual testing steps

  1. Go to Settings -> General -> Primary Currency -> Set to "Native"
  2. Got to Wallet Home page and check assets in the Tokens tab display the native currency as primary and fiat as secondary.
  3. Click on any of the assets to open the asset overview and check that the balance is displayed correctly.
  4. Repeat steps 1, 2 and 3 changing the primary currency to "Fiat"

Screenshots/Recordings

Before

image
image

After

Screenshot_1739377743
Screenshot_1739377733

Pre-merge author checklist

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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-mmi MMI team label Feb 12, 2025
@bergarces bergarces added team-assets and removed team-mmi MMI team labels Feb 12, 2025
@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch 6 times, most recently from d98d06f to 7e60898 Compare February 13, 2025 10:47
@@ -207,7 +207,7 @@ const StakingBalanceContent = ({ asset }: StakingBalanceProps) => {
{hasEthToUnstake && !isLoadingPooledStakesData && (
<AssetElement
asset={asset}
mainBalance={stakedBalanceETH}
secondaryBalance={stakedBalanceETH}
balance={stakedBalanceFiat}
Copy link
Contributor Author

@bergarces bergarces Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component is owned by @MetaMask/metamask-staking and is currently displaying fiat balance as the primary and ETH balance as secondary without taking into account the primaryCurrency setting.

Since this is a bug fix for another component, I didn't want to change the behaviour of this one, but it's probably worth checking what it should be.

Note that before this PR, balance was the primary balance and mainBalance was the secondary balance. This PR just renames mainBalance as secondaryBalance to correctly describe how it behaves.

@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch from 7e60898 to f4773c3 Compare February 13, 2025 11:15
@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch from f4773c3 to 62f8e82 Compare February 13, 2025 11:44
@bergarces bergarces added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 13, 2025
Copy link
Contributor

github-actions bot commented Feb 13, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 62f8e82
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f628c195-9be0-407b-b0f8-cfdd71eeedb7

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch 5 times, most recently from 60166ba to 2b5f232 Compare February 14, 2025 15:43
@bergarces bergarces added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 14, 2025
Copy link
Contributor

github-actions bot commented Feb 14, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 2b5f232
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/f2a2014c-7695-4929-a285-1a3e787f5f16

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch from 2b5f232 to 887c004 Compare February 15, 2025 10:15
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.02%. Comparing base (4f917be) to head (887c004).
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13462      +/-   ##
==========================================
+ Coverage   61.84%   62.02%   +0.17%     
==========================================
  Files        1977     1983       +6     
  Lines       43895    44010     +115     
  Branches     5933     5956      +23     
==========================================
+ Hits        27146    27295     +149     
+ Misses      14948    14921      -27     
+ Partials     1801     1794       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bergarces bergarces marked this pull request as ready for review February 16, 2025 18:47
@bergarces bergarces requested review from a team as code owners February 16, 2025 18:47
@bergarces bergarces added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 16, 2025
Copy link
Contributor

github-actions bot commented Feb 16, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 887c004
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/56f1c9b4-a16f-416a-81b9-518cee1fae6d

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@salimtb salimtb added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 17, 2025
@bergarces bergarces added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 18, 2025
@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch from 887c004 to 0f1bae6 Compare February 18, 2025 19:06
@bergarces bergarces force-pushed the fix/MMASSETS-537-mobile-fiat-native-toggle branch from 0f1bae6 to 88171b8 Compare February 18, 2025 20:08
@bergarces bergarces added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Feb 18, 2025
Copy link
Contributor

github-actions bot commented Feb 18, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 88171b8
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/723ca0c1-1224-4fcd-a7ae-312fa5e58bc5

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run Smoke E2E Triggers smoke e2e on Bitrise team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants