Skip to content

Commit

Permalink
Merge pull request #2938 from IntersectMBO/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski authored Feb 10, 2025
2 parents ceea391 + 9713fb5 commit bfbc9ff
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 181 deletions.
131 changes: 28 additions & 103 deletions govtool/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion govtool/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@emotion/styled": "^11.11.0",
"@emurgo/cardano-serialization-lib-asmjs": "^12.1.1",
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/govtool-outcomes-pillar-ui": "^1.0.0-beta.1",
"@intersect.mbo/govtool-outcomes-pillar-ui": "1.0.0",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "^0.5.11",
"@mui/icons-material": "^5.14.3",
Expand Down
12 changes: 12 additions & 0 deletions govtool/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ export default () => {
element={<ProposalDiscussionPillar />}
/>
)}
{isGovernanceOutcomesPillarEnabled && !isEnabled && (
<>
<Route
path={`${OUTCOMES_PATHS.governanceActionsOutcomes}/*`}
element={<GovernanceActionOutComesPillar />}
/>
<Route
path={USER_PATHS.governanceActionsVotedByMe}
element={<GovernanceActionOutComesPillar />}
/>
</>
)}
<Route element={<Dashboard />}>
<Route path={PATHS.dashboard} element={<DashboardHome />} />
{isProposalDiscussionForumEnabled && (
Expand Down
8 changes: 6 additions & 2 deletions govtool/frontend/src/components/molecules/WalletInfoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useLocation, useNavigate } from "react-router-dom";
import { Box, Button, Typography } from "@mui/material";

import { PDF_PATHS, PATHS, gray } from "@consts";
import { PDF_PATHS, PATHS, gray, OUTCOMES_PATHS } from "@consts";
import { useCardano } from "@context";
import { useTranslation } from "@hooks";
import { Card } from "./Card";
Expand All @@ -18,7 +18,11 @@ export const WalletInfoCard = () => {
PDF_PATHS.proposalDiscussion.replace("/", ""),
);

if (!isProposalDiscussionForum) {
const isGovernanceOutcomesPillar = window.location.pathname.includes(
OUTCOMES_PATHS.governanceActionsOutcomes.replace("/", ""),
);

if (!isProposalDiscussionForum && !isGovernanceOutcomesPillar) {
navigate(
pathname.includes("/connected")
? `${pathname.replace("/connected", "")}${hash ?? ""}`
Expand Down
8 changes: 6 additions & 2 deletions govtool/frontend/src/components/molecules/WalletOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC, useCallback } from "react";
import { To, useNavigate, useLocation } from "react-router-dom";
import { Box, CircularProgress, Typography } from "@mui/material";

import { PATHS, PDF_PATHS } from "@consts";
import { OUTCOMES_PATHS, PATHS, PDF_PATHS } from "@consts";
import { useCardano } from "@context";
import { theme } from "@/theme";

Expand Down Expand Up @@ -36,10 +36,14 @@ export const WalletOptionButton: FC<WalletOption> = ({
PDF_PATHS.proposalDiscussion.replace("/", ""),
);

const isGovernanceOutcomesPillar = window.location.pathname.includes(
OUTCOMES_PATHS.governanceActionsOutcomes.replace("/", ""),
);

const result = await enable(name);

if (result?.stakeKey) {
if (isProposalDiscussionForum) return;
if (isProposalDiscussionForum || isGovernanceOutcomesPillar) return;
navigate(
// eslint-disable-next-line no-unneeded-ternary
pathToNavigate
Expand Down
12 changes: 11 additions & 1 deletion govtool/frontend/src/components/organisms/DrawerMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ export const DrawerMobile = ({
isDrawerOpen,
setIsDrawerOpen,
}: DrawerMobileProps) => {
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const {
isProposalDiscussionForumEnabled,
isGovernanceOutcomesPillarEnabled,
} = useFeatureFlag();
const { screenWidth } = useScreenDimension();
const { openModal } = useModal();
const { t } = useTranslation();
Expand Down Expand Up @@ -88,6 +91,13 @@ export const DrawerMobile = ({
) {
return null;
}

if (
!isGovernanceOutcomesPillarEnabled &&
navItem.dataTestId === "governance-actions-outcomes-link"
) {
return null;
}
return (
<Grid item key={navItem.label}>
<Link
Expand Down
9 changes: 8 additions & 1 deletion govtool/frontend/src/components/organisms/TopNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { DrawerMobile } from "./DrawerMobile";
const POSITION_TO_BLUR = 50;

export const TopNav = ({ isConnectButton = true }) => {
const { isProposalDiscussionForumEnabled } = useFeatureFlag();
const { isProposalDiscussionForumEnabled, isGovernanceOutcomesPillarEnabled } = useFeatureFlag();
const containerRef = useRef<HTMLDivElement>(null);
const [shouldBlur, setShouldBlur] = useState<boolean>(false);
const { openModal } = useModal();
Expand Down Expand Up @@ -121,6 +121,13 @@ export const TopNav = ({ isConnectButton = true }) => {
) {
return null;
}

if (
!isGovernanceOutcomesPillarEnabled &&
navItem.dataTestId === "governance-actions-outcomes-link"
) {
return null;
}
return (
<Grid item key={navItem.label}>
<Link
Expand Down
Loading

0 comments on commit bfbc9ff

Please sign in to comment.