Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions app/components/kern/common/KernMissingDataList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { NavItem } from "../navigation/types";

type KernMissingDataListProps = { navItems: NavItem[]; shouldRender?: boolean };

export const KernMissingDataList = ({
navItems,
shouldRender,
}: KernMissingDataListProps) => {
if (!shouldRender) return null;
const navItemsWithWarnings = navItems
.filter((navItem) => navItem.state === "Warning")
.flatMap((navItem) =>
navItem.subflows
? navItem.subflows
.filter((subNavItem) => subNavItem.state === "Warning")
.map((subNavItem) => ({
...subNavItem,
label: `${navItem.label}: ${subNavItem.label}`,
}))
: navItem,
);
return (
<ul>
{navItemsWithWarnings.flatMap((navItem) => (
<li key={navItem.destination}>
<a href={navItem.destination} className="kern-link">
{navItem.label}
</a>
</li>
))}
</ul>
);
};
4 changes: 2 additions & 2 deletions app/routes/shared/components/kern/KernFormFlowPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Grid } from "~/components/layout/grid/Grid";
import { GridItem } from "~/components/layout/grid/GridItem";
import AutoGeneratedSummary from "~/components/content/autoGeneratedSummary/AutoGeneratedSummary";
import { FlowStepperNavigation } from "~/components/navigation/FlowStepperNavigation";
import { MissingDataList } from "~/components/common/MissingDataList";
import { NavigationList } from "~/components/kern/navigation/NavigationList";
import SideNavMobile from "~/components/kern/navigation/SideNavMobile";
import { KernReportProblem } from "~/components/kern/KernReportProblem";
Expand All @@ -19,6 +18,7 @@ import KernValidatedFlowForm from "~/components/kernFormElements/KernValidatedFo
import { type loader } from "../../formular";
import KernHeading from "~/components/kern/KernHeading";
import ContentComponents from "~/components/content/ContentComponents";
import { KernMissingDataList } from "~/components/kern/common/KernMissingDataList";

export function KernFormFlowPage() {
const {
Expand Down Expand Up @@ -112,7 +112,7 @@ export function KernFormFlowPage() {
showKernUX={showKernUX}
managedByParent
/>
<MissingDataList
<KernMissingDataList
// Renders a list of menu entries with missing data on pages that have triggerValidation / expandAll set to true
// This is a temporary workaround until this functionality is implemented into the summary page
navItems={navigationProps.navItems}
Expand Down