Skip to content

Commit

Permalink
chore: bump pdf-ui package to v0.1.7;
Browse files Browse the repository at this point in the history
remove propose a governance action button from wrapper
  • Loading branch information
MSzalowski committed Jun 17, 2024
1 parent e67c673 commit 9e2807d
Show file tree
Hide file tree
Showing 7 changed files with 825 additions and 5,364 deletions.
8 changes: 4 additions & 4 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 @@ -28,7 +28,7 @@
"@emurgo/cardano-serialization-lib-asmjs": "12.0.0-alpha.29",
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "^0.1.3",
"@intersect.mbo/pdf-ui": "^0.1.7",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
34 changes: 4 additions & 30 deletions govtool/frontend/src/components/organisms/DashboardTopNav.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useEffect, useState } from "react";
import { Box, Button, IconButton } from "@mui/material";
import { IconPlusCircle } from "@intersect.mbo/intersectmbo.org-icons-set";
import { Box, IconButton } from "@mui/material";

import { VotingPowerChips, Typography } from "@atoms";
import { ICONS, PATHS, PDF_PATHS } from "@consts";
import { useScreenDimension, useTranslation } from "@hooks";
import { ICONS } from "@consts";
import { useScreenDimension } from "@hooks";
import { DashboardDrawerMobile } from "@organisms";

type DashboardTopNavProps = {
Expand All @@ -18,14 +17,6 @@ export const DashboardTopNav = ({
title,
isVotingPowerHidden,
}: DashboardTopNavProps) => {
const { t } = useTranslation();
const isProposalDiscussion = Object.values(PDF_PATHS).some(
(pdfPath) =>
window.location.pathname.includes(pdfPath) &&
window.location.pathname.includes(
PATHS.connectedProposalPillar.replace("/*", ""),
),
);
const [windowScroll, setWindowScroll] = useState<number>(0);
const { isMobile } = useScreenDimension();
const [isDrawerOpen, setIsDrawerOpen] = useState<boolean>(false);
Expand All @@ -34,12 +25,6 @@ export const DashboardTopNav = ({
setIsDrawerOpen(true);
};

const goToProposalDiscussionCreateGovernanceAction = () => {
window.location.href = `${PATHS.connectedProposalPillar.replace("/*", "")}${
PDF_PATHS.proposalDiscussionCreateGovernanceAction
}`;
};

useEffect(() => {
const onScroll = () => {
setWindowScroll(window.scrollY);
Expand Down Expand Up @@ -91,9 +76,7 @@ export const DashboardTopNav = ({
) : null}
</Box>
<Box display="flex">
{!isVotingPowerHidden && !isProposalDiscussion && (
<VotingPowerChips />
)}
{!isVotingPowerHidden && <VotingPowerChips />}
{isMobile && (
<IconButton
data-testid="open-drawer-button"
Expand All @@ -103,15 +86,6 @@ export const DashboardTopNav = ({
<img alt="drawer" src={ICONS.drawerIcon} />
</IconButton>
)}
{isProposalDiscussion && (
<Button
variant="contained"
startIcon={<IconPlusCircle fill="white" />}
onClick={goToProposalDiscussionCreateGovernanceAction}
>
{t("proposalDiscussion.proposeAGovernanceAction")}
</Button>
)}
</Box>
{isMobile && (
<DashboardDrawerMobile
Expand Down
4 changes: 2 additions & 2 deletions govtool/frontend/src/components/organisms/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, Grid } from "@mui/material";
import { NavLink } from "react-router-dom";

import { DrawerLink, Spacer } from "@atoms";
import { CONNECTED_NAV_ITEMS, IMAGES, PATHS } from "@consts";
import { CONNECTED_NAV_ITEMS, IMAGES, PATHS, DRAWER_WIDTH } from "@consts";
import { useFeatureFlag } from "@context";
import { useGetVoterInfo } from "@hooks";
import { WalletInfoCard, DRepInfoCard } from "@molecules";
Expand All @@ -21,7 +21,7 @@ export const Drawer = () => {
height: "100vh",
position: "sticky",
top: 0,
width: "268px",
width: `${DRAWER_WIDTH}px`,
}}
>
<NavLink
Expand Down
2 changes: 2 additions & 0 deletions govtool/frontend/src/consts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ export * from "./navItems";
export * from "./paths";
export * from "./placeholders";
export * from "./queryKeys";

export const DRAWER_WIDTH = 268;
8 changes: 5 additions & 3 deletions govtool/frontend/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useLocation, Outlet, useNavigate } from "react-router-dom";
import { Box } from "@mui/material";

import { Background, ScrollToManage } from "@atoms";
import { CONNECTED_NAV_ITEMS, PATHS } from "@consts";
import { CONNECTED_NAV_ITEMS, DRAWER_WIDTH, PATHS } from "@consts";
import { useCardano } from "@context";
import { useScreenDimension, useTranslation } from "@hooks";
import { DashboardTopNav, Drawer, Footer } from "@organisms";
Expand All @@ -20,8 +20,9 @@ export const Dashboard = () => {
const getPageTitle = (path: string) => {
if (path === PATHS.dashboard) return t("dashboard.title");
return (
Object.values(CONNECTED_NAV_ITEMS).find(({ navTo }) => pathname.startsWith(navTo))
?.label ?? ""
Object.values(CONNECTED_NAV_ITEMS).find(({ navTo }) =>
pathname.startsWith(navTo),
)?.label ?? ""
);
};

Expand Down Expand Up @@ -53,6 +54,7 @@ export const Dashboard = () => {
flex: 1,
flexDirection: "column",
minHeight: "100vh",
width: `calc(100vw - ${DRAWER_WIDTH}px)`,
overflow: "clip",
position: "relative",
}}
Expand Down
Loading

0 comments on commit 9e2807d

Please sign in to comment.