diff --git a/CHANGELOG.md b/CHANGELOG.md index 123bbf2c6..69e2f4722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ changes. ### Fixed - Fix scroll on a drawer on smaller resolution +- Fix incorrect routing on connecting wallet on budget discussion page ### Changed diff --git a/govtool/frontend/src/components/molecules/WalletInfoCard.tsx b/govtool/frontend/src/components/molecules/WalletInfoCard.tsx index b1c9b8c50..9ba1e4a39 100644 --- a/govtool/frontend/src/components/molecules/WalletInfoCard.tsx +++ b/govtool/frontend/src/components/molecules/WalletInfoCard.tsx @@ -1,7 +1,13 @@ import { useLocation, useNavigate } from "react-router-dom"; import { Box, Button, Typography } from "@mui/material"; -import { PDF_PATHS, PATHS, gray, OUTCOMES_PATHS } from "@consts"; +import { + PDF_PATHS, + PATHS, + gray, + OUTCOMES_PATHS, + BUDGET_DISCUSSION_PATHS, +} from "@consts"; import { useCardano } from "@context"; import { useTranslation } from "@hooks"; import { Card } from "./Card"; @@ -14,6 +20,11 @@ export const WalletInfoCard = () => { const onClickDisconnect = async () => { await disconnectWallet(); + + const isBudgetDiscussion = window.location.pathname.includes( + BUDGET_DISCUSSION_PATHS.budgetDiscussion.replace("/", ""), + ); + const isProposalDiscussionForum = window.location.pathname.includes( PDF_PATHS.proposalDiscussion.replace("/", ""), ); @@ -21,8 +32,11 @@ export const WalletInfoCard = () => { const isGovernanceOutcomesPillar = window.location.pathname.includes( OUTCOMES_PATHS.governanceActionsOutcomes.replace("/", ""), ); - - if (!isProposalDiscussionForum && !isGovernanceOutcomesPillar) { + if ( + !isBudgetDiscussion && + !isProposalDiscussionForum && + !isGovernanceOutcomesPillar + ) { navigate( pathname.includes("/connected") ? `${pathname.replace("/connected", "")}${hash ?? ""}` diff --git a/govtool/frontend/src/components/molecules/WalletOption.tsx b/govtool/frontend/src/components/molecules/WalletOption.tsx index a20c5a46b..42d6ffb4e 100644 --- a/govtool/frontend/src/components/molecules/WalletOption.tsx +++ b/govtool/frontend/src/components/molecules/WalletOption.tsx @@ -2,7 +2,12 @@ import { FC, useCallback } from "react"; import { To, useNavigate, useLocation } from "react-router-dom"; import { Box, CircularProgress, Typography } from "@mui/material"; -import { OUTCOMES_PATHS, PATHS, PDF_PATHS } from "@consts"; +import { + BUDGET_DISCUSSION_PATHS, + OUTCOMES_PATHS, + PATHS, + PDF_PATHS, +} from "@consts"; import { useCardano } from "@context"; import { theme } from "@/theme"; @@ -32,6 +37,10 @@ export const WalletOptionButton: FC = ({ const enableByWalletName = useCallback(async () => { if (isEnableLoading) return; + const isBudgetDiscussion = window.location.pathname.includes( + BUDGET_DISCUSSION_PATHS.budgetDiscussion.replace("/", ""), + ); + const isProposalDiscussionForum = window.location.pathname.includes( PDF_PATHS.proposalDiscussion.replace("/", ""), ); @@ -43,7 +52,12 @@ export const WalletOptionButton: FC = ({ const result = await enable(name); if (result?.stakeKey) { - if (isProposalDiscussionForum || isGovernanceOutcomesPillar) return; + if ( + isBudgetDiscussion || + isProposalDiscussionForum || + isGovernanceOutcomesPillar + ) + return; navigate( // eslint-disable-next-line no-unneeded-ternary pathToNavigate