'use client'; import { Icon } from '@/components/ui/Icon'; import { cn } from '@/lib/utils'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import React, { useEffect, useState } from 'react'; interface SidebarProps { isOpen?: boolean; onClose?: () => void; } export const Sidebar: React.FC = ({ isOpen = false, onClose, }) => { const pathname = usePathname(); const navigation = [ { group: 'Monitoring', items: [ { name: 'Dashboard', href: '/vcon/dashboard', icon: 'LayoutDashboard' }, { name: 'Live Data Sync', href: '/vcon/data', icon: 'Activity', badge: 'Live' }, ], }, { group: 'Data', items: [ { name: 'CSV Exporter', href: '/vcon/export', icon: 'Download' }, { name: 'CSV Storage & Disk', href: '/vcon/storage', icon: 'HardDrive' }, ], }, { group: 'Administration', items: [ { name: 'Client SDKs', href: '/vcon/clients', icon: 'Key' }, { name: 'Engine Settings', href: '/vcon/settings', icon: 'Sliders' }, ], }, { group: 'Developer Tools', items: [ { name: 'Python SDK Guide', href: '/vcon/sdk', icon: 'FileCode2' }, { name: 'Live Simulator', href: '/vcon/simulator', icon: 'Play' }, ], }, ]; const activeGroup = navigation.find((section) => section.items.some((item) => item.href === pathname) )?.group; const [openGroup, setOpenGroup] = useState(activeGroup ?? navigation[0].group); useEffect(() => { if (activeGroup) setOpenGroup(activeGroup); }, [activeGroup]); return ( <> {/* Mobile Backdrop */} {isOpen && (
)} {/* Sidebar Container */} ); }; export default Sidebar;