Skip to content

Commit

Permalink
[#217] fix missing closing tag for dashboard top nav
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Mar 1, 2024
1 parent fbfe699 commit 5acb86d
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 94 deletions.
187 changes: 94 additions & 93 deletions govtool/frontend/src/components/organisms/DashboardTopNav.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import { Box, BoxProps, Grid, IconButton, SwipeableDrawer } from "@mui/material";
import {
Box,
BoxProps,
Grid,
IconButton,
SwipeableDrawer,
} from "@mui/material";

import { Background, Link, VotingPowerChips, Typography } from "@atoms";
import { useScreenDimension, useTranslation } from "@hooks";
Expand Down Expand Up @@ -28,7 +34,7 @@ export const DashboardTopNav = ({
imageWidth,
imageHeight,
isVotingPowerHidden,
sx
sx,
}: DashboardTopNavProps) => {
const { isMobile, screenWidth } = useScreenDimension();
const { voter } = useCardano();
Expand All @@ -44,7 +50,7 @@ export const DashboardTopNav = ({
bgcolor={isMobile ? "#FBFBFF" : undefined}
sx={{
backdropFilter: "blur(10px)",
...sx
...sx,
}}
alignItems={"center"}
justifyContent={"space-between"}
Expand Down Expand Up @@ -85,98 +91,93 @@ export const DashboardTopNav = ({
</IconButton>
)}
</Box>
{
isMobile && (
<SwipeableDrawer
anchor="right"
open={isDrawerOpen}
onClose={() => setIsDrawerOpen(false)}
onOpen={() => setIsDrawerOpen(true)}
>
<Background>
<Box
flex={1}
px={DRAWER_PADDING}
pb={3}
display="flex"
flexDirection="column"
height={"100%"}
>
<Box flex={1}>
<Box
width={screenWidth - CALCULATED_DRAWER_PADDING}
display="flex"
flex={1}
py={3}
justifyContent="space-between"
{isMobile && (
<SwipeableDrawer
anchor="right"
open={isDrawerOpen}
onClose={() => setIsDrawerOpen(false)}
onOpen={() => setIsDrawerOpen(true)}
>
<Background>
<Box
flex={1}
px={DRAWER_PADDING}
pb={3}
display="flex"
flexDirection="column"
height={"100%"}
>
<Box flex={1}>
<Box
width={screenWidth - CALCULATED_DRAWER_PADDING}
display="flex"
flex={1}
py={3}
justifyContent="space-between"
>
<img src={ICONS.appLogoIcon} height={25} />
<IconButton
data-testid={"close-drawer-button"}
sx={{ padding: 0 }}
onClick={() => setIsDrawerOpen(false)}
>
<img src={ICONS.appLogoIcon} height={25} />
<IconButton
data-testid={"close-drawer-button"}
sx={{ padding: 0 }}
onClick={() => setIsDrawerOpen(false)}
>
<img src={ICONS.closeDrawerIcon} />
</IconButton>
</Box>
<Grid container direction={"column"} rowGap={4} mt={6}>
<Grid item>
<Link
dataTestId="home-link"
navTo={PATHS.dashboard}
label={t("menu.myDashboard")}
size="big"
onClick={() => {
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
<Grid item>
<Link
dataTestId="governance-actions-link"
navTo={PATHS.dashboard_governance_actions}
label={t("menu.viewGovActions")}
size="big"
onClick={() => {
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
<Grid item>
<Link
dataTestId="guides-link"
navTo={""}
label={t("menu.guides")}
size="big"
onClick={() => {
openInNewTab(
"https://docs.sanchogov.tools/about/what-is-sanchonet-govtool"
);
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
<Grid item>
<Link
dataTestId="faqs-link"
navTo={""}
label={t("menu.faqs")}
size="big"
onClick={() => {
openInNewTab("https://docs.sanchogov.tools/faqs");
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
</Grid>
<img src={ICONS.closeDrawerIcon} />
</IconButton>
</Box>
{dRep?.isRegistered && <DRepInfoCard />}
<Box py={2} />
<WalletInfoCard />
<Grid container direction={"column"} rowGap={4} mt={6}>
<Grid item>
<Link
dataTestId="home-link"
navTo={PATHS.dashboard}
label={t("menu.myDashboard")}
size="big"
onClick={() => {
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
<Grid item>
<Link
dataTestId="governance-actions-link"
navTo={PATHS.dashboard_governance_actions}
label={t("menu.viewGovActions")}
size="big"
onClick={() => {
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
<Grid item>
<Link
dataTestId="guides-link"
navTo={""}
label={t("menu.guides")}
size="big"
onClick={() => {
openInNewTab(
"https://docs.sanchogov.tools/about/what-is-sanchonet-govtool"
);
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
<Grid item>
<Link
dataTestId="faqs-link"
navTo={""}
label={t("menu.faqs")}
size="big"
onClick={() => {
openInNewTab("https://docs.sanchogov.tools/faqs");
setIsDrawerOpen(false);
}}
isConnectWallet
/>
</Grid>
</Grid>
</Box>
{(voter?.isRegisteredAsDRep ||
voter?.isRegisteredAsSoleVoter) && <DRepInfoCard />}
Expand Down
5 changes: 4 additions & 1 deletion govtool/frontend/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ const getPageTitle = (pathname: string) => {
if (pathname === PATHS.dashboard) {
return "My Dashboard";
}
return Object.values(CONNECTED_NAV_ITEMS).find(({ navTo }) => navTo === pathname)?.label ?? "";
return (
Object.values(CONNECTED_NAV_ITEMS).find(({ navTo }) => navTo === pathname)
?.label ?? ""
);
};

export const Dashboard = () => {
Expand Down

0 comments on commit 5acb86d

Please sign in to comment.