Stage 1: Course/Module/Lesson CRUD admin UI with TipTap editor
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { headers } from "next/headers";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
import { AdminNav } from "@/components/admin/admin-nav";
|
||||
import { LogoutButton } from "@/components/layout/logout-button";
|
||||
|
||||
export default async function AdminLayout({ children }: { children: React.ReactNode }) {
|
||||
const session = await auth.api.getSession({ headers: await headers() });
|
||||
if (!session) redirect("/login");
|
||||
if (session.user.role !== "admin") redirect("/dashboard");
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex bg-slate-50">
|
||||
<aside className="w-56 bg-slate-900 text-white flex flex-col shrink-0 fixed h-full z-10">
|
||||
<div className="px-5 py-5 border-b border-slate-800">
|
||||
<p className="font-bold text-amber-400 text-base">Second Brain</p>
|
||||
<p className="text-xs text-slate-400 mt-0.5">Админ-панель</p>
|
||||
</div>
|
||||
<nav className="flex-1 p-3 space-y-0.5 overflow-y-auto">
|
||||
<AdminNav />
|
||||
</nav>
|
||||
<div className="p-4 border-t border-slate-800">
|
||||
<p className="text-xs text-slate-400 mb-3 truncate">{session.user.name}</p>
|
||||
<LogoutButton />
|
||||
</div>
|
||||
</aside>
|
||||
<div className="ml-56 flex-1 min-h-screen">{children}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user