import { FolderKanban, ImageIcon, LayoutDashboard, PlusSquare, ShieldAlert, SwatchBook, Tags, type LucideIcon, } from "lucide-react"; type RootNavigationCopy = { overview: string; maintenance: string; uiKit: string; portfolio: string; media: string; }; export type RootNavItem = { label: string; href: string; icon: LucideIcon; active?: boolean; children?: RootNavItem[]; }; export function getRootNavigation( copy: RootNavigationCopy, active: "overview" | "maintenance" | "ui-kit" | "portfolio" | "media", portfolioChild?: "overview" | "projects" | "new-project" | "categories", ): RootNavItem[] { return [ { label: copy.overview, href: "/root", icon: LayoutDashboard, active: active === "overview", }, { label: copy.maintenance, href: "/root/maintenance", icon: ShieldAlert, active: active === "maintenance", }, { label: copy.uiKit, href: "/root/ui-kit", icon: SwatchBook, active: active === "ui-kit", }, { label: copy.media, href: "/root/media", icon: ImageIcon, active: active === "media", }, { label: copy.portfolio, href: "/root/portfolio", icon: FolderKanban, active: active === "portfolio", children: active === "portfolio" ? [ { label: "Overview", href: "/root/portfolio", icon: LayoutDashboard, active: portfolioChild === "overview", }, { label: "Add Project", href: "/root/portfolio/projects/new", icon: PlusSquare, active: portfolioChild === "new-project", }, { label: "Add Category", href: "/root/portfolio/categories", icon: Tags, active: portfolioChild === "categories", }, { label: "Projects", href: "/root/portfolio/projects", icon: FolderKanban, active: portfolioChild === "projects", }, ].filter((item, index, array) => array.findIndex((entry) => entry.href === item.href) === index) : undefined, }, ]; }