From d4478470672a5ac204682c1be6d81de37ebece37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Mon, 24 Jun 2024 11:20:25 +0200 Subject: [PATCH] fix(#1355): fix the navigation to Home from Proposal pillar on disconnected wallet --- CHANGELOG.md | 1 + govtool/frontend/src/App.tsx | 15 +++------------ .../frontend/src/components/atoms/DrawerLink.tsx | 2 +- .../ProposeGovActionDashboardCard.tsx | 2 +- govtool/frontend/src/consts/navItems.tsx | 2 +- govtool/frontend/src/consts/paths.ts | 1 - 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c3d2a38e..d95381537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ changes. - Fix validation of the GAs with missing references [Issue 1282](https://github.com/IntersectMBO/govtool/issues/1282) - Fix displaying the GA Markdowns [Issue 1244](https://github.com/IntersectMBO/govtool/issues/1244) - Fix app crash on voting on the GA without the connected wallet before [Issue 1313](https://github.com/IntersectMBO/govtool/issues/1313) +- Fix the navigation to Home from Proposal pillar on disconnected wallet [Issue 1355](https://github.com/IntersectMBO/govtool/issues/1355) ### Changed diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx index c1756cdae..c61c798cc 100644 --- a/govtool/frontend/src/App.tsx +++ b/govtool/frontend/src/App.tsx @@ -40,7 +40,7 @@ import { PDFWrapper } from "./components/organisms/PDFWrapper"; export default () => { const { isProposalDiscussionForumEnabled } = useFeatureFlag(); - const { enable, isEnabled } = useCardano(); + const { enable } = useCardano(); const navigate = useNavigate(); const { modal, openModal, modals } = useModal(); @@ -87,10 +87,7 @@ export default () => { !window.location.pathname.includes(PATHS.proposalPillar.replace("/*", "")) ) { navigate( - `${(isEnabled - ? PATHS.connectedProposalPillar - : PATHS.proposalPillar - ).replace("/*", "")}${window.location.pathname}`, + `${PATHS.proposalPillar.replace("/*", "")}${window.location.pathname}`, ); } }, [window.location.pathname]); @@ -101,9 +98,6 @@ export default () => { } /> } /> - {isProposalDiscussionForumEnabled && !isEnabled && ( - } /> - )} } @@ -115,10 +109,7 @@ export default () => { }> } /> {isProposalDiscussionForumEnabled && ( - } - /> + } /> )} isActive || (route === - `${PATHS.connectedProposalPillar.replace("/*", "")}${ + `${PATHS.proposalPillar.replace("/*", "")}${ PDF_PATHS.proposalDiscussion }` && Object.values(PDF_PATHS).some((pdfPath) => diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx index a68aa2005..00a0adfc3 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx @@ -37,7 +37,7 @@ export const ProposeGovActionDashboardCard = ({ navigate( isProposalDiscussionForumEnabled - ? `${PATHS.connectedProposalPillar.replace("/*", "")}${ + ? `${PATHS.proposalPillar.replace("/*", "")}${ PDF_PATHS.proposalDiscussion }` : PATHS.createGovernanceAction, diff --git a/govtool/frontend/src/consts/navItems.tsx b/govtool/frontend/src/consts/navItems.tsx index 5b6ec10f0..acd4fb2b2 100644 --- a/govtool/frontend/src/consts/navItems.tsx +++ b/govtool/frontend/src/consts/navItems.tsx @@ -64,7 +64,7 @@ export const CONNECTED_NAV_ITEMS = [ { dataTestId: "proposal-discussion-link", label: i18n.t("proposalDiscussion.title"), - navTo: `${PATHS.connectedProposalPillar.replace("/*", "")}${ + navTo: `${PATHS.proposalPillar.replace("/*", "")}${ PDF_PATHS.proposalDiscussion }`, activeIcon: ( diff --git a/govtool/frontend/src/consts/paths.ts b/govtool/frontend/src/consts/paths.ts index d7e1973d1..3c16566ca 100644 --- a/govtool/frontend/src/consts/paths.ts +++ b/govtool/frontend/src/consts/paths.ts @@ -25,7 +25,6 @@ export const PATHS = { retireAsDirectVoter: "/retire_direct_voter", stakeKeys: "/stake_keys", proposalPillar: "/proposal_pillar/*", - connectedProposalPillar: "/connected/proposal_pillar/*", }; export const PDF_PATHS = {