"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { LayoutDashboard, BrainCircuit, User, MoreHorizontal, Castle, BookOpen, Lightbulb, Puzzle, Swords, Wand2, Code2, BarChart3, Settings, X, MessageSquare, } from "lucide-react"; import { useState, useEffect } from "react"; import { motion, AnimatePresence } from "framer-motion"; type TabItem = { href: string; label: string; icon: React.ReactNode; color: string; }; // Primary tabs shown in the bottom bar (most used) const PRIMARY_TABS: TabItem[] = [ { href: "/", label: "Home", icon: , color: "rgba(255,255,255,0.87)", }, { href: "/feynman", label: "Feynman", icon: , color: "var(--color-feynman)", }, { href: "/coach", label: "Coach", icon: , color: "#6366f1", }, { href: "/profile", label: "Profile", icon: , color: "rgba(255,255,255,0.87)", }, { href: "__more__", label: "More", icon: , color: "rgba(255,255,255,0.7)", }, ]; // All nav items for the "More" sheet const ALL_ITEMS: TabItem[] = [ { href: "/chess", label: "Chess", icon: , color: "var(--color-chess)", }, { href: "/reading", label: "Deep Reading", icon: , color: "var(--color-reading)", }, { href: "/logic", label: "Logic Puzzles", icon: , color: "var(--color-logic)", }, { href: "/critical-thinking", label: "Critical Thinking", icon: , color: "var(--color-critical-thinking)", }, { href: "/quests", label: "Skill Quests", icon: , color: "var(--color-quests)", }, { href: "/coding", label: "Coding Training", icon: , color: "var(--color-coding)", }, { href: "/debate", label: "Debate Arena", icon: , color: "var(--color-critical-thinking)", }, { href: "/stats", label: "Stats", icon: , color: "rgba(255,255,255,0.7)", }, { href: "/settings", label: "Settings", icon: , color: "rgba(255,255,255,0.7)", }, ]; export function BottomTabNav() { const pathname = usePathname(); const [moreOpen, setMoreOpen] = useState(false); // Close sheet on route change — setState here is intentional: // dismiss the "More" drawer whenever the user navigates to a new route. useEffect(() => { setMoreOpen(false); // eslint-disable-line react-hooks/set-state-in-effect }, [pathname]); // Prevent body scroll when sheet is open useEffect(() => { if (moreOpen) { document.body.style.overflow = "hidden"; } else { document.body.style.overflow = ""; } return () => { document.body.style.overflow = ""; }; }, [moreOpen]); const isMoreActive = ALL_ITEMS.some((item) => pathname.startsWith(item.href) ); return ( <> {/* Bottom tab bar */} {/* "More" bottom sheet — slides up from bottom */} {moreOpen && ( <> {/* Backdrop */} setMoreOpen(false)} aria-hidden /> {/* Sheet */} {/* Handle */}

Exercises & More

{ALL_ITEMS.map((item) => { const isActive = pathname.startsWith(item.href); return ( {item.icon} {item.label} ); })}
)} ); }