"use client"; import { type LucideIcon } from "lucide-react"; import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, } from "@/src/components/ui/sidebar"; import Link from "next/link"; import { type ReactNode } from "react"; import { cn } from "@/src/utils/tailwind"; import { type RouteGroup } from "@/src/components/layouts/routes"; export type NavMainItem = { title: string; menuNode?: ReactNode; url: string; icon?: LucideIcon; isActive?: boolean; label?: string | ReactNode; newTab?: boolean; items?: { title: string; url: string; isActive?: boolean; newTab?: boolean; }[]; }; function NavItemContent({ item }: { item: NavMainItem }) { return ( <> {item.icon && } {item.title} {item.label && (typeof item.label === "string" ? ( {item.label} ) : ( // ReactNode item.label ))} ); } export function NavMain({ items, }: { items: { grouped: Partial> | null; ungrouped: NavMainItem[]; }; }) { return ( <> {items.ungrouped.map((item) => ( {item.menuNode || ( )} ))} {items.grouped && Object.entries(items.grouped).map(([group, items]) => ( {group} {items.map((item) => ( {item.menuNode || ( )} ))} ))} ); }