import { SidebarContent, SidebarHeader, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarMenuSub, } from "../components/ui/sidebar"; import { ChevronDown, BookOpen, Home, Target, Zap, Trophy, Map, SquareLibrary, ListIcon, } from "lucide-react"; import { useState } from "react"; import logo from "../assets/ed_logo1.png"; import { NavLink, useNavigate, useLocation } from "react-router-dom"; import { useAuthStore } from "../stores/authStore"; import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar"; export function AppSidebar() { const [open, setOpen] = useState(false); const user = useAuthStore((s) => s.user); const navigate = useNavigate(); const location = useLocation(); const isQuestPage = location.pathname.startsWith("/student/quests"); const STYLES = ` /* ══ DEFAULT sidebar (cream frosted glass) ══ */ .as-sidebar-container { position: fixed; top: 0.5rem; bottom: 0.5rem; left: 0.5rem; width: 16rem; z-index: 10; border-radius: 1.75rem; overflow: hidden; pointer-events: auto; background: rgba(255,251,244,0.72); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); border: 1.5px solid rgba(255,255,255,0.7); box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.8); transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, z-index 0.3s ease; display: flex; flex-direction: column; height: calc(100vh - 1rem); } /* ══ QUEST mode sidebar (dark navy pirate + gold) ══ */ .as-sidebar-container.quest-mode { background: linear-gradient( 180deg, rgba(251,191,36,0.12) 0%, rgba(251,191,36,0.08) 50%, rgba(251,191,36,0.1) 100% ); background-size: 100% 200%; animation: asSweepDown 3s linear infinite; border-color: rgba(251,191,36,0.28); box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.08); } /* Shimmer animation from top to bottom */ @keyframes asSweepDown { 0% { background-position: 0% 200%; } 100% { background-position: 0% -200%; } } /* On quest page, sidebar stays visible above content */ .as-sidebar-container.quest-mode { z-index: 40; } .as-sidebar-inner { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; } .as-gradient-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 0; } .as-gradient-overlay.default { background: radial-gradient( circle at top, rgba(168,85,247,0.18), transparent 55% ), radial-gradient( circle at bottom, rgba(249,115,22,0.1), transparent 55% ); } .as-gradient-overlay.quest { background: transparent; } /* Ensure Sidebar sub-components are transparent */ .as-sidebar-inner > * { background: transparent; } .as-sidebar-inner [class*="SidebarHeader"], .as-sidebar-inner [class*="SidebarContent"], .as-sidebar-inner [class*="SidebarFooter"], .as-sidebar-inner [class*="SidebarGroup"], .as-sidebar-inner [class*="SidebarMenu"] { background: transparent; } /* Quest mode text visibility */ .as-sidebar-container.quest-mode [class*="SidebarGroupLabel"] { color: rgba(255, 255, 255, 0.4) !important; } .as-sidebar-container.quest-mode a { color: rgba(255, 255, 255, 0.6) !important; background: transparent !important; } .as-sidebar-container.quest-mode a:hover { color: rgba(255, 255, 255, 0.85) !important; background: rgba(255, 255, 255, 0.08) !important; } .as-sidebar-container.quest-mode a.active { color: #fbbf24 !important; } .as-sidebar-container.quest-mode span { color: inherit; } /* Quest header text */ .as-sidebar-container.quest-mode .text-slate-900 { color: rgba(255, 255, 255, 0.9) !important; } .as-sidebar-container.quest-mode .text-slate-400 { color: rgba(255, 255, 255, 0.4) !important; } /* Quest mode removes white hover background from menu buttons */ .as-sidebar-container.quest-mode [class*="SidebarMenuButton"]:hover { background: transparent !important; } .as-sidebar-container.quest-mode [class*="SidebarMenuButton"] { background: transparent !important; } /* Prevent group-hover from adding white background in quest mode */ .as-sidebar-container.quest-mode .group:hover { background: transparent !important; } /* Quest mode footer button styling */ .as-sidebar-container.quest-mode [class*="SidebarFooter"] button { background: rgba(255, 255, 255, 0.08) !important; --tw-ring-color: rgba(255, 255, 255, 0.05) !important; border-color: rgba(255, 255, 255, 0.05) !important; } .as-sidebar-container.quest-mode [class*="SidebarFooter"] button:hover { background: rgba(255, 255, 255, 0.12) !important; } /* Override Tailwind bg-white and ring classes for quest mode */ .as-sidebar-container.quest-mode button[class*="bg-white"] { background-color: rgba(255, 255, 255, 0.08) !important; } .as-sidebar-container.quest-mode button[class*="ring-white"]:not(:hover) { --tw-ring-color: rgba(255, 255, 255, 0.05) !important; border-color: rgba(255, 255, 255, 0.05) !important; } .as-sidebar-container.quest-mode button:hover[class*="hover:bg-white"] { background-color: rgba(255, 255, 255, 0.12) !important; } .as-sidebar-container.quest-mode a:hover { --tw-ring-color: rgba(255, 255, 255, 0.05) !important; } `; return ( <>