Skip to content

Commit

Permalink
Merge pull request #30 from bcgov/hot-fix
Browse files Browse the repository at this point in the history
Fix Breadcrumb nav
  • Loading branch information
jadmsaadaot authored Aug 14, 2024
2 parents fb913c2 + d55ca1e commit c1d177f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import { theme } from "@/styles/theme";

interface RouteSegment {
title: string;
path: string;
path?: string;
}

const filterUniqueRoutes = (breadcrumbs: RouteSegment[]) => {
const seenPaths = new Set();
return breadcrumbs.filter((segment) => {
const isUnique = !seenPaths.has(segment.path);
if (!segment?.path || !segment?.title) return false;
const isUnique = !seenPaths.has(segment?.path);
if (isUnique) {
seenPaths.add(segment.path);
seenPaths.add(segment?.path);
}
return isUnique;
});
Expand Down Expand Up @@ -45,7 +46,7 @@ const BreadcrumbNav: React.FC = () => {
>
<Breadcrumbs aria-label="breadcrumb">
{uniqueBreadcrumbs.map(
(segment: { title: string; path: string }, index: number) => {
(segment: { title: string; path?: string }, index: number) => {
const { title, path } = segment;
const isLast = index === uniqueBreadcrumbs.length - 1;
return isLast ? (
Expand Down
10 changes: 1 addition & 9 deletions submit-web/src/routes/_authenticated/_dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BreadcrumbNav from "@/components/Shared/layout/SideNav/BreadcrumbNav";
import SideNavBar from "@/components/Shared/layout/SideNav/SideNavBar";
import { useIsMobile } from "@/hooks/common";
import { Box } from "@mui/material";
import { Outlet, createFileRoute } from "@tanstack/react-router";

Expand All @@ -10,17 +9,10 @@ export const Route = createFileRoute("/_authenticated/_dashboard")({
});

function DashboardLayout() {
const isMobile = useIsMobile();

return (
<div>
<BreadcrumbNav />
<Box
height={"calc(100vh - 88px)"}
width={isMobile ? "100%" : `calc(100vw)`}
flexDirection={"row"}
display={"flex"}
>
<Box height={"calc(100vh - 88px)"} flexDirection={"row"} display={"flex"}>
<SideNavBar />
<Outlet />
</Box>
Expand Down

0 comments on commit c1d177f

Please sign in to comment.