import { Link, useLocation } from "wouter"; import { LayoutDashboard, Users, Calendar, Settings, FileCheck, Shield, CreditCard, FolderOpen, Database, FileText, Cloud, Phone, Activity, ClipboardList, LayoutGrid, ListChecks, Pill, Microscope, ChevronDown, ChevronRight, UserCog, User, ShieldCheck, Stethoscope, Workflow, Bot, Clock, Building2, Timer, BookOpen, } from "lucide-react"; import { cn } from "@/lib/utils"; import { useMemo, useState, useEffect } from "react"; import { useSidebar } from "@/components/ui/sidebar"; import { useAuth } from "@/hooks/use-auth"; type NavChild = { name: string; path: string; icon: React.ReactNode; adminOnly?: boolean; groupLabel?: string; // renders a group heading before this item }; type NavItem = { name: string; path: string; icon: React.ReactNode; adminOnly?: boolean; children?: NavChild[]; }; export function Sidebar() { const [location] = useLocation(); const { state, openMobile, setOpenMobile } = useSidebar(); const { user } = useAuth(); const isAdmin = user?.username === "admin"; const [expandedPaths, setExpandedPaths] = useState>(() => { const s = new Set(); if (location.startsWith("/chart")) s.add("/chart"); if (location.startsWith("/settings")) s.add("/settings"); return s; }); useEffect(() => { if (location.startsWith("/chart")) { setExpandedPaths((prev) => new Set([...prev, "/chart"])); } if (location.startsWith("/settings")) { setExpandedPaths((prev) => new Set([...prev, "/settings"])); } }, [location]); const togglePath = (path: string) => { setExpandedPaths((prev) => { const next = new Set(prev); if (next.has(path)) next.delete(path); else next.add(path); return next; }); }; const navItems: NavItem[] = useMemo( () => [ { name: "Dashboard", path: "/dashboard", icon: , }, { name: "Patient Connection", path: "/patient-connection", icon: , }, { name: "Schedule", path: "/appointments", icon: , }, { name: "Patient Management", path: "/patients", icon: , }, { name: "Chart", path: "/chart", icon: , children: [ { name: "Charting Map", path: "/chart/charting", icon: , }, { name: "Treatment Plan", path: "/chart/treatment-plan", icon: , }, { name: "Prescription", path: "/chart/prescription", icon: , }, { name: "Lab Management", path: "/chart/lab-management", icon: , }, ], }, { name: "Insurance Eligibility", path: "/insurance-status", icon: , }, { name: "Claims/PreAuth", path: "/claims", icon: , }, { name: "Accounts/Payments", path: "/payments", icon: , }, { name: "Documents", path: "/documents", icon: , }, { name: "Reports", path: "/reports", icon: , }, { name: "Cloud storage", path: "/cloud-storage", icon: , }, { name: "Database Management", path: "/database-management", icon: , adminOnly: true, }, { name: "Job Monitor", path: "/job-monitor", icon: , adminOnly: true, }, { name: "Settings", path: "/settings", icon: , adminOnly: true, children: [ // ── General ────────────────────────────────────────── { groupLabel: "General", name: "Staff Management", path: "/settings/staff", icon: , }, { name: "Manage Users", path: "/settings/users", icon: , adminOnly: true, }, { name: "Account Settings", path: "/settings/account", icon: , }, { name: "Insurance Credentials", path: "/settings/credentials", icon: , }, { name: "NPI Providers", path: "/settings/npi", icon: , }, { name: "Program Bridge", path: "/settings/programs", icon: , }, // ── Advanced ───────────────────────────────────────── { groupLabel: "Advanced", name: "Office Hours", path: "/settings/officehours", icon: , }, { name: "Office Contact", path: "/settings/officecontact", icon: , }, { name: "Insurance/Transportation Contact", path: "/settings/insurancecontact", icon: , }, { name: "Procedure Duration/Time Slot", path: "/settings/proceduretimeslot", icon: , }, { name: "Twilio Settings", path: "/settings/twilio", icon: , }, { name: "Google AI Settings", path: "/settings/ai", icon: , }, { name: "AI Chat Settings", path: "/settings/aichat", icon: , }, ], }, ], [] ); return (
); }