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, ShoppingCart, Search, KeyRound, } 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";
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");
if (location.startsWith("/dental-shopping"))
s.add("/dental-shopping");
return s;
});
useEffect(() => {
if (location.startsWith("/chart")) {
setExpandedPaths((prev) => new Set([...prev, "/chart"]));
}
if (location.startsWith("/settings")) {
setExpandedPaths((prev) => new Set([...prev, "/settings"]));
}
if (location.startsWith("/dental-shopping")) {
setExpandedPaths((prev) => new Set([...prev, "/dental-shopping"]));
}
}, [location]);
const togglePath = (path) => {
setExpandedPaths((prev) => {
const next = new Set(prev);
if (next.has(path))
next.delete(path);
else
next.add(path);
return next;
});
};
const navItems = 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: "AI Input Agent",
path: "/ai-input-agent",
icon: ,
},
{
name: "AI Dental Shopping",
path: "/dental-shopping",
icon: ,
children: [
{
name: "Search / Tag",
path: "/dental-shopping/search-tag",
icon: ,
},
{
name: "Login Info",
path: "/dental-shopping/login-info",
icon: ,
},
],
},
{
name: "Activation",
path: "/activation",
icon: ,
adminOnly: true,
},
{
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: "AI API Setting",
path: "/settings/ai",
icon: ,
},
{
name: "AI Chat Settings",
path: "/settings/aichat",
icon: ,
},
],
},
], []);
return (
);
}