"use client"; /** * SiteBottomNav — mobile-only bottom tab bar. * * Four items: Home (Feed) · Knowledgebase · Search · Account. * Mirrors the Instagram pattern — fixed to the viewport bottom, full * width, equal-width tabs, the active tab uses the primary color. * * Hidden on md+ — desktop uses SiteSidebar. */ import Link from "next/link"; import { usePathname } from "next/navigation"; import { Home, Search, User as UserIcon } from "lucide-react"; import { useAuth } from "@/components/auth/auth-provider"; import { cn } from "@/lib/utils"; type Item = { href: string; label: string; icon: React.ReactNode; matchPrefixes?: string[]; }; export function SiteBottomNav() { const pathname = usePathname(); const { user } = useAuth(); const items: Item[] = [ { href: "/", label: "Home", icon: }, { href: "/search", label: "Search", icon: , // Search is the knowledgebase entry point too — keep the tab lit // while the user is reading anywhere in the library. matchPrefixes: [ "/search", "/books", "/letters", "/transcriptions", "/essays", "/glossary", "/journals", "/magazines", "/other-documents", "/disciples", ], }, { href: user ? "/u/me" : "/login", label: user ? "You" : "Sign in", icon: , matchPrefixes: ["/u/me", "/login", "/signup"], }, ]; function isActive(item: Item): boolean { if (item.matchPrefixes) { return item.matchPrefixes.some((p) => p === "/" ? pathname === "/" : pathname.startsWith(p), ); } if (item.href === "/") return pathname === "/"; return pathname === item.href || pathname.startsWith(`${item.href}/`); } return ( ); }