diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7cc43abca..a87ebcdd9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -65,6 +65,7 @@ changes.
- Add PDF pillar [Issue 1090](https://github.com/IntersectMBO/govtool/issues/1090)
- Replace govtool-wrapper governance action creation in favor of pdf-pillar [Issue 1284](https://github.com/IntersectMBO/govtool/issues/1284)
- Add sentry environment config [Issue 1324](https://github.com/IntersectMBO/govtool/issues/1324)
+- Add proposal discussion pillar to home page [Issue 1431](https://github.com/IntersectMBO/govtool/issues/1431)
### Fixed
diff --git a/govtool/frontend/src/App.tsx b/govtool/frontend/src/App.tsx
index c61c798cc..9a8479522 100644
--- a/govtool/frontend/src/App.tsx
+++ b/govtool/frontend/src/App.tsx
@@ -1,5 +1,6 @@
import { useCallback, useEffect } from "react";
import { Route, Routes, useNavigate } from "react-router-dom";
+
import { Modal, ScrollToTop } from "@atoms";
import { PATHS, PDF_PATHS } from "@consts";
import { useCardano, useFeatureFlag, useModal } from "@context";
@@ -27,6 +28,7 @@ import {
RetireAsDrep,
RetireAsDirectVoter,
EditDRepMetadata,
+ ProposalDiscussionPillar,
} from "@pages";
import { SetupInterceptors } from "@services";
import {
@@ -36,11 +38,9 @@ import {
removeItemFromLocalStorage,
} from "@utils";
-import { PDFWrapper } from "./components/organisms/PDFWrapper";
-
export default () => {
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
- const { enable } = useCardano();
+ const { enable, isEnabled } = useCardano();
const navigate = useNavigate();
const { modal, openModal, modals } = useModal();
@@ -80,6 +80,8 @@ export default () => {
checkTheWalletIsActive();
}, [checkTheWalletIsActive]);
+ // Proposal Discussion Pillar doesn't export pages or react router routes
+ // so we need to handle the routing here
useEffect(() => {
if (!isProposalDiscussionForumEnabled) return;
if (
@@ -87,7 +89,10 @@ export default () => {
!window.location.pathname.includes(PATHS.proposalPillar.replace("/*", ""))
) {
navigate(
- `${PATHS.proposalPillar.replace("/*", "")}${window.location.pathname}`,
+ `${(isEnabled
+ ? PATHS.connectedProposalPillar
+ : PATHS.proposalPillar
+ ).replace("/*", "")}${window.location.pathname}`,
);
}
}, [window.location.pathname]);
@@ -106,10 +111,19 @@ export default () => {
path={PATHS.governanceActionsAction}
element={}
/>
+ {isProposalDiscussionForumEnabled && !isEnabled && (
+ }
+ />
+ )}
}>
} />
{isProposalDiscussionForumEnabled && (
- } />
+ }
+ />
)}
{
+ const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const { screenWidth } = useScreenDimension();
const { openModal } = useModal();
const { t } = useTranslation();
@@ -73,19 +74,28 @@ export const DrawerMobile = ({
) : null}
- {NAV_ITEMS.map((navItem) => (
-
- {
- if (navItem.newTabLink) openInNewTab(navItem.newTabLink);
- setIsDrawerOpen(false);
- }}
- size="big"
- />
-
- ))}
+ {NAV_ITEMS.map((navItem) => {
+ if (
+ !isProposalDiscussionForumEnabled &&
+ navItem.dataTestId === "proposed-governance-actions-link"
+ ) {
+ return null;
+ }
+ return (
+
+ {
+ if (navItem.newTabLink)
+ openInNewTab(navItem.newTabLink);
+ setIsDrawerOpen(false);
+ }}
+ size="big"
+ />
+
+ );
+ })}
diff --git a/govtool/frontend/src/components/organisms/HomeCards.tsx b/govtool/frontend/src/components/organisms/HomeCards.tsx
index 707870994..ae2831594 100644
--- a/govtool/frontend/src/components/organisms/HomeCards.tsx
+++ b/govtool/frontend/src/components/organisms/HomeCards.tsx
@@ -2,13 +2,14 @@ import { useCallback } from "react";
import { useNavigate } from "react-router-dom";
import { Box } from "@mui/material";
-import { IMAGES, PATHS } from "@consts";
-import { useModal } from "@context";
+import { IMAGES, PATHS, PDF_PATHS } from "@consts";
+import { useFeatureFlag, useModal } from "@context";
import { ActionCard } from "@molecules";
import { useScreenDimension, useTranslation } from "@hooks";
import { openInNewTab } from "@utils";
export const HomeCards = () => {
+ const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const navigate = useNavigate();
const { openModal } = useModal();
const { screenWidth } = useScreenDimension();
@@ -48,6 +49,16 @@ export const HomeCards = () => {
[navigate],
);
+ const navigateToProposalDiscussionPillar = useCallback(
+ () =>
+ navigate(
+ `${PATHS.connectedProposalPillar.replace("/*", "")}${
+ PDF_PATHS.proposalDiscussion
+ }`,
+ ),
+ [navigate],
+ );
+
return (
{
imageHeight={84}
imageURL={IMAGES.proposeGovActionImage}
imageWidth={84}
- secondButtonAction={onClickLearnMoreAboutProposingGovAction}
- secondButtonLabel={t("learnMore")}
+ secondButtonAction={
+ isProposalDiscussionForumEnabled
+ ? navigateToProposalDiscussionPillar
+ : onClickLearnMoreAboutProposingGovAction
+ }
+ secondButtonLabel={t(
+ isProposalDiscussionForumEnabled
+ ? "home.cards.proposeAGovernanceAction.secondButtonLabel"
+ : "learnMore",
+ )}
title={t("home.cards.proposeAGovernanceAction.title")}
/>
{/* PROPOSE GOV ACTION CARD END */}
diff --git a/govtool/frontend/src/components/organisms/TopNav.tsx b/govtool/frontend/src/components/organisms/TopNav.tsx
index fa34ff4b7..782241d87 100644
--- a/govtool/frontend/src/components/organisms/TopNav.tsx
+++ b/govtool/frontend/src/components/organisms/TopNav.tsx
@@ -5,7 +5,7 @@ import MenuIcon from "@mui/icons-material/Menu";
import { Button, Link } from "@atoms";
import { ICONS, IMAGES, PATHS, NAV_ITEMS } from "@consts";
-import { useCardano, useModal } from "@context";
+import { useCardano, useFeatureFlag, useModal } from "@context";
import { useScreenDimension, useTranslation } from "@hooks";
import { openInNewTab } from "@utils";
@@ -14,6 +14,7 @@ import { DrawerMobile } from "./DrawerMobile";
const POSITION_TO_BLUR = 50;
export const TopNav = ({ isConnectButton = true }) => {
+ const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const [windowScroll, setWindowScroll] = useState(0);
const { openModal } = useModal();
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
@@ -98,20 +99,28 @@ export const TopNav = ({ isConnectButton = true }) => {
columnSpacing={screenWidth < 1024 ? 2 : 4}
container
>
- {NAV_ITEMS.map((navItem) => (
-
- {
- if (navItem.newTabLink) {
- openInNewTab(navItem.newTabLink);
- }
- setIsDrawerOpen(false);
- }}
- />
-
- ))}
+ {NAV_ITEMS.map((navItem) => {
+ if (
+ !isProposalDiscussionForumEnabled &&
+ navItem.dataTestId === "proposed-governance-actions-link"
+ ) {
+ return null;
+ }
+ return (
+
+ {
+ if (navItem.newTabLink) {
+ openInNewTab(navItem.newTabLink);
+ }
+ setIsDrawerOpen(false);
+ }}
+ />
+
+ );
+ })}
{isConnectButton ? (
+ );
+};
diff --git a/govtool/frontend/src/pages/index.ts b/govtool/frontend/src/pages/index.ts
index 0fc969f2c..c986b8134 100644
--- a/govtool/frontend/src/pages/index.ts
+++ b/govtool/frontend/src/pages/index.ts
@@ -2,10 +2,10 @@ export * from "./ChooseStakeKey";
export * from "./CreateGovernanceAction";
export * from "./DRepDetails";
export * from "./DRepDirectory";
+export * from "./DRepDirectory";
export * from "./DRepDirectoryContent";
export * from "./Dashboard";
export * from "./DashboardGovernanceActionsCategory";
-export * from "./DRepDirectory";
export * from "./EditDRepMetadata";
export * from "./ErrorPage";
export * from "./GovernanceActionDetails";
@@ -13,7 +13,8 @@ export * from "./GovernanceActions";
export * from "./GovernanceActionsCategory";
export * from "./Home";
export * from "./RegisterAsDirectVoter";
-export * from "./RegisterAsdRep";
export * from "./RegisterAsDirectVoter";
-export * from "./RetireAsDrep";
+export * from "./RegisterAsdRep";
export * from "./RetireAsDirectVoter";
+export * from "./RetireAsDrep";
+export * from "./ProposalDiscussion";