"use client"; import { useEffect, useState } from "react"; import { usePathname } from "next/navigation"; import Link from "next/link"; import { Dock, DockIcon } from "@/components/ui/dock"; import { ThemeToggle } from "@/components/theme-toggle"; import { signOut } from "next-auth/react"; import { Home, LogIn, LogOut, Download, BookOpen, LayoutDashboard, Bookmark, } from "lucide-react"; function useIsTouch() { const [touch, setTouch] = useState(false); useEffect(() => { if (typeof window === "undefined") return; const mq = window.matchMedia("(hover: none) and (pointer: coarse)"); const update = () => setTouch(mq.matches); update(); mq.addEventListener?.("change", update); return () => mq.removeEventListener?.("change", update); }, []); return touch; } export function HomeDock({ isAuthenticated, isAdmin, onLoginClick, }: { isAuthenticated: boolean; isAdmin: boolean; onLoginClick?: () => void; }) { const isTouch = useIsTouch(); const pathname = usePathname() || "/"; const isActive = (path: string) => path === "/" ? pathname === "/" : pathname.startsWith(path); return (
{isAuthenticated && ( )} {isAdmin && ( )} {isAuthenticated ? ( ) : ( )}
); } function DockTooltip({ label, children, }: { label: string; children: React.ReactNode; }) { return (
{children} {label}
); } function TooltipBubble({ children }: { children: React.ReactNode }) { return ( {children} ); } function NavLink({ href, label, active, children, }: { href: string; label: string; active: boolean; children: React.ReactNode; }) { return ( {children} {active && ( )} {label} ); } function ExternalNavLink({ href, label, children, }: { href: string; label: string; children: React.ReactNode; }) { return ( {children} {label} ); }