Skip to content

Commit

Permalink
refactor: set accordion key per profile
Browse files Browse the repository at this point in the history
  • Loading branch information
patricio0312rev committed Nov 14, 2024
1 parent ad3a95b commit d2ec495
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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";

Check failure on line 3 in src/domains/wallet/components/WalletsGroup/WalletsGroup.contracts.ts

View workflow job for this annotation

GitHub Actions / eslint (20.12.2)

'IProfile' is defined but never used. Allowed unused vars must match /_/u

Check failure on line 3 in src/domains/wallet/components/WalletsGroup/WalletsGroup.contracts.ts

View workflow job for this annotation

GitHub Actions / eslint (20.12.2)

'IProfile' is defined but never used. Allowed unused vars must match /_/u
import React from "react";

export interface MaxWidthReferences {
Expand All @@ -11,6 +12,7 @@ export interface WalletsGroupProperties {
network: Networks.Network;
wallets: Contracts.IReadWriteWallet[];
maxWidthReferences: MaxWidthReferences;
profileId: string;
}

export interface WalletsGroupHeaderProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ describe("WalletsGroup", () => {
balance: balanceWidthReference.current,
currency: currencyWidthReference.current,
}}
profileId={"1"}
/>,
);

Expand Down
4 changes: 2 additions & 2 deletions src/domains/wallet/components/WalletsGroup/WalletsGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useAccordion } from "@/app/hooks";

const MAX_WALLETS_ON_DASHBOARD_LIST = 10;

export const WalletsGroup: React.VFC<WalletsGroupProperties> = ({ network, wallets, maxWidthReferences }) => {
const { isExpanded, handleHeaderClick } = useAccordion(`wallets_group_${network.id()}`);
export const WalletsGroup: React.VFC<WalletsGroupProperties> = ({ network, wallets, maxWidthReferences, profileId }) => {
const { isExpanded, handleHeaderClick } = useAccordion(`${profileId}_wallets_group_${network.id()}`);

return (
<AccordionWrapper data-testid="WalletsGroup" isCollapsed={!isExpanded} className="md:!mb-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const WalletsGroupsList = () => {
}
wallets={wallets}
maxWidthReferences={{ balance: balanceMaxWidthReference, currency: currencyMaxWidthReference }}
profileId={profile.id()}
/>
));
}
Expand Down

0 comments on commit d2ec495

Please sign in to comment.