48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import Link from "next/link";
|
||
import { requireAdmin } from "@/lib/session";
|
||
|
||
export default async function AdminLayout({ children }: { children: React.ReactNode }) {
|
||
await requireAdmin();
|
||
|
||
const links = [
|
||
{ href: "/admin", label: "داشبورد", icon: "📊" },
|
||
{ href: "/admin/rounds", label: "دورهای بازی", icon: "🏆" },
|
||
{ href: "/admin/quiz", label: "کوییز روزانه", icon: "📋" },
|
||
{ href: "/admin/players", label: "بازیکنان", icon: "⚽" },
|
||
{ href: "/admin/matches", label: "بازیها", icon: "🏟️" },
|
||
{ href: "/admin/scoring", label: "قوانین امتیازدهی", icon: "⚙️" },
|
||
{ href: "/admin/teams", label: "تیمهای فانتزی", icon: "👥" },
|
||
{ href: "/admin/countries", label: "تیمهای ملی", icon: "🌍" },
|
||
{ href: "/admin/users", label: "کاربران", icon: "👤" },
|
||
];
|
||
|
||
return (
|
||
<div className="flex min-h-screen">
|
||
<aside className="w-60 bg-gray-900 text-white flex flex-col">
|
||
<div className="p-5 border-b border-gray-700">
|
||
<h2 className="font-bold text-lg">پنل ادمین</h2>
|
||
<p className="text-gray-400 text-xs mt-1">فانتزی جام جهانی</p>
|
||
</div>
|
||
<nav className="flex-1 p-3 flex flex-col gap-1">
|
||
{links.map((l) => (
|
||
<Link
|
||
key={l.href}
|
||
href={l.href}
|
||
className="flex items-center gap-3 px-4 py-2.5 rounded-xl hover:bg-gray-700 transition text-sm font-medium"
|
||
>
|
||
<span>{l.icon}</span>
|
||
{l.label}
|
||
</Link>
|
||
))}
|
||
</nav>
|
||
<div className="p-4 border-t border-gray-700">
|
||
<Link href="/" className="text-gray-400 text-xs hover:text-white transition">
|
||
← بازگشت به سایت
|
||
</Link>
|
||
</div>
|
||
</aside>
|
||
<main className="flex-1 bg-gray-50 p-8 overflow-auto">{children}</main>
|
||
</div>
|
||
);
|
||
}
|