All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 6m21s
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
import { auth } from "@/lib/auth";
|
|
import { Role } from "@/prisma/generated/prisma/client";
|
|
import NavigationWrapper from "@/components/navigation/NavigationWrapper";
|
|
import AdminNavigation from "@/components/admin/AdminNavigation";
|
|
import { SectionTitle } from "@/components/ui";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function AdminLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const session = await auth();
|
|
|
|
if (!session?.user) {
|
|
redirect("/login");
|
|
}
|
|
|
|
if (session.user.role !== Role.ADMIN) {
|
|
redirect("/");
|
|
}
|
|
|
|
return (
|
|
<main className="min-h-screen bg-black relative">
|
|
{/* Background Image */}
|
|
<div
|
|
className="fixed inset-0 bg-cover bg-center bg-no-repeat"
|
|
style={{
|
|
backgroundImage: `url('/got-light.jpg')`,
|
|
}}
|
|
>
|
|
{/* Dark overlay for readability */}
|
|
<div className="absolute inset-0 bg-gradient-to-b from-black/70 via-black/60 to-black/80"></div>
|
|
</div>
|
|
<NavigationWrapper />
|
|
<section className="relative w-full min-h-screen flex flex-col items-center overflow-hidden pt-24 pb-16">
|
|
<div className="relative z-10 w-full max-w-6xl mx-auto px-8 py-16">
|
|
<SectionTitle variant="gradient" size="md" className="mb-16 text-center">
|
|
ADMIN
|
|
</SectionTitle>
|
|
|
|
<AdminNavigation />
|
|
|
|
{children}
|
|
</div>
|
|
</section>
|
|
</main>
|
|
);
|
|
}
|
|
|