45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
|
|
import { redirect } from "next/navigation";
|
||
|
|
|
||
|
|
import { getCurrentUser } from "@/lib/auth/session";
|
||
|
|
|
||
|
|
export const dynamic = "force-dynamic";
|
||
|
|
|
||
|
|
export default async function AdminLayout({
|
||
|
|
children,
|
||
|
|
}: {
|
||
|
|
children: React.ReactNode;
|
||
|
|
}) {
|
||
|
|
const user = await getCurrentUser();
|
||
|
|
if (!user || !user.is_admin) {
|
||
|
|
redirect("/dashboard");
|
||
|
|
}
|
||
|
|
return (
|
||
|
|
<div className="min-h-screen bg-[#0c0e1a] text-gray-200">
|
||
|
|
<nav className="border-b border-[#1e2235] bg-[#0f1120] px-6 py-3">
|
||
|
|
<div className="mx-auto flex max-w-7xl items-center gap-6">
|
||
|
|
<span className="text-sm font-semibold text-white">FlatRender Admin</span>
|
||
|
|
<a
|
||
|
|
href="/admin/nodes"
|
||
|
|
className="text-sm text-gray-400 hover:text-white transition-colors"
|
||
|
|
>
|
||
|
|
Nodes
|
||
|
|
</a>
|
||
|
|
<a
|
||
|
|
href="/admin/renders"
|
||
|
|
className="text-sm text-gray-400 hover:text-white transition-colors"
|
||
|
|
>
|
||
|
|
Render Queue
|
||
|
|
</a>
|
||
|
|
<a
|
||
|
|
href="/dashboard"
|
||
|
|
className="ml-auto text-xs text-gray-500 hover:text-gray-300 transition-colors"
|
||
|
|
>
|
||
|
|
← Back to Dashboard
|
||
|
|
</a>
|
||
|
|
</div>
|
||
|
|
</nav>
|
||
|
|
<main className="mx-auto max-w-7xl px-6 py-8">{children}</main>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|