RotNot / src /components /sidebar-nav.tsx
deploy
Deploy RotNot
9580dce
Raw History Blame Contribute Delete
3.88 kB
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import {
Brain,
Castle,
BookOpen,
Lightbulb,
Puzzle,
Swords,
Wand2,
Code2,
User,
LayoutDashboard,
Settings,
BarChart3,
BrainCircuit,
MessageSquare,
} from "lucide-react";
type NavItem = {
href: string;
label: string;
icon: React.ReactNode;
color: string;
};
const NAV_ITEMS: NavItem[] = [
{
href: "/",
label: "Dashboard",
icon: <LayoutDashboard size={18} />,
color: "rgba(255,255,255,0.7)",
},
{
href: "/chess",
label: "Chess",
icon: <Castle size={18} />,
color: "var(--color-chess)",
},
{
href: "/reading",
label: "Deep Reading",
icon: <BookOpen size={18} />,
color: "var(--color-reading)",
},
{
href: "/feynman",
label: "Feynman",
icon: <Lightbulb size={18} />,
color: "var(--color-feynman)",
},
{
href: "/logic",
label: "Logic Puzzles",
icon: <Puzzle size={18} />,
color: "var(--color-logic)",
},
{
href: "/critical-thinking",
label: "Critical Thinking",
icon: <Swords size={18} />,
color: "var(--color-critical-thinking)",
},
{
href: "/quests",
label: "Skill Quests",
icon: <Wand2 size={18} />,
color: "var(--color-quests)",
},
{
href: "/coding",
label: "Coding Training",
icon: <Code2 size={18} />,
color: "var(--color-coding)",
},
{
href: "/debate",
label: "Debate Arena",
icon: <MessageSquare size={18} />,
color: "var(--color-critical-thinking)",
},
{
href: "/coach",
label: "Coach",
icon: <BrainCircuit size={18} />,
color: "#6366f1",
},
{
href: "/stats",
label: "Stats",
icon: <BarChart3 size={18} />,
color: "rgba(255,255,255,0.7)",
},
{
href: "/profile",
label: "Profile",
icon: <User size={18} />,
color: "rgba(255,255,255,0.7)",
},
{
href: "/settings",
label: "Settings",
icon: <Settings size={18} />,
color: "rgba(255,255,255,0.7)",
},
];
export function SidebarNav() {
const pathname = usePathname();
return (
<aside
className="hidden md:flex flex-col w-56 min-h-screen shrink-0 border-r"
style={{
background: "var(--surface-1)",
borderColor: "rgba(255,255,255,0.06)",
}}
>
{/* Logo */}
<div className="flex items-center gap-2 px-5 py-5 border-b" style={{ borderColor: "rgba(255,255,255,0.06)" }}>
<Brain size={22} style={{ color: "var(--primary)" }} />
<span className="font-bold text-lg tracking-tight" style={{ fontFamily: "var(--font-mono)" }}>
RotNot
</span>
</div>
{/* Nav items */}
<nav className="flex flex-col gap-0.5 px-3 py-4 flex-1">
{NAV_ITEMS.map((item) => {
const isActive =
item.href === "/"
? pathname === "/"
: pathname.startsWith(item.href);
return (
<Link
key={item.href}
href={item.href}
className="flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-150"
style={{
color: isActive ? item.color : "var(--text-secondary)",
background: isActive
? `color-mix(in srgb, ${item.color} 12%, transparent)`
: "transparent",
}}
>
<span style={{ color: isActive ? item.color : "var(--text-muted)" }}>
{item.icon}
</span>
{item.label}
</Link>
);
})}
</nav>
{/* Footer */}
<div
className="px-5 py-4 border-t text-xs"
style={{ borderColor: "rgba(255,255,255,0.06)", color: "var(--text-muted)" }}
>
Fight brain rot.
</div>
</aside>
);
}