"use client" import { useState, useEffect } from "react" import Link from "next/link" import { usePathname } from "next/navigation" import { Home, List, User, Users } from "lucide-react" export function BottomNav() { const pathname = usePathname() const [matchEnabled, setMatchEnabled] = useState(false) const [configLoaded, setConfigLoaded] = useState(false) useEffect(() => { const loadConfig = async () => { try { const res = await fetch('/api/db/config') const data = await res.json() if (data.features) { setMatchEnabled(data.features.matchEnabled === true) } } catch (e) { setMatchEnabled(false) } finally { setConfigLoaded(true) } } loadConfig() }, []) if ( pathname?.startsWith("/view/documentation") || pathname?.startsWith("/admin") || pathname?.startsWith("/view/read") || pathname?.startsWith("/view/about") ) { return null } const navItems = [ { href: "/view", icon: Home, label: "首页" }, { href: "/view/chapters", icon: List, label: "目录" }, ...(matchEnabled ? [{ href: "/view/match", icon: Users, label: "找伙伴", isCenter: true }] : []), { href: "/view/my", icon: User, label: "我的" }, ] return ( <> ) }