From 193455c94c3865327154041079daf20a20d8cdca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 20 Dec 2024 16:24:21 +0100 Subject: [PATCH 1/4] feat: split new committe on-chain details into tabs --- CHANGELOG.md | 2 +- govtool/frontend/package-lock.json | 4 +- ...ActionNewConstitutionDetailsTabContent.tsx | 30 ++++++++++++++ .../src/components/molecules/index.ts | 1 + .../GovernanceActionDetailsCardData.tsx | 40 +++++++------------ 5 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index e77f1fb49..f163b6c8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ changes. ### Changed -- +- Split New committee on-chain details into tabs ### Removed diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index 55b16c656..24d068e3d 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "@govtool/frontend", - "version": "2.0.1", + "version": "2.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@govtool/frontend", - "version": "2.0.1", + "version": "2.0.2", "hasInstallScript": true, "dependencies": { "@emotion/react": "^11.11.1", diff --git a/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx b/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx new file mode 100644 index 000000000..9c0f4016c --- /dev/null +++ b/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx @@ -0,0 +1,30 @@ +import { Box } from "@mui/material"; + +import { NewConstitutionAnchor, ProposalData } from "@/models"; +import { useScreenDimension } from "@/hooks"; + +import { GovernanceActionCardElement } from "./GovernanceActionCardElement"; + +export const GovernanceActionNewConstitutionDetailsTabContent = ({ + details, +}: Pick) => { + const { screenWidth } = useScreenDimension(); + return ( + + 1600 ? "longText" : "oneLine"} + /> + 1600 ? "longText" : "oneLine"} + /> + + ); +}; diff --git a/govtool/frontend/src/components/molecules/index.ts b/govtool/frontend/src/components/molecules/index.ts index 89005427a..1335d5237 100644 --- a/govtool/frontend/src/components/molecules/index.ts +++ b/govtool/frontend/src/components/molecules/index.ts @@ -28,6 +28,7 @@ export * from "./GovernanceActionDetailsCardLinks"; export * from "./GovernanceActionDetailsCardOnChainData"; export * from "./GovernanceActionDetailsCardVotes"; export * from "./GovernanceActionDetailsDiffView"; +export * from "./GovernanceActionNewConstitutionDetailsTabContent"; export * from "./GovernanceActionNewCommitteeDetailsTabContent"; export * from "./GovernanceActionsDatesBox"; export * from "./GovernanceVotedOnCard"; diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx index 8928a6566..bd3941f2c 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx @@ -11,6 +11,7 @@ import { GovernanceActionDetailsDiffView, GovernanceActionNewCommitteeDetailsTabContent, GovernanceActionCardTreasuryWithdrawalElement, + GovernanceActionNewConstitutionDetailsTabContent, } from "@molecules"; import { useScreenDimension, useTranslation } from "@hooks"; import { @@ -22,11 +23,7 @@ import { mapArrayToObjectByKeys, encodeCIP129Identifier, } from "@utils"; -import { - MetadataValidationStatus, - NewConstitutionAnchor, - ProposalData, -} from "@models"; +import { MetadataValidationStatus, ProposalData } from "@models"; import { GovernanceActionType } from "@/types/governanceAction"; import { useAppContext } from "@/context"; @@ -200,6 +197,19 @@ export const GovernanceActionDetailsCardData = ({ ), visible: type === GovernanceActionType.NewCommittee && !!details, }, + { + label: "Parameters", + dataTestId: "parameters-tab", + content: ( + + ), + visible: + type === GovernanceActionType.NewConstitution && + !!details && + !!details?.anchor, + }, ].filter((tab) => tab.visible), [ abstract, @@ -307,26 +317,6 @@ export const GovernanceActionDetailsCardData = ({ amount={withdrawal.amount} /> ))} - {details?.anchor && type === GovernanceActionType.NewConstitution && ( - <> - 1600 ? "longText" : "oneLine"} - /> - 1600 ? "longText" : "oneLine"} - /> - - )} ); From f2380e41a82ada03019a5d6a6daeb8de46fae6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 20 Dec 2024 16:27:17 +0100 Subject: [PATCH 2/4] Update govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ryan Signed-off-by: Michał Szałowski --- .../components/organisms/GovernanceActionDetailsCardData.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx index bd3941f2c..149eebeb3 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx @@ -198,7 +198,7 @@ export const GovernanceActionDetailsCardData = ({ visible: type === GovernanceActionType.NewCommittee && !!details, }, { - label: "Parameters", + label: "Details", dataTestId: "parameters-tab", content: ( Date: Mon, 23 Dec 2024 14:50:51 +0100 Subject: [PATCH 3/4] Update govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ryan Signed-off-by: Michał Szałowski --- .../GovernanceActionNewConstitutionDetailsTabContent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx b/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx index 9c0f4016c..82e9e26f5 100644 --- a/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx +++ b/govtool/frontend/src/components/molecules/GovernanceActionNewConstitutionDetailsTabContent.tsx @@ -20,7 +20,7 @@ export const GovernanceActionNewConstitutionDetailsTabContent = ({ /> 1600 ? "longText" : "oneLine"} From 1830056f58b59eb5522cdc56fb9ab04170416204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Mon, 23 Dec 2024 14:51:00 +0100 Subject: [PATCH 4/4] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ryan Signed-off-by: Michał Szałowski --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f163b6c8b..827cd4ce9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ changes. ### Changed -- Split New committee on-chain details into tabs +- Split New constitution on-chain details into tabs ### Removed