Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#1355): fix the navigation to Home from Proposal pillar on disconnected wallet #1412

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 3 additions & 12 deletions govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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]);
Expand All @@ -101,9 +98,6 @@ export default () => {
<Routes>
<Route path={PATHS.home} element={<Home />} />
<Route path={PATHS.governanceActions} element={<GovernanceActions />} />
{isProposalDiscussionForumEnabled && !isEnabled && (
<Route path={PATHS.proposalPillar} element={<PDFWrapper />} />
)}
<Route
path={PATHS.governanceActionsCategory}
element={<GovernanceActionsCategory />}
Expand All @@ -115,10 +109,7 @@ export default () => {
<Route element={<Dashboard />}>
<Route path={PATHS.dashboard} element={<DashboardCards />} />
{isProposalDiscussionForumEnabled && (
<Route
path={PATHS.connectedProposalPillar}
element={<PDFWrapper />}
/>
<Route path={PATHS.proposalPillar} element={<PDFWrapper />} />
)}
<Route
path={PATHS.dashboardGovernanceActions}
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/components/atoms/DrawerLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type LinkProps = {
const isRouteActive = (isActive: boolean, route: string) =>
isActive ||
(route ===
`${PATHS.connectedProposalPillar.replace("/*", "")}${
`${PATHS.proposalPillar.replace("/*", "")}${
PDF_PATHS.proposalDiscussion
}` &&
Object.values(PDF_PATHS).some((pdfPath) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const ProposeGovActionDashboardCard = ({

navigate(
isProposalDiscussionForumEnabled
? `${PATHS.connectedProposalPillar.replace("/*", "")}${
? `${PATHS.proposalPillar.replace("/*", "")}${
PDF_PATHS.proposalDiscussion
}`
: PATHS.createGovernanceAction,
Expand Down
2 changes: 1 addition & 1 deletion govtool/frontend/src/consts/navItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand Down
1 change: 0 additions & 1 deletion govtool/frontend/src/consts/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
Loading