import { useState } from 'react'; import { Link, useLocation } from 'react-router-dom'; import { motion, AnimatePresence } from 'framer-motion'; import { LayoutDashboard, BookOpen, Wrench, Bot, MapPin, Bus, Users, Calendar, MessageSquare, Code2, Trophy, Rocket, LogOut, LogIn, ShieldCheck, ChevronLeft, ChevronRight, GitBranch, X } from 'lucide-react'; import { useAuth } from '@/context/AuthContext'; interface SidebarProps { isOpen: boolean; onToggle: () => void; isCollapsed: boolean; onToggleCollapse: () => void; } interface NavItem { label: string; path: string; icon: any; highlight?: boolean; } interface NavGroup { title: string; items: NavItem[]; } export default function Sidebar({ isOpen, onToggle, isCollapsed, onToggleCollapse, }: SidebarProps) { const location = useLocation(); const { user, isAuthenticated, isVerifiedStudent, loginWithGoogle, logout } = useAuth(); const checkIsActive = (linkPath: string) => { const [pathName, searchString] = linkPath.split('?'); if (location.pathname !== pathName) return false; if (pathName === '/notes') { const params = new URLSearchParams(location.search); const hasToolkit = params.has('toolkit') || params.get('section') === 'toolkit'; if (searchString) { return hasToolkit; } else { return !hasToolkit; } } return true; }; const navGroups: NavGroup[] = [ { title: 'ACADEMICS & PORTAL', items: [ { label: 'Dashboard', path: '/', icon: LayoutDashboard }, { label: 'Notes & PYQs', path: '/notes', icon: BookOpen }, { label: 'Student Toolkit', path: '/notes?section=toolkit', icon: Wrench }, { label: 'RIT Chatbot', path: '/ai-assistant', icon: Bot }, ], }, { title: 'CAMPUS & UTILITIES', items: [ { label: 'Bus Tracker', path: '/bus-routes', icon: Bus }, { label: 'Campus Map', path: '/campus', icon: MapPin }, { label: 'Faculty Directory', path: '/faculty', icon: Users }, { label: 'Student Clubs', path: '/events', icon: Calendar }, ], }, { title: 'COMMUNITY & DEV', items: [ { label: 'Freshers Q&A', path: '/community', icon: MessageSquare }, { label: 'Dev Collab Hub', path: '/collab', icon: Code2, highlight: true }, { label: 'LeetCode Board', path: '/leetcode', icon: Trophy }, { label: 'RAISE Incubator', path: '/raise', icon: Rocket }, ], }, ]; return ( <> {/* Mobile Backdrop Overlay */} {isOpen && ( )} {/* Main Sidebar Container - Sleek Professional Deep Indigo */} ); }