From 0da210949ae59a4c93852fb690306c628b83c8fd Mon Sep 17 00:00:00 2001 From: Jan Jaroszczak Date: Wed, 15 May 2024 13:03:48 +0200 Subject: [PATCH 1/2] [#1031] Update GA links type --- .../molecules/GovernanceActionDetailsCardLinks.tsx | 8 ++++---- .../components/organisms/GovernanceActionDetailsCard.tsx | 2 +- .../organisms/GovernanceActionDetailsCardData.tsx | 2 +- govtool/frontend/src/types/global.d.ts | 6 ++++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx b/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx index c362db759..08ed07aa6 100644 --- a/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx +++ b/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx @@ -9,7 +9,7 @@ import { LinkWithIcon } from "@molecules"; export const GovernanceActionDetailsCardLinks = ({ links, }: { - links?: string[]; + links?: GovernanceActionLink[]; }) => { const { isMobile } = useScreenDimension(); const { t } = useTranslation(); @@ -43,13 +43,13 @@ export const GovernanceActionDetailsCardLinks = ({ > {links.map((link) => ( { openModal({ type: "externalLink", state: { - externalLink: link, + externalLink: link.uri, }, }); }} diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCard.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCard.tsx index 7cc4656ee..9eed968ea 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCard.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCard.tsx @@ -24,7 +24,7 @@ type GovernanceActionDetailsCardProps = { motivation?: string; rationale?: string; yesVotes: number; - links?: string[]; + links?: GovernanceActionLink[]; govActionId: string; isDataMissing: boolean | MetadataValidationStatus; isDashboard?: boolean; diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx index 7032ed8c9..51f6e087d 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx @@ -26,7 +26,7 @@ type GovernanceActionDetailsCardDataProps = { isInProgress?: boolean; isOneColumn: boolean; isSubmitted?: boolean; - links?: string[]; + links?: GovernanceActionLink[]; motivation?: string; rationale?: string; title?: string; diff --git a/govtool/frontend/src/types/global.d.ts b/govtool/frontend/src/types/global.d.ts index 6204ffc90..2cd73ebcc 100644 --- a/govtool/frontend/src/types/global.d.ts +++ b/govtool/frontend/src/types/global.d.ts @@ -75,4 +75,10 @@ declare global { type ArrayElement = ArrayType extends readonly (infer ElementType)[] ? ElementType : never; + + type GovernanceActionLink = { + "@type": string; + label: string; + uri: string; + }; } From 4d6ab36a29467e60dbd7ec3ab4c7d51a4c32d5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Wed, 15 May 2024 14:10:02 +0200 Subject: [PATCH 2/2] Update govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Szałowski --- .../components/molecules/GovernanceActionDetailsCardLinks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx b/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx index 08ed07aa6..e3763567e 100644 --- a/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx +++ b/govtool/frontend/src/components/molecules/GovernanceActionDetailsCardLinks.tsx @@ -44,7 +44,7 @@ export const GovernanceActionDetailsCardLinks = ({ {links.map((link) => ( { openModal({ type: "externalLink",