2025-05-22 20:42:10 +08:00

62 lines
1.7 KiB
TypeScript

"use client"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { cn } from "@/lib/utils"
import { BookOpen } from "lucide-react"
import { useAuth } from "@/context/auth-context"
export function MainNav() {
const pathname = usePathname()
const { user } = useAuth()
return (
<div className="mr-4 flex">
<Link href="/" className="mr-6 flex items-center space-x-2">
<BookOpen className="h-6 w-6" />
<span className="hidden font-bold sm:inline-block"></span>
</Link>
<nav className="flex items-center space-x-6 text-sm font-medium">
<Link
href="/"
className={cn(
"transition-colors hover:text-foreground/80",
pathname === "/" ? "text-foreground" : "text-foreground/60",
)}
>
</Link>
<Link
href="/books"
className={cn(
"transition-colors hover:text-foreground/80",
pathname?.startsWith("/books") ? "text-foreground" : "text-foreground/60",
)}
>
</Link>
<Link
href="/orders"
className={cn(
"transition-colors hover:text-foreground/80",
pathname?.startsWith("/orders") ? "text-foreground" : "text-foreground/60",
)}
>
</Link>
{user?.isAdmin && (
<Link
href="/admin"
className={cn(
"transition-colors hover:text-foreground/80",
pathname?.startsWith("/admin") ? "text-foreground" : "text-foreground/60",
)}
>
</Link>
)}
</nav>
</div>
)
}