Spaces:
Runtime error
Runtime error
File size: 8,012 Bytes
ca28016 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
"use client";
import React, { useState, useEffect } from "react";
import Link from "next/link";
import { usePathname } from "next/navigation";
import {
PanelLeft, Home, Cpu, Zap, Atom, BarChart3, PlayCircle, Lightbulb,
Replace, Cog, Scaling, Box, Share2, Wrench, BrainCircuit, Globe,
ScatterChart, IterationCw, MessageSquare, Signal, SlidersHorizontal, Monitor, TrendingUp, Wand2, Rocket, ArrowRight, Settings2, ListChecks, Database
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { cn } from "@/lib/utils";
import {
SidebarProvider,
Sidebar,
SidebarHeader,
SidebarContent,
SidebarFooter,
SidebarTrigger,
SidebarInset,
SidebarMenu,
SidebarMenuItem,
SidebarMenuButton,
SidebarGroup,
SidebarGroupLabel,
useSidebar,
} from "@/components/ui/sidebar";
const mainNavItems = [
{ href: "/deep-learning/introduction", label: "Introduction", icon: ArrowRight },
{ href: "/deep-learning/dashboard", label: "Dashboard", icon: Home },
{ href: "/deep-learning/ai-architect", label: "AI Architect", icon: BrainCircuit },
{ href: "/deep-learning/dataset-architect", label: "Dataset Architect", icon: Database },
{ href: "/deep-learning/data-portal", label: "Data Portal", icon: Globe },
{ href: "/deep-learning/train", label: "Train Model", icon: PlayCircle },
{ href: "/deep-learning/my-zpe-ai-models", label: "My ZPE-AI Models", icon: ListChecks },
{ href: "/deep-learning/performance", label: "Performance Analysis", icon: TrendingUp },
{ href: "/deep-learning/gpu-monitor", label: "GPU Monitor", icon: Monitor },
];
const advancedToolsNavItems = [
{ href: "/deep-learning/zpe-flow-analysis", label: "ZPE Flow Analysis", icon: SlidersHorizontal },
{ href: "/deep-learning/zpe-flow", label: "HS-QNN Advisor", icon: BrainCircuit },
{ href: "/deep-learning/quantum-noise", label: "Quantum Noise", icon: Atom },
{ href: "/deep-learning/rf-generator", label: "RF Generator", icon: Signal },
{ href: "/deep-learning/ai-analysis", label: "AI Assistant", icon: MessageSquare },
{ href: "/deep-learning/cloud-gpu", label: "Cloud GPU Connect", icon: Settings2 },
];
const visNavItems = [
{ href: "/deep-learning/vis/bloch-sphere", label: "Bloch Sphere", icon: Globe },
{ href: "/deep-learning/vis/dynamic-formation", label: "Dynamic Formation", icon: IterationCw },
{ href: "/deep-learning/vis/zpe-particle-simulation", label: "ZPE Particle Sim", icon: ScatterChart },
];
const aiFlowsNavItems = [
{ href: "/deep-learning/ai", label: "AI Flows Hub", icon: Rocket },
{ href: "/deep-learning/ai/implement-zpe", label: "Simulate ZPE", icon: Lightbulb },
{ href: "/deep-learning/ai/approximate-zpe", label: "Approximate Flow", icon: Replace },
{ href: "/deep-learning/ai/adapt-zpe", label: "Adapt ZPE", icon: Cog },
{ href: "/deep-learning/ai/show-scaled-output", label: "Scaled Output", icon: Scaling },
{ href: "/deep-learning/ai/quantize-model", label: "Quantize Model", icon: Box },
{ href: "/deep-learning/ai/extract-components", label: "Extract Components", icon: Share2 },
{ href: "/deep-learning/ai/configure-model", label: "Configure Model", icon: Wrench },
{ href: "/deep-learning/ai/invoke-llm", label: "Generic LLM", icon: Wand2 },
];
interface NavItem {
href: string;
label: string;
icon: React.ElementType;
}
const NavLinkWrapper = ({
item,
pathname,
onClick,
}: {
item: NavItem;
pathname: string;
onClick: () => void;
}) => {
const Icon = item.icon;
const isActive =
(pathname === item.href ||
(pathname.startsWith(item.href + "/") &&
item.href !== "/deep-learning/dashboard" &&
item.href !== "/deep-learning" &&
item.href !== "/deep-learning/ai")) ||
(pathname === "/deep-learning" && item.href === "/deep-learning/introduction") ||
(pathname === "/deep-learning/ai" && item.href === "/deep-learning/ai");
return (
<SidebarMenuItem>
<SidebarMenuButton
asChild
isActive={isActive}
tooltip={{ children: item.label, side: "right", align: "center" }}
className="justify-start items-center h-10"
onClick={onClick}
>
<Link href={item.href} className="flex items-center gap-3 w-full">
<div className="flex items-center justify-center w-5 h-5 flex-shrink-0">
<Icon className="h-5 w-5" />
</div>
<span className="group-data-[state=collapsed]:hidden flex-1">{item.label}</span>
</Link>
</SidebarMenuButton>
</SidebarMenuItem>
);
};
const QuantumWeaverSidebarContent = () => {
const pathname = usePathname();
const { isMobile, setOpenMobile } = useSidebar();
const handleLinkClick = () => {
if (isMobile) {
setOpenMobile(false);
}
};
const renderNavSection = (title: string, items: NavItem[]) => (
<SidebarGroup>
<SidebarGroupLabel>{title}</SidebarGroupLabel>
<SidebarMenu>
{items.map((item) => (
<NavLinkWrapper
key={item.href}
item={item}
pathname={pathname}
onClick={handleLinkClick}
/>
))}
</SidebarMenu>
</SidebarGroup>
);
return (
<>
<SidebarHeader>
<Link href="/deep-learning/dashboard" className="flex items-center gap-3 text-xl font-bold text-primary h-12 px-2" onClick={handleLinkClick}>
<div className="flex items-center justify-center w-7 h-7 flex-shrink-0">
<Zap className="h-7 w-7" />
</div>
<span className="group-data-[state=collapsed]:hidden">Quantum Weaver</span>
</Link>
{/* Back to Aether AI button */}
<div className="pt-2 border-t border-border/40">
<Link href="/" className="flex items-center gap-3 text-sm text-muted-foreground hover:text-primary transition-colors h-10 px-2" onClick={handleLinkClick}>
<div className="flex items-center justify-center w-5 h-5 flex-shrink-0">
<ArrowRight className="h-4 w-4 rotate-180" />
</div>
<span className="group-data-[state=collapsed]:hidden">Back to Aether AI</span>
</Link>
</div>
</SidebarHeader>
<SidebarContent className="flex-1 overflow-y-auto p-0">
<ScrollArea className="h-full px-2 py-0">
{renderNavSection("Main", mainNavItems)}
{renderNavSection("Advanced Tools", advancedToolsNavItems)}
{renderNavSection("Visualizations", visNavItems)}
{renderNavSection("AI Flows", aiFlowsNavItems)}
</ScrollArea>
</SidebarContent>
<SidebarFooter>
{/* DEEP LEARNING PLATFORM - NO LIGHT MODE SUPPORT */}
{/* Theme toggle completely removed - dark mode only */}
<div className="px-2 py-2">
<div className="text-xs text-muted-foreground text-center">
Dark Mode Only
</div>
</div>
</SidebarFooter>
</>
);
};
export default function QuantumWeaverLayout({ children }: { children: React.ReactNode }) {
useEffect(() => {
// DOUBLE PROTECTION: Force dark mode for deep learning platform
const enforceDarkMode = () => {
document.documentElement.classList.add("dark");
document.documentElement.classList.remove("light");
document.documentElement.setAttribute("data-theme", "dark");
localStorage.setItem("theme", "dark");
document.body.classList.add("dark");
document.body.style.colorScheme = "dark";
};
enforceDarkMode();
// Continuous enforcement
const interval = setInterval(enforceDarkMode, 100);
return () => clearInterval(interval);
}, []);
return (
<SidebarProvider>
<div className="flex min-h-screen w-full">
<Sidebar className="z-40">
<QuantumWeaverSidebarContent />
</Sidebar>
<main className="flex-1 min-h-screen bg-black/95 relative">
{children}
</main>
</div>
</SidebarProvider>
);
} |