caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

80 lines
2.3 KiB
TypeScript

"use client";
import { useCallback, useEffect, useState } from "react";
import Link from "next/link";
import { getJson } from "@/components/admin-audit/apiClient";
import { useCurrentRole } from "@/components/org-team/useCurrentRole";
import { AdminNoAccess } from "../_components/AdminNoAccess";
import {
RecentActivityList,
type RecentActivityEntry,
} from "../_components/RecentActivityList";
interface AuditListResponse {
entries: RecentActivityEntry[];
filters: unknown;
}
const LIMIT = 30;
// Admin recent-activity sub-page: the most recent audit-trail actions, drawn
// from the existing /api/audit endpoint. A lighter view than the full log.
export default function AdminActivityPage() {
const { canManage, loading: roleLoading } = useCurrentRole();
const [entries, setEntries] = useState<RecentActivityEntry[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const load = useCallback(async () => {
setLoading(true);
setError(null);
const res = await getJson<AuditListResponse>(
`/api/audit?page=1&limit=${LIMIT}`
);
if (!res.success || !res.data) {
setError(res.error ?? "Failed to load activity.");
setLoading(false);
return;
}
setEntries(res.data.entries);
setLoading(false);
}, []);
useEffect(() => {
if (!roleLoading && canManage) load();
else if (!roleLoading) setLoading(false);
}, [roleLoading, canManage, load]);
if (!roleLoading && !canManage) {
return (
<AdminNoAccess
title="Recent activity"
message="You need an admin or owner role to view recent activity."
/>
);
}
return (
<div>
<div className="flex items-start justify-between">
<div>
<h1 className="text-2xl font-semibold text-ink/80">
Recent activity
</h1>
<p className="mt-1 text-sm text-ink/40">
The {LIMIT} most recent actions across this organization.
</p>
</div>
<Link
href="/console/audit"
className="text-sm text-accent hover:underline shrink-0"
>
Full audit log
</Link>
</div>
<RecentActivityList entries={entries} loading={loading} error={error} />
</div>
);
}