Fix admin sidebar missing on /curator/* routes

- Extract AdminShell component (sidebar + wrapper)
- admin/layout.tsx uses AdminShell
- curator/layout.tsx uses AdminShell for admin role (was rendering children only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 14:59:51 +05:00
parent ec51dd34bb
commit 97f4c1ec24
3 changed files with 45 additions and 47 deletions
+3 -2
View File
@@ -3,15 +3,16 @@ import { auth } from "@/lib/auth";
import { redirect } from "next/navigation";
import Link from "next/link";
import { LogoutButton } from "@/components/layout/logout-button";
import { AdminShell } from "@/components/admin/admin-shell";
export default async function CuratorLayout({ children }: { children: React.ReactNode }) {
const session = await auth.api.getSession({ headers: await headers() });
if (!session) redirect("/login");
if (session.user.role !== "curator" && session.user.role !== "admin") redirect("/dashboard");
// Admin uses their own layout — render content only
// Admin uses the admin shell with sidebar
if (session.user.role === "admin") {
return <>{children}</>;
return <AdminShell userName={session.user.name}>{children}</AdminShell>;
}
return (