From e1366e885011273b28e7c63e68b6739b5a908119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 30 Aug 2024 13:29:49 +0200 Subject: [PATCH 1/2] fix(#1866): fix formatting governance action id --- CHANGELOG.md | 1 + .../components/organisms/GovernanceActionDetailsCardData.tsx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bddf1842..c9d31038 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ changes. - Fix displaying non relevant data in protocol parameter change Governance Action [Issue 1601](https://github.com/IntersectMBO/govtool/issues/1601) - Fix voting on info actions in bootstrapping phase [Issue 1876](https://github.com/IntersectMBO/govtool/issues/1876) - Fix missing DRep name whitespace validation [Issue 1873](https://github.com/IntersectMBO/govtool/issues/1873) +- Fix displaying wrongly formatted Governance Action ID [Issue 1866](https://github.com/IntersectMBO/govtool/issues/1866k) ### Changed diff --git a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx index e5ec928e..d270a0de 100644 --- a/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx +++ b/govtool/frontend/src/components/organisms/GovernanceActionDetailsCardData.tsx @@ -18,6 +18,7 @@ import { getProposalTypeLabel, filterUpdatableProtocolParams, filterOutNullParams, + getFullGovActionId, } from "@utils"; import { MetadataValidationStatus, ProposalData } from "@models"; import { GovernanceActionType } from "@/types/governanceAction"; @@ -125,10 +126,10 @@ export const GovernanceActionDetailsCardData = ({ }; const label = getProposalTypeLabel(type); - const govActionId = `${index}${txHash}`; + const govActionId = getFullGovActionId(txHash, index); const prevGovActionId = prevGovActionIndex && prevGovActionTxHash - ? `${prevGovActionIndex}${prevGovActionTxHash}` + ? getFullGovActionId(prevGovActionTxHash, prevGovActionIndex) : null; const tabs = useMemo( From 556d6fc1b323d629af41f36f083118fcaad0cd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 30 Aug 2024 13:49:40 +0200 Subject: [PATCH 2/2] fix(#1866): fix wrong test condition --- .../stories/GovernanceActionDetailsCard.stories.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts b/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts index d6804b12..ae7eebf3 100644 --- a/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts +++ b/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts @@ -3,7 +3,11 @@ import { GovernanceActionDetailsCard } from "@organisms"; import { expect, jest } from "@storybook/jest"; import type { Meta, StoryObj } from "@storybook/react"; import { screen, userEvent, waitFor, within } from "@storybook/testing-library"; -import { formatDisplayDate, getProposalTypeNoEmptySpaces } from "@/utils"; +import { + formatDisplayDate, + getFullGovActionId, + getProposalTypeNoEmptySpaces, +} from "@/utils"; import { GovernanceActionType } from "@/types/governanceAction"; const meta = { @@ -50,7 +54,10 @@ const commonArgs = { } satisfies ProposalData, }; -const govActionId = commonArgs.proposal.index + commonArgs.proposal.txHash; +const govActionId = getFullGovActionId( + commonArgs.proposal.txHash, + commonArgs.proposal.index, +); async function assertTooltip(tooltip: HTMLElement, expectedText: RegExp) { await userEvent.hover(tooltip);