Files
juanitosport/app/admin/admin-layout.tsx
T

61 lines
1.9 KiB
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import Header from "@/components/Header";
const adminLinks = [
{ href: "/admin", label: "Vue d'ensemble", icon: "🏠" },
{ href: "/admin/users", label: "Membres", icon: "👥" },
{ href: "/admin/messages", label: "Messages", icon: "💬" },
{ href: "/admin/media", label: "Photos & vidéos", icon: "🎬" },
{ href: "/admin/homework", label: "Exercices", icon: "🏋️" },
{ href: "/admin/certificates", label: "Certificats", icon: "📄" },
{ href: "/admin/yoga", label: "Gestion Yoga", icon: "🧘" },
];
export default function AdminLayout({
children,
}: {
children: React.ReactNode;
}) {
const pathname = usePathname();
return (
<main className="min-h-screen pb-20">
<Header />
<div className="mx-auto max-w-3xl px-4 py-6">
<h1 className="mb-1 text-2xl font-extrabold">
⚙️ Tableau de bord Juanito
</h1>
<p className="mb-5 text-sm text-white/60">
Gère ton club JuanitoSport
</p>
<nav className="mb-6 flex gap-2 overflow-x-auto pb-2 -mx-4 px-4">
{adminLinks.map((link) => {
const active =
pathname === link.href ||
(link.href !== "/admin" && pathname.startsWith(link.href));
return (
<Link
key={link.href}
href={link.href}
className={`flex shrink-0 items-center gap-1.5 rounded-xl px-4 py-2 text-sm font-semibold transition-colors ${
active
? "bg-primary-600 text-white"
: "bg-white/5 text-white/70 hover:bg-white/10"
}`}
>
<span>{link.icon}</span>
<span>{link.label}</span>
</Link>
);
})}
</nav>
{children}
</div>
</main>
);
}