From b2096fd3458a630fe46cd210f572f38ff1a06eae Mon Sep 17 00:00:00 2001 From: Christopher Chiche Date: Mon, 11 Sep 2023 16:31:36 +0200 Subject: [PATCH] Cleanup tables --- reports/src/ThemeContext.tsx | 30 +++++------ reports/src/capability/CapabilityTable.tsx | 14 +++-- .../src/capability/CapabilityTableHeader.tsx | 37 ++----------- .../src/capability/ChildCapabilityTable.tsx | 50 +++++++++++------ reports/src/capability/RequirementTable.tsx | 53 +++++++++++-------- reports/src/capability/reportNavigation.tsx | 4 +- 6 files changed, 93 insertions(+), 95 deletions(-) diff --git a/reports/src/ThemeContext.tsx b/reports/src/ThemeContext.tsx index 0a9f1bb..ac16ba7 100644 --- a/reports/src/ThemeContext.tsx +++ b/reports/src/ThemeContext.tsx @@ -71,21 +71,21 @@ export const CustomThemeProvider = ({ ? theme.palette.grey[100] : theme.palette.grey[900], }, - table: { - borderCollapse: "collapse", - border: `1px solid ${borderColor}`, - }, - th: { - border: `1px solid ${borderColor}`, - backgroundColor: - theme.palette.mode === "light" - ? theme.palette.grey[300] - : theme.palette.grey[800], - }, - td: { - border: `1px solid ${borderColor}`, - padding: 8, - }, + // table: { + // borderCollapse: "collapse", + // border: `1px solid ${borderColor}`, + // }, + // th: { + // border: `1px solid ${borderColor}`, + // backgroundColor: + // theme.palette.mode === "light" + // ? theme.palette.grey[300] + // : theme.palette.grey[800], + // }, + // td: { + // border: `1px solid ${borderColor}`, + // padding: 8, + // }, }; }; diff --git a/reports/src/capability/CapabilityTable.tsx b/reports/src/capability/CapabilityTable.tsx index 9a36b8a..999d61a 100644 --- a/reports/src/capability/CapabilityTable.tsx +++ b/reports/src/capability/CapabilityTable.tsx @@ -1,7 +1,7 @@ import { Box, Breadcrumbs, Typography } from "@mui/material"; import { Capability } from "./capabilityTypes"; import { useMatches } from "react-router-dom"; -import { ReactNode } from "react"; +import { Fragment, ReactNode } from "react"; import { Report } from "./capabilityTypes"; import { CapabilityTableHeader } from "./CapabilityTableHeader"; import { RequirementTable } from "./RequirementTable"; @@ -14,17 +14,21 @@ type CapabilityTableProps = { type CrumbHandle = { crumb: () => ReactNode }; -function CapabilityBreadcrumbs() { +function CapabilityBreadcrumbs({ capability }: { capability: Capability }) { const matches = useMatches(); - const crumbs = matches + const parentCrumbs = matches // first get rid of any matches that don't have handle and crumb .filter((match) => Boolean((match.handle as CrumbHandle | undefined)?.crumb) ) .slice(0, -1) // Skip last crumb - .map((match) => (match.handle as CrumbHandle).crumb()) + .map((match, i) => (match.handle as CrumbHandle).crumb(i)) .reverse(); + const here = {capability.name}; + const crumbs = [here, ...parentCrumbs]; + console.log(crumbs); + return {crumbs}; } @@ -50,7 +54,7 @@ export const CapabilityTable = ({ paddingTop: 10, }} > - + Requirements diff --git a/reports/src/capability/CapabilityTableHeader.tsx b/reports/src/capability/CapabilityTableHeader.tsx index ca5f3b2..5c0268e 100644 --- a/reports/src/capability/CapabilityTableHeader.tsx +++ b/reports/src/capability/CapabilityTableHeader.tsx @@ -35,50 +35,19 @@ export const CapabilityTableHeader = ({ navigate(`/${id}`); }; return ( - + {report.name} - {capability.name} - ({ - color: theme.palette.primary.contrastText, - bgColor: theme.palette.primary.main, - })} - > - ({ - color: theme.palette.primary.contrastText, - "&.Mui-focused": { - color: theme.palette.primary.contrastText, - }, - })} - > - USSP - + + USSP