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:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user