import { notFound } from "next/navigation"; import { getProject, isSuperadmin, JOURNAL_NOISE, listJournal, listProjects, type ActorChannel, type ActorKind } from "@peppa/core"; import { JournalFilters, JournalList } from "@/components/Accounting"; import { PageHeader } from "@/components/common"; import { Workspace } from "@/components/Workspace"; import { requireUser } from "@/lib/auth"; import { db } from "@/lib/db"; import { getT } from "@/lib/i18n"; /** Superadmin only (PEP-48): who did what — people (web, Telegram, MCP clients, CLI), agents, Peppa. */ export default async function Journal({ searchParams }: { searchParams: Promise<{ project?: string; actor?: string; channel?: string; all?: string }> }) { const me = await requireUser(); if (!(await isSuperadmin(db, me))) notFound(); const t = await getT(); const { project, actor, channel, all } = await searchParams; const projects = await listProjects(db); const p = project ? await getProject(db, project).catch(() => null) : null; const entries = await listJournal(db, { projectId: p?.id ?? (project ? -1 : undefined), actorKind: (actor || undefined) as ActorKind | undefined, channel: (channel || undefined) as ActorChannel | undefined, excludeTypes: all ? undefined : JOURNAL_NOISE, limit: 300, }); return ( {t("Кто что сделал: люди (веб, Telegram, MCP-клиенты, CLI, терминал), агенты и сама FORGE. Новые сверху, последние 300.")} {!all && " " + t("Служебные события хуков скрыты.")}
({ key: x.key, name: x.name }))} value={{ project, actor, channel }} />
); }