import { FolderKanban, Globe2, ImageIcon, LayoutDashboard, Mail, PlusSquare, ShieldAlert, SwatchBook, Tags, Type, type LucideIcon, } from "lucide-react"; type RootNavigationCopy = { overview: string; maintenance: string; uiKit: string; portfolio: string; media: string; siteSettings: string; marquee?: string; smtp?: string; contactProtection?: string; }; export type RootNavItem = { label: string; href: string; icon: LucideIcon; active?: boolean; expanded?: boolean; children?: RootNavItem[]; }; export function getRootNavigation( copy: RootNavigationCopy, active: "overview" | "maintenance" | "ui-kit" | "portfolio" | "media" | "site-settings" | "smtp" | "marquee", smtpChild?: "settings" | "contact-protection", portfolioChild?: "overview" | "projects" | "new-project" | "categories", ): RootNavItem[] { return [ { label: copy.overview, href: "/", icon: LayoutDashboard, active: active === "overview", }, { label: copy.maintenance, href: "/maintenance", icon: ShieldAlert, active: active === "maintenance", }, { label: copy.uiKit, href: "/ui-kit", icon: SwatchBook, active: active === "ui-kit", }, { label: copy.media, href: "/media", icon: ImageIcon, active: active === "media", }, { label: copy.siteSettings, href: "/site-settings", icon: Globe2, active: active === "site-settings", }, { label: copy.marquee ?? "Marquee", href: "/marquee", icon: Type, active: active === "marquee", }, { label: copy.smtp ?? "SMTP", href: "/smtp", icon: Mail, active: active === "smtp" && !smtpChild, expanded: active === "smtp", children: [ { label: copy.smtp ?? "SMTP", href: "/smtp", icon: Mail, active: smtpChild === "settings" || (!smtpChild && active === "smtp"), }, { label: copy.contactProtection ?? "Contact Protection", href: "/smtp/contact-protection", icon: ShieldAlert, active: smtpChild === "contact-protection", }, ], }, { label: copy.portfolio, href: "/portfolio", icon: FolderKanban, active: active === "portfolio" && !portfolioChild, expanded: active === "portfolio", children: [ { label: "Projects", href: "/portfolio", icon: FolderKanban, active: portfolioChild === "overview" || portfolioChild === "projects", }, { label: "Add Project", href: "/portfolio/projects/new", icon: PlusSquare, active: portfolioChild === "new-project", }, { label: "Add Category", href: "/portfolio/categories", icon: Tags, active: portfolioChild === "categories", }, ].filter((item, index, array) => array.findIndex((entry) => entry.href === item.href) === index), }, ]; }