import { useState } from "react"; import { FileText, Search, GitBranch, CheckSquare, AlertTriangle, Target, Layers, Bug, TestTube, Calendar, Milestone, FolderKanban, BookOpen, LayoutDashboard, ChevronDown, ChevronRight, } from "lucide-react"; import { NavLink } from "@/components/NavLink"; import { useLocation } from "react-router-dom"; import { Sidebar, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "@/components/ui/sidebar"; import { cn } from "@/lib/utils"; const mainItems = [ { title: "Dashboard", url: "/", icon: LayoutDashboard }, { title: "Traceability Matrix", url: "/matrix", icon: GitBranch }, { title: "Documentation", url: "/documentation", icon: BookOpen }, { title: "Gap Analysis", url: "/analysis", icon: Search }, ]; const almItems = [ { title: "Features", url: "/alm/feature", icon: Target, type: "feature" }, { title: "Requirements", url: "/alm/requirements", icon: CheckSquare, type: "requirements" }, { title: "SW Requirements", url: "/alm/swreq", icon: FileText, type: "swreq" }, { title: "Test Cases", url: "/alm/test-case", icon: TestTube, type: "test case" }, { title: "Epics", url: "/alm/epic", icon: Layers, type: "epic" }, { title: "User Stories", url: "/alm/user-story", icon: FolderKanban, type: "user story" }, { title: "Tasks", url: "/alm/task", icon: CheckSquare, type: "task" }, { title: "Bugs", url: "/alm/bug", icon: Bug, type: "bug" }, { title: "Risks", url: "/alm/risk", icon: AlertTriangle, type: "risk" }, { title: "Milestones", url: "/alm/milestone", icon: Milestone, type: "milestone" }, { title: "Phases", url: "/alm/phase", icon: Calendar, type: "phase" }, ]; export function AppSidebar() { const { state } = useSidebar(); const collapsed = state === "collapsed"; const location = useLocation(); const currentPath = location.pathname; const [almExpanded, setAlmExpanded] = useState( almItems.some((item) => currentPath.startsWith(item.url)) ); return ( {/* Logo/Header */}
NABD Solutions {!collapsed && (
Traceability ASF Sensor Hub
)}
{/* Main Navigation */} Navigation {mainItems.map((item) => ( {!collapsed && {item.title}} ))} {/* ALM Items */} setAlmExpanded(!almExpanded)} > ALM Traceability {!collapsed && ( almExpanded ? ( ) : ( ) )} {(almExpanded || collapsed) && ( {almItems.map((item) => ( {!collapsed && {item.title}} ))} )}
); }