Skip to content

Commit a768ca4

Browse files
committed
Revert "Fix Back button on GA category view and tests"
This reverts commit d86def3.
1 parent 9e5ce6e commit a768ca4

File tree

7 files changed

+33
-32
lines changed

7 files changed

+33
-32
lines changed

govtool/frontend/src/App.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ export default () => {
8181
enable(walletName);
8282
return;
8383
}
84-
// eslint-disable-next-line no-await-in-loop
85-
await new Promise((resolve) => {
86-
setTimeout(resolve, interval);
87-
});
84+
await new Promise(resolve => setTimeout(resolve, interval));
8885
}
8986

9087
if (!isOnAllowedPage) {

govtool/frontend/src/components/atoms/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ChangeEvent } from "react";
2-
import { LinkProps } from "react-router-dom";
32
import {
43
ButtonProps as MUIButtonProps,
54
CheckboxProps as MUICheckboxProps,
@@ -14,10 +13,6 @@ export type ButtonProps = Omit<MUIButtonProps, "size"> & {
1413
isLoading?: boolean;
1514
size?: "small" | "medium" | "large" | "extraLarge";
1615
dataTestId?: string;
17-
to?: LinkProps["to"];
18-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
19-
state?: any;
20-
component?: React.ElementType;
2116
};
2217

2318
export type LoadingButtonProps = ButtonProps & {

govtool/frontend/src/components/molecules/GovernanceActionCard.tsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({
4040
inProgress = false,
4141
expiryDate,
4242
expiryEpochNo,
43-
onClick,
4443
createdDate,
4544
createdEpochNo,
4645
txHash,
@@ -59,8 +58,7 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({
5958
bech32Prefix: "gov_action",
6059
});
6160

62-
const pathname = useLocation().pathname.replace(/governance_actions.*/g, "governance_actions");
63-
const isCategoryView = useLocation().pathname.includes("category");
61+
const location = useLocation();
6462

6563
return (
6664
<Box
@@ -154,23 +152,8 @@ export const GovernanceActionCard: FC<ActionTypeProps> = ({
154152
<Skeleton width="100%" height="40px" sx={{ borderRadius: "20px" }} />
155153
) : (
156154
<Button
157-
onClick={onClick}
158155
component={Link}
159-
to={`${pathname}/${govActionId}`}
160-
state={{
161-
proposal: {
162-
abstract,
163-
type,
164-
expiryDate,
165-
expiryEpochNo,
166-
createdDate,
167-
createdEpochNo,
168-
txHash,
169-
index,
170-
title,
171-
},
172-
openedFromCategoryPage: isCategoryView
173-
}}
156+
to={`${location.pathname}/${govActionId}`}
174157
variant={inProgress ? "outlined" : "contained"}
175158
size="large"
176159
sx={{

govtool/frontend/src/components/organisms/ValidatedGovernanceActionCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useState, useEffect } from "react";
22

3-
import { GovernanceActionCard } from "@molecules";
43
import { useValidateMutation } from "@/hooks/mutations";
54
import { MetadataStandard, ProposalData } from "@/models";
5+
import { GovernanceActionCard } from "@molecules";
66

77
type ActionTypeProps = Omit<
88
ProposalData,
@@ -14,7 +14,6 @@ type ActionTypeProps = Omit<
1414
| "rationale"
1515
| "motivation"
1616
> & {
17-
onClick?: () => void;
1817
inProgress?: boolean;
1918
};
2019
export const ValidatedGovernanceActionCard = (props: ActionTypeProps) => {

govtool/frontend/src/pages/DashboardGovernanceActionsCategory.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useMemo, useRef } from "react";
2-
import { useNavigate, useParams } from "react-router-dom";
2+
import { generatePath, useNavigate, useParams } from "react-router-dom";
33
import { Box, CircularProgress, Link } from "@mui/material";
44

55
import { Background, Typography } from "@atoms";
@@ -18,6 +18,7 @@ import {
1818
useTranslation,
1919
} from "@hooks";
2020
import {
21+
getFullGovActionId,
2122
getProposalTypeLabel,
2223
removeDuplicatedProposals,
2324
} from "@utils";
@@ -140,6 +141,18 @@ export const DashboardGovernanceActionsCategory = () => {
140141
}
141142
onClick={() => {
142143
saveScrollPosition();
144+
145+
navigate(
146+
generatePath(PATHS.dashboardGovernanceActionsAction, {
147+
proposalId: getFullGovActionId(item.txHash, item.index),
148+
}),
149+
{
150+
state: {
151+
proposal: item,
152+
openedFromCategoryPage: true,
153+
},
154+
},
155+
);
143156
}}
144157
txHash={item.txHash}
145158
/>

govtool/frontend/src/pages/GovernanceActionsCategory.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
} from "@hooks";
2121
import {
2222
WALLET_LS_KEY,
23+
getFullGovActionId,
2324
getItemFromLocalStorage,
2425
getProposalTypeLabel,
2526
removeDuplicatedProposals,
@@ -141,6 +142,19 @@ export const GovernanceActionsCategory = () => {
141142
{...item}
142143
onClick={() => {
143144
saveScrollPosition();
145+
146+
navigate(
147+
PATHS.governanceActionsAction.replace(
148+
":proposalId",
149+
getFullGovActionId(item.txHash, item.index),
150+
),
151+
{
152+
state: {
153+
proposal: item,
154+
openedFromCategoryPage: true,
155+
},
156+
},
157+
);
144158
}}
145159
/>
146160
</Box>

govtool/frontend/src/stories/Slider.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@ export const SliderComponentOverflow: Story = {
5858
await expect(canvas.getByText("Slider title")).toBeInTheDocument();
5959
await expect(canvas.getAllByTestId("slider")).toHaveLength(6);
6060

61-
await expect(canvas.getByRole("link")).toBeEnabled();
61+
await expect(canvas.getByRole("button")).toBeEnabled();
6262
},
6363
};

0 commit comments

Comments
 (0)