import { AdminNav } from "@/components/AdminNav";
import { requireAdmin } from "@/lib/auth";
import type { Locale } from "@/i18n/routing";
import type { ReactNode } from "react";

type Props = {
  children: ReactNode;
  params: Promise<{ locale: string }>;
};

export default async function ProtectedAdminLayout({ children, params }: Props) {
  const { locale } = await params;
  await requireAdmin(locale as Locale);

  return (
    <div className="min-h-[60vh]">
      <AdminNav />
      <div className="mx-auto max-w-6xl px-4 py-10 md:px-6">{children}</div>
    </div>
  );
}
