Skip to content

Commit

Permalink
chore(ui-ux): remove usdt in denomination (#4187)
Browse files Browse the repository at this point in the history
* chore(ui-ux): remove usdt in denomination

* chore(ui-ux): remove usdt in denomination

* chore(ui-ux): remove usdt in denomination
  • Loading branch information
Pierre Gee authored Jul 25, 2024
1 parent d1cd46b commit 2832178
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,23 @@ interface PortfolioCurrency {
export function useDenominationCurrency(): PortfolioCurrency {
const logger = useLogger();
const [denominationCurrency, setDenominationCurrency] =
useState<PortfolioButtonGroupTabKey>(PortfolioButtonGroupTabKey.USDT);
useState<PortfolioButtonGroupTabKey>(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<void> => {
setDenominationCurrency(denomination);
await PortfolioCurrencyPersistence.set(denomination);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2832178

Please sign in to comment.