Skip to content

Commit

Permalink
chore: upgrade outcomes package version and setup access urls
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuel-musau committed Feb 6, 2025
1 parent b96c61f commit 77361d8
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 16 deletions.
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
25 changes: 16 additions & 9 deletions govtool/frontend/src/consts/navItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export const NAV_ITEMS = [
{
dataTestId: "governance-actions-link",
navTo: PATHS.governanceActions,
label: i18n.t("govActions.title"),
label: i18n.t("govActions.navTitle"),
newTabLink: null,
},
{
dataTestId: "governance-actions-outcomes-link",
label: i18n.t("govActions.outcomes.title"),
navTo: OUTCOMES_PATHS.governanceActionsOutcomes,
newTabLink: null,
},
{
Expand Down Expand Up @@ -107,14 +113,15 @@ export const CONNECTED_NAV_ITEMS = [
icon: ICONS.governanceActionsIcon,
newTabLink: null,
},
{
dataTestId: "governance-actions-voted-by-me-link",
label: i18n.t("govActions.votedByMe.title"),
navTo: USER_PATHS.governanceActionsVotedByMe,
activeIcon: ICONS.governanceActionsActiveIcon,
icon: ICONS.governanceActionsIcon,
newTabLink: null,
},
// TODO: This will be uncommented when the page has been bootstrapped in the outcomes Pillar
// {
// dataTestId: "governance-actions-voted-by-me-link",
// label: i18n.t("govActions.votedByMe.title"),
// navTo: USER_PATHS.governanceActionsVotedByMe,
// activeIcon: ICONS.governanceActionsActiveIcon,
// icon: ICONS.governanceActionsIcon,
// newTabLink: null,
// },
],
},
{
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
"supportingLinks": "Supporting links",
"threshold": "Ratification Threshold",
"title": "Governance Actions",
"navTitle": "Live Voting",
"toVote": "To vote",
"viewDetails": "View Details",
"viewDetailsAndVote": "View Details and Vote",
Expand Down

0 comments on commit 77361d8

Please sign in to comment.