From 2832178c48931ea2e4209459b29e194c7a5b4576 Mon Sep 17 00:00:00 2001 From: Pierre Gee Date: Thu, 25 Jul 2024 10:10:40 +0800 Subject: [PATCH] chore(ui-ux): remove usdt in denomination (#4187) * chore(ui-ux): remove usdt in denomination * chore(ui-ux): remove usdt in denomination * chore(ui-ux): remove usdt in denomination --- .../screens/Portfolio/components/TotalPortfolio.tsx | 9 +++++++++ .../screens/Portfolio/hooks/PortfolioCurrency.ts | 11 ++++++++--- .../e2e/functional/wallet/portfolio/portfolio.spec.ts | 4 ++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/TotalPortfolio.tsx b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/TotalPortfolio.tsx index 9b630bef2a..6aec9e84e7 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/TotalPortfolio.tsx +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/components/TotalPortfolio.tsx @@ -69,6 +69,15 @@ export function TotalPortfolio(props: TotalPortfolioProps): JSX.Element { if (activeIndex === props.portfolioButtonGroup.length - 1) { nextIndex = 0; } + + // Skip USDT in the denomination currency + if ( + props.portfolioButtonGroup[nextIndex].id === + PortfolioButtonGroupTabKey.USDT + ) { + nextIndex = (nextIndex + 1) % props.portfolioButtonGroup.length; + } + props.setDenominationCurrency(props.portfolioButtonGroup[nextIndex].id); }; diff --git a/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/PortfolioCurrency.ts b/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/PortfolioCurrency.ts index 5b20169adf..f88c8d7b6c 100644 --- a/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/PortfolioCurrency.ts +++ b/mobile-app/app/screens/AppNavigator/screens/Portfolio/hooks/PortfolioCurrency.ts @@ -11,18 +11,23 @@ interface PortfolioCurrency { export function useDenominationCurrency(): PortfolioCurrency { const logger = useLogger(); const [denominationCurrency, setDenominationCurrency] = - useState(PortfolioButtonGroupTabKey.USDT); + useState(PortfolioButtonGroupTabKey.USDC); useEffect(() => { PortfolioCurrencyPersistence.get() .then((denomination: PortfolioButtonGroupTabKey) => { - setDenominationCurrency(denomination); + // Change the local storage USDT to USDC + setDenominationCurrency( + denomination === PortfolioButtonGroupTabKey.USDT + ? PortfolioButtonGroupTabKey.USDC + : denomination, + ); }) .catch(logger.error); }, []); const updatePortfolioCurrency = async ( - denomination: PortfolioButtonGroupTabKey + denomination: PortfolioButtonGroupTabKey, ): Promise => { setDenominationCurrency(denomination); await PortfolioCurrencyPersistence.set(denomination); diff --git a/mobile-app/cypress/e2e/functional/wallet/portfolio/portfolio.spec.ts b/mobile-app/cypress/e2e/functional/wallet/portfolio/portfolio.spec.ts index c0d36426b5..43ba80e020 100644 --- a/mobile-app/cypress/e2e/functional/wallet/portfolio/portfolio.spec.ts +++ b/mobile-app/cypress/e2e/functional/wallet/portfolio/portfolio.spec.ts @@ -480,8 +480,8 @@ context( cy.getByTestID("dfi_total_balance_amount").contains("10.00000000"); }); - it("should display portfolio values in USDT currency", () => { - assertPortfolioDenomination("USDT"); + it("should display portfolio values in USDC currency", () => { + assertPortfolioDenomination("USDC"); checkPortfolioPageDenominationValues( "$201,000.00", "$201,000.00",