Skip to content

Commit

Permalink
[Content] Do not show the model as a breadcrumb item when in multipag…
Browse files Browse the repository at this point in the history
…e table view (#2861)

Resolves #2829 

### Demo


https://github.com/user-attachments/assets/24cb4229-e209-460e-a765-639e7cbc7a24

---------

Co-authored-by: Stuart Runyan <shrunyan@gmail.com>
  • Loading branch information
finnar-bin and shrunyan authored Jul 23, 2024
1 parent 8d30954 commit 4d91e56
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/apps/content-editor/src/app/components/ContentBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
useGetContentNavItemsQuery,
} from "../../../../../shell/services/instance";
import { Home } from "@zesty-io/material";
import { useHistory, useParams } from "react-router";
import { useHistory, useParams, useLocation } from "react-router";
import { useMemo } from "react";
import { ContentNavItem } from "../../../../../shell/services/types";
import { MODEL_ICON } from "../../../../../shell/constants";
Expand All @@ -18,8 +18,12 @@ export const ContentBreadcrumbs = () => {
itemZUID: string;
}>();
const history = useHistory();
const location = useLocation();

const breadcrumbData = useMemo(() => {
const isInMultipageTableView = !["new", "import"].includes(
location?.pathname?.split("/")?.pop()
);
let activeItem: ContentNavItem;
const crumbs = [];

Expand Down Expand Up @@ -52,6 +56,12 @@ export const ContentBreadcrumbs = () => {
parent = null;
}
}

if (!itemZUID && isInMultipageTableView) {
// Remove the model as a breadcrumb item when viewing in multipage table view
crumbs?.pop();
}

return crumbs.map((item) => ({
node: <Breadcrumb contentNavItem={item} />,
onClick: () => {
Expand All @@ -62,7 +72,7 @@ export const ContentBreadcrumbs = () => {
}
},
}));
}, [nav, itemZUID]);
}, [nav, itemZUID, modelZUID, location]);

return (
<CustomBreadcrumbs
Expand Down

0 comments on commit 4d91e56

Please sign in to comment.