import type { Metadata } from "next"; import Link from "next/link"; import { ActionForm, SubmitButton } from "@/components/forms"; import { OnlineList } from "@/components/online-list"; import { PageHeader } from "@/components/status"; import { DateTime } from "@/components/time"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { api, unwrap, type AuditEntry } from "@/lib/api"; import { setRegistration } from "./actions"; import { ConsoleNav, requireModerator } from "./console-nav"; export const metadata: Metadata = { title: "Console" }; export default async function Console() { const me = await requireModerator("/console"); const [data, settings] = await Promise.all([api.console.get().then(unwrap), api.console.settings.get().then(unwrap)]); const stats = [ { label: "People", value: data.counts.people, note: "accounts" }, { label: "Waiting", value: data.counts.waiting, note: "for approval", href: "/console/people?waiting=true" }, { label: "IMVU accounts", value: data.counts.links, note: "linked" }, { label: "Computers", value: data.counts.computers, note: "signed in" }, ]; return ( <> Moderation.
{stats.map((s) => ( {s.label} {s.value} {s.href ? ( {s.note} ) : ( s.note )} ))}
Registration {settings.registration === "closed" ? "Closed: new accounts can sign in, but wait for a moderator's approval." : "Open: new accounts can use the hub at once."} {me.role === "admin" && (
Open Closed Set
)}
Online now {data.connections} {data.connections === 1 ? "connection" : "connections"} when the page loaded Audit log The latest 50 changes.
); } function AuditLog({ entries }: { entries: AuditEntry[] }) { if (entries.length === 0) return

Nothing yet.

; return ( When Who What Target Detail {entries.map((e, i) => ( {e.actor || hub} {e.action} {e.target} {Object.entries((e.detail ?? {}) as Record) .map(([k, v]) => `${k}: ${typeof v === "string" ? v : JSON.stringify(v)}`) .join(", ")} ))}
); }