64 lines
2 KiB
TypeScript
64 lines
2 KiB
TypeScript
"use client"
|
|
|
|
import Link from "next/link"
|
|
import { usePathname } from "next/navigation"
|
|
import { cn } from "@/lib/utils"
|
|
import { Button } from "@/components/ui/button"
|
|
import { LayoutDashboard, MessageSquare, ShieldAlert, Users } from "lucide-react"
|
|
|
|
export default function AdminLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode
|
|
}) {
|
|
const pathname = usePathname()
|
|
|
|
const navItems = [
|
|
{
|
|
title: "Dashboard",
|
|
href: "/admin",
|
|
icon: LayoutDashboard
|
|
},
|
|
{
|
|
title: "Nicknames",
|
|
href: "/admin/nicknames",
|
|
icon: MessageSquare
|
|
},
|
|
{
|
|
title: "Reports",
|
|
href: "/admin/reports",
|
|
icon: ShieldAlert
|
|
},
|
|
{
|
|
title: "Users",
|
|
href: "/admin/users",
|
|
icon: Users
|
|
}
|
|
]
|
|
|
|
return (
|
|
<div className="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0">
|
|
<aside className="-mx-4 lg:w-1/5">
|
|
<nav className="flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1">
|
|
{navItems.map((item) => (
|
|
<Link
|
|
key={item.href}
|
|
href={item.href}
|
|
>
|
|
<span
|
|
className={cn(
|
|
"group flex items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground",
|
|
pathname === item.href ? "bg-accent" : "transparent"
|
|
)}
|
|
>
|
|
<item.icon className="mr-2 h-4 w-4" />
|
|
<span>{item.title}</span>
|
|
</span>
|
|
</Link>
|
|
))}
|
|
</nav>
|
|
</aside>
|
|
<div className="flex-1 lg:max-w-4xl">{children}</div>
|
|
</div>
|
|
)
|
|
}
|