49 lines
1.5 KiB
TypeScript
49 lines
1.5 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 flex items-end justify-between gap-4 flex-wrap">
|
|
<div>
|
|
<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>
|
|
{/* Sub-tools: links to other admin pages. Plain links rather
|
|
than nav-shell entries — these are platform-team utilities,
|
|
not main navigation. */}
|
|
<a
|
|
href="/admin/openclaw"
|
|
className="text-sm px-4 py-2 rounded-lg border border-border text-text-secondary hover:text-text-primary hover:border-text-secondary transition-colors"
|
|
>
|
|
{t("openclawTool")}
|
|
</a>
|
|
</div>
|
|
|
|
<div className="animate-in animate-in-delay-1">
|
|
<AdminPanel initialTenants={tenants} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|