Skip to content

Commit e977763

Browse files
authored
Merge pull request #3319 from IntersectMBO/develop
fix: handle incorrect routing on connecting wallet on budget discussion page
2 parents ea4cbb2 + fe96153 commit e977763

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ changes.
1515
### Fixed
1616

1717
- Fix scroll on a drawer on smaller resolution
18+
- Fix incorrect routing on connecting wallet on budget discussion page
1819

1920
### Changed
2021

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

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { useLocation, useNavigate } from "react-router-dom";
22
import { Box, Button, Typography } from "@mui/material";
33

4-
import { PDF_PATHS, PATHS, gray, OUTCOMES_PATHS } from "@consts";
4+
import {
5+
PDF_PATHS,
6+
PATHS,
7+
gray,
8+
OUTCOMES_PATHS,
9+
BUDGET_DISCUSSION_PATHS,
10+
} from "@consts";
511
import { useCardano } from "@context";
612
import { useTranslation } from "@hooks";
713
import { Card } from "./Card";
@@ -14,15 +20,23 @@ export const WalletInfoCard = () => {
1420

1521
const onClickDisconnect = async () => {
1622
await disconnectWallet();
23+
24+
const isBudgetDiscussion = window.location.pathname.includes(
25+
BUDGET_DISCUSSION_PATHS.budgetDiscussion.replace("/", ""),
26+
);
27+
1728
const isProposalDiscussionForum = window.location.pathname.includes(
1829
PDF_PATHS.proposalDiscussion.replace("/", ""),
1930
);
2031

2132
const isGovernanceOutcomesPillar = window.location.pathname.includes(
2233
OUTCOMES_PATHS.governanceActionsOutcomes.replace("/", ""),
2334
);
24-
25-
if (!isProposalDiscussionForum && !isGovernanceOutcomesPillar) {
35+
if (
36+
!isBudgetDiscussion &&
37+
!isProposalDiscussionForum &&
38+
!isGovernanceOutcomesPillar
39+
) {
2640
navigate(
2741
pathname.includes("/connected")
2842
? `${pathname.replace("/connected", "")}${hash ?? ""}`

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { FC, useCallback } from "react";
22
import { To, useNavigate, useLocation } from "react-router-dom";
33
import { Box, CircularProgress, Typography } from "@mui/material";
44

5-
import { OUTCOMES_PATHS, PATHS, PDF_PATHS } from "@consts";
5+
import {
6+
BUDGET_DISCUSSION_PATHS,
7+
OUTCOMES_PATHS,
8+
PATHS,
9+
PDF_PATHS,
10+
} from "@consts";
611
import { useCardano } from "@context";
712
import { theme } from "@/theme";
813

@@ -32,6 +37,10 @@ export const WalletOptionButton: FC<WalletOption> = ({
3237

3338
const enableByWalletName = useCallback(async () => {
3439
if (isEnableLoading) return;
40+
const isBudgetDiscussion = window.location.pathname.includes(
41+
BUDGET_DISCUSSION_PATHS.budgetDiscussion.replace("/", ""),
42+
);
43+
3544
const isProposalDiscussionForum = window.location.pathname.includes(
3645
PDF_PATHS.proposalDiscussion.replace("/", ""),
3746
);
@@ -43,7 +52,12 @@ export const WalletOptionButton: FC<WalletOption> = ({
4352
const result = await enable(name);
4453

4554
if (result?.stakeKey) {
46-
if (isProposalDiscussionForum || isGovernanceOutcomesPillar) return;
55+
if (
56+
isBudgetDiscussion ||
57+
isProposalDiscussionForum ||
58+
isGovernanceOutcomesPillar
59+
)
60+
return;
4761
navigate(
4862
// eslint-disable-next-line no-unneeded-ternary
4963
pathToNavigate

0 commit comments

Comments
 (0)