theme.typography.h6.fontSize,
- fontWeight: "medium",
- color: "text.disabled",
-
- "& .MuiBreadcrumbs-ol": {
- userSelect: "none",
- flexWrap: "nowrap",
- whiteSpace: "nowrap",
- },
- "& .MuiBreadcrumbs-li": { display: "flex" },
- },
- ...spreadSx(sx),
- ]}
- >
- {/* Section name */}
- {section && (
-
- {section}
-
- )}
-
- {breadcrumbs.map((crumb: string, index) => {
- // If it’s the first breadcrumb, show with specific style
- const crumbProps = {
- key: index,
- variant: "h6",
- component: index === 0 ? "h1" : "div",
- color:
- index === breadcrumbs.length - 1 ? "textPrimary" : "textSecondary",
- } as const;
-
- // If it’s the last crumb, just show the label without linking
- if (index === breadcrumbs.length - 1)
- return (
-
-
- {getLabel(crumb) || crumb.replace(/([A-Z])/g, " $1")}
-
- {crumb === tableSettings.id && tableSettings.readOnly && (
-
-
-
- )}
-
- {crumb === tableSettings.id && tableSettings.description && (
-
-
-
- }
- buttonLabel="Table info"
- tooltipProps={{
- componentsProps: {
- popper: { sx: { zIndex: "appBar" } },
- tooltip: { sx: { maxWidth: "75vw" } },
- } as any,
- }}
- defaultOpen={!dismissed.includes(tableSettings.id)}
- onClose={() =>
- setDismissed((d) => uniq([...d, tableSettings.id]))
- }
- />
- )}
-
- );
-
- // If odd: breadcrumb points to a document — link to rowRef
- // FUTURE: show a picker here to switch between sub tables
- if (index % 2 === 1)
- return (
-
- {getLabel(
- parentLabel.split(",")[Math.ceil(index / 2) - 1] || crumb
- )}
-
- );
-
- // Otherwise, even: breadcrumb points to a Firestore collection
- return (
-
- {getLabel(crumb) || crumb.replace(/([A-Z])/g, " $1")}
-
- );
- })}
-
- );
-}
diff --git a/src/components/Table/BreadcrumbsSubTable.tsx b/src/components/Table/BreadcrumbsSubTable.tsx
new file mode 100644
index 00000000..dd2583ee
--- /dev/null
+++ b/src/components/Table/BreadcrumbsSubTable.tsx
@@ -0,0 +1,92 @@
+import { useAtom } from "jotai";
+import { Link as RouterLink, useSearchParams } from "react-router-dom";
+import { camelCase } from "lodash-es";
+
+import { Stack, Breadcrumbs, Link, Typography, Tooltip } from "@mui/material";
+import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
+import ReadOnlyIcon from "@mui/icons-material/EditOffOutlined";
+
+import { globalScope, userRolesAtom } from "@src/atoms/globalScope";
+import { ROUTES } from "@src/constants/routes";
+import { TableSettings } from "@src/types/table";
+
+export interface IBreadcrumbsSubTableProps {
+ rootTableSettings: TableSettings;
+ subTableSettings: TableSettings;
+ rootTableLink: string;
+ parentLabel?: string;
+}
+
+export default function BreadcrumbsSubTable({
+ rootTableSettings,
+ subTableSettings,
+ rootTableLink,
+ parentLabel,
+}: IBreadcrumbsSubTableProps) {
+ const [userRoles] = useAtom(userRolesAtom, globalScope);
+ const [searchParams] = useSearchParams();
+ const splitSubTableId = subTableSettings.id.split("/");
+
+ return (
+