"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { BedDouble, Bell, Building2, ClipboardCheck, Globe2, HeartPulse, LayoutDashboard, ListChecks, Radio, Settings, ShieldAlert, TabletSmartphone, Users, Wrench, } from "lucide-react"; import type { LucideIcon } from "lucide-react"; import type { Permission } from "@/modules/core/types"; import { navGroups, type NavIconKey } from "@/modules/shared/lib/navigation"; import { cn } from "@/lib/utils"; const iconMap: Record = { alerts: Radio, audit: ListChecks, beds: BedDouble, care: ClipboardCheck, dashboard: LayoutDashboard, devices: TabletSmartphone, emergency: ShieldAlert, global: Globe2, health: HeartPulse, notices: Bell, organizations: Building2, roles: Settings, status: Wrench, users: Users, }; type AppSidebarNavProps = { permissions: Permission[]; }; function isActivePath(pathname: string, href: string): boolean { if (href === "/app/dashboard") { return pathname === "/app" || pathname === href; } return pathname === href || pathname.startsWith(`${href}/`); } export function AppSidebarNav({ permissions }: AppSidebarNavProps): React.ReactElement { const pathname = usePathname(); const visibleNavGroups = navGroups .map((group) => ({ ...group, items: group.items.filter((item) => !item.permission || permissions.includes(item.permission)), })) .filter((group) => group.items.length > 0); return ( ); }