38 lines
1.0 KiB
TypeScript
38 lines
1.0 KiB
TypeScript
import { getSessionUser } from "@/lib/session";
|
|
import { getTranslations } from "next-intl/server";
|
|
import { redirect } from "next/navigation";
|
|
import { listTenants } from "@/lib/k8s";
|
|
import { AdminPanel } from "@/components/admin/admin-panel";
|
|
|
|
export default async function AdminPage() {
|
|
const user = await getSessionUser();
|
|
if (!user) redirect("/login");
|
|
|
|
const t = await getTranslations("admin");
|
|
|
|
if (!user.isPlatform) {
|
|
return (
|
|
<div className="flex items-center justify-center min-h-[40vh]">
|
|
<p className="text-error text-sm">{t("noAccess")}</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const tenants = await listTenants();
|
|
|
|
return (
|
|
<div>
|
|
<div className="mb-8 animate-in">
|
|
<h1 className="font-display text-2xl font-semibold accent-rule mb-2">
|
|
{t("title")}
|
|
</h1>
|
|
<p className="text-text-secondary text-sm mt-4">{t("subtitle")}</p>
|
|
</div>
|
|
|
|
<div className="animate-in animate-in-delay-1">
|
|
<AdminPanel initialTenants={tenants} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|