import type { Metadata } from "next"; import { requireAdmin } from "@/lib/auth"; import { getSettings } from "@/lib/settings"; import { prisma } from "@/lib/db"; import { env } from "@/lib/env"; import { AppShell } from "@/components/AppShell"; import { AdminSettings, UserRow } from "@/components/settings/Forms"; import { formatRelative } from "@/lib/labels"; export const metadata: Metadata = { title: "Verwaltung" }; export default async function AdminPage() { const admin = await requireAdmin(); const settings = await getSettings(); const [users, lastRun, catalog] = await Promise.all([ prisma.user.findMany({ orderBy: { createdAt: "asc" }, select: { id: true, name: true, email: true, role: true, isActive: true, _count: { select: { entries: true } }, }, }), prisma.syncRun.findFirst({ orderBy: { startedAt: "desc" } }), Promise.all([ prisma.title.count(), prisma.episode.count(), prisma.watch.count(), ]), ]); const [titleCount, episodeCount, watchCount] = catalog; return (

Verwaltung

Einstellungen der Instanz, Konten und Hintergrundlauf.

Instanz

Zustand

Letzter Abgleich

{lastRun ? (

{formatRelative(lastRun.startedAt)} ·{" "} {lastRun.ok ? "erfolgreich" : "mit Fehlern"} {lastRun.message ? ` · ${lastRun.message}` : ""}

) : (

Noch kein Abgleich gelaufen.

)}

Konten

); } function Fact({ label, value }: { label: string; value: string }) { return (
{label}
{value}
); }