From d2ec495ffbca36827ac4eceb61c2f7ed658644e7 Mon Sep 17 00:00:00 2001 From: Juan Patricio Marroquin Date: Thu, 14 Nov 2024 13:01:11 -0500 Subject: [PATCH] refactor: set accordion key per profile --- .../wallet/components/WalletsGroup/WalletsGroup.contracts.ts | 2 ++ .../wallet/components/WalletsGroup/WalletsGroup.test.tsx | 1 + src/domains/wallet/components/WalletsGroup/WalletsGroup.tsx | 4 ++-- .../wallet/components/WalletsGroup/WalletsGroupsList.tsx | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/domains/wallet/components/WalletsGroup/WalletsGroup.contracts.ts b/src/domains/wallet/components/WalletsGroup/WalletsGroup.contracts.ts index 910b2ca840..2b43be8a92 100644 --- a/src/domains/wallet/components/WalletsGroup/WalletsGroup.contracts.ts +++ b/src/domains/wallet/components/WalletsGroup/WalletsGroup.contracts.ts @@ -1,5 +1,6 @@ import { Networks } from "@ardenthq/sdk"; import { Contracts } from "@ardenthq/sdk-profiles"; +import { IProfile } from "@ardenthq/sdk-profiles/distribution/esm/profile.contract"; import React from "react"; export interface MaxWidthReferences { @@ -11,6 +12,7 @@ export interface WalletsGroupProperties { network: Networks.Network; wallets: Contracts.IReadWriteWallet[]; maxWidthReferences: MaxWidthReferences; + profileId: string; } export interface WalletsGroupHeaderProperties { diff --git a/src/domains/wallet/components/WalletsGroup/WalletsGroup.test.tsx b/src/domains/wallet/components/WalletsGroup/WalletsGroup.test.tsx index 39eb35ae99..05b35e7708 100644 --- a/src/domains/wallet/components/WalletsGroup/WalletsGroup.test.tsx +++ b/src/domains/wallet/components/WalletsGroup/WalletsGroup.test.tsx @@ -246,6 +246,7 @@ describe("WalletsGroup", () => { balance: balanceWidthReference.current, currency: currencyWidthReference.current, }} + profileId={"1"} />, ); diff --git a/src/domains/wallet/components/WalletsGroup/WalletsGroup.tsx b/src/domains/wallet/components/WalletsGroup/WalletsGroup.tsx index 3561ce0559..1f63092bd6 100644 --- a/src/domains/wallet/components/WalletsGroup/WalletsGroup.tsx +++ b/src/domains/wallet/components/WalletsGroup/WalletsGroup.tsx @@ -7,8 +7,8 @@ import { useAccordion } from "@/app/hooks"; const MAX_WALLETS_ON_DASHBOARD_LIST = 10; -export const WalletsGroup: React.VFC = ({ network, wallets, maxWidthReferences }) => { - const { isExpanded, handleHeaderClick } = useAccordion(`wallets_group_${network.id()}`); +export const WalletsGroup: React.VFC = ({ network, wallets, maxWidthReferences, profileId }) => { + const { isExpanded, handleHeaderClick } = useAccordion(`${profileId}_wallets_group_${network.id()}`); return ( diff --git a/src/domains/wallet/components/WalletsGroup/WalletsGroupsList.tsx b/src/domains/wallet/components/WalletsGroup/WalletsGroupsList.tsx index 995fe2ad4e..d0e229bc6a 100644 --- a/src/domains/wallet/components/WalletsGroup/WalletsGroupsList.tsx +++ b/src/domains/wallet/components/WalletsGroup/WalletsGroupsList.tsx @@ -86,6 +86,7 @@ export const WalletsGroupsList = () => { } wallets={wallets} maxWidthReferences={{ balance: balanceMaxWidthReference, currency: currencyMaxWidthReference }} + profileId={profile.id()} /> )); }