From a768ca488f5f693efa22807d9bbebf148a7e96d7 Mon Sep 17 00:00:00 2001 From: Aaron Boyle Date: Wed, 23 Jul 2025 21:26:13 +0100 Subject: [PATCH 1/2] Revert "Fix Back button on GA category view and tests" This reverts commit d86def3ddef27c1e6ddba9bd9a90d0a0fcf028a6. --- govtool/frontend/src/App.tsx | 5 +---- .../frontend/src/components/atoms/types.ts | 5 ----- .../molecules/GovernanceActionCard.tsx | 21 ++----------------- .../ValidatedGovernanceActionCard.tsx | 3 +-- .../DashboardGovernanceActionsCategory.tsx | 15 ++++++++++++- .../src/pages/GovernanceActionsCategory.tsx | 14 +++++++++++++ .../frontend/src/stories/Slider.stories.tsx | 2 +- 7 files changed, 33 insertions(+), 32 deletions(-) diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx index ce4f54add..f5f2fd499 100644 --- a/govtool/frontend/src/App.tsx +++ b/govtool/frontend/src/App.tsx @@ -81,10 +81,7 @@ export default () => { enable(walletName); return; } - // eslint-disable-next-line no-await-in-loop - await new Promise((resolve) => { - setTimeout(resolve, interval); - }); + await new Promise(resolve => setTimeout(resolve, interval)); } if (!isOnAllowedPage) { diff --git a/govtool/frontend/src/components/atoms/types.ts b/govtool/frontend/src/components/atoms/types.ts index 3ae4ea5ae..52bf82151 100644 --- a/govtool/frontend/src/components/atoms/types.ts +++ b/govtool/frontend/src/components/atoms/types.ts @@ -1,5 +1,4 @@ import { ChangeEvent } from "react"; -import { LinkProps } from "react-router-dom"; import { ButtonProps as MUIButtonProps, CheckboxProps as MUICheckboxProps, @@ -14,10 +13,6 @@ export type ButtonProps = Omit & { isLoading?: boolean; size?: "small" | "medium" | "large" | "extraLarge"; dataTestId?: string; - to?: LinkProps["to"]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - state?: any; - component?: React.ElementType; }; export type LoadingButtonProps = ButtonProps & { diff --git a/govtool/frontend/src/components/molecules/GovernanceActionCard.tsx b/govtool/frontend/src/components/molecules/GovernanceActionCard.tsx index 4d091020f..263ed05b3 100644 --- a/govtool/frontend/src/components/molecules/GovernanceActionCard.tsx +++ b/govtool/frontend/src/components/molecules/GovernanceActionCard.tsx @@ -40,7 +40,6 @@ export const GovernanceActionCard: FC = ({ inProgress = false, expiryDate, expiryEpochNo, - onClick, createdDate, createdEpochNo, txHash, @@ -59,8 +58,7 @@ export const GovernanceActionCard: FC = ({ bech32Prefix: "gov_action", }); - const pathname = useLocation().pathname.replace(/governance_actions.*/g, "governance_actions"); - const isCategoryView = useLocation().pathname.includes("category"); + const location = useLocation(); return ( = ({ ) : ( diff --git a/govtool/frontend/src/components/organisms/ValidatedGovernanceActionCard.tsx b/govtool/frontend/src/components/organisms/ValidatedGovernanceActionCard.tsx index 826dfb3d4..4dfe5ae0a 100644 --- a/govtool/frontend/src/components/organisms/ValidatedGovernanceActionCard.tsx +++ b/govtool/frontend/src/components/organisms/ValidatedGovernanceActionCard.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from "react"; import { useValidateMutation } from "@/hooks/mutations"; import { MetadataStandard, ProposalData } from "@/models"; -import { GovernanceActionCard } from "@molecules"; +import { GovernanceActionCard } from "../molecules"; type ActionTypeProps = Omit< ProposalData, @@ -14,6 +14,7 @@ type ActionTypeProps = Omit< | "rationale" | "motivation" > & { + onClick?: () => void; inProgress?: boolean; }; export const ValidatedGovernanceActionCard = (props: ActionTypeProps) => {