"use client"; import { motion, useReducedMotion } from "framer-motion"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { GearIcon, HomeIcon, PlusIcon } from "@/components/icons"; import { haptic } from "@/lib/haptics"; import { useI18n } from "@/lib/i18n"; import { springSnappy } from "@/lib/motion"; import { openSettings } from "@/lib/ui-events"; import { cn } from "@/lib/utils"; /** * iOS-style bottom tab bar. Rendered on the library and create screens on * phones; hidden on desktop (the header carries the same actions there) and on * the full-screen study feed. * * The active item sits on a sliding pill (shared `layoutId`), and its icon * gives a small bounce when you land on it. */ export function TabBar() { const pathname = usePathname(); const { t } = useI18n(); const reduceMotion = useReducedMotion(); const item = "relative flex flex-1 flex-col items-center justify-center gap-1 py-2 text-[11px] font-medium transition-colors"; const active = "text-[var(--text)]"; const idle = "text-[var(--text-subtle)]"; /** The pill glides between items; hidden under reduced motion. */ const pill = (isActive: boolean) => isActive && !reduceMotion ? ( ) : null; /** Small icon bounce on the item you just selected. */ const icon = (children: React.ReactNode, isActive: boolean, key: string) => ( {children} ); const label = (text: string, isActive: boolean) => ( {text} ); const libraryActive = pathname === "/"; const createActive = pathname === "/create"; return ( ); }