'use client'; import React from 'react'; import { SafeAuditEvent, OperationsRole } from './types'; interface OperationsAuditProps { role: OperationsRole; events: SafeAuditEvent[]; nextCursor?: string | null; onNextPage?: () => Promise | void; isLoading?: boolean; isLoadingMore?: boolean; total?: number; } export function OperationsAudit({ role, events, nextCursor, onNextPage, isLoading = false, isLoadingMore = false, total, }: OperationsAuditProps) { const isOwner = role === 'owner'; // Section 7: Operator Denied Access UX if (!isOwner) { return (
lock
Access Restricted

Owner Authority Required

You do not have authority to view Audit. Audit log inspection is restricted to verified Operations Owners.

Current Role: {role}
); } return (
{/* Header Row */}
Governance & Compliance

Audit Activity

Immutable operational and security activity log across platform boundaries.

{total !== undefined && (
Recorded Events {total.toLocaleString()}
)}
{/* Audit Activity Table Container */}
{isLoading ? ( // Skeleton loading state Array.from({ length: 5 }).map((_, index) => ( )) ) : events.length === 0 ? ( ) : ( events.map((event, index) => { const formattedTime = new Date(event.timestamp).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit', }); const isSuccess = event.result.toLowerCase() === 'success' || event.result.toLowerCase() === 'recorded'; const isFailure = event.result.toLowerCase() === 'failure' || event.result.toLowerCase() === 'denied'; return ( {/* TIME */} {/* ACTION */} {/* RESULT */} {/* ACTOR (Current Operations Identity) */} {/* TARGET */} {/* CASE */} ); }) )}
Time Action Result Actor Target Case
inbox

No audit events recorded.

{event.action} {event.reason_code && ( reason: {event.reason_code} )}
{event.result}
{event.actor_identity} {event.actor_role && ( Role: {event.actor_role} )}
{event.target_resource || '--'} {event.case_reference || '--'}
{/* Server Cursor Bounded Pagination */} {nextCursor && (
Displaying bounded result set
)}
); }