import React from 'react' import { useTranslation } from '../../i18n' import { RefreshCw, ClipboardList, Loader2 } from 'lucide-react' import { fs } from '../shared/DialogShell' import { SETTINGS_BUTTON, SettingsCard, SettingsHint, StatusPill } from '../Settings/settingsKit' import { useAuditLog } from './useAuditLog' interface AuditLogPanelProps { serverTimezone?: string } const TH = 'whitespace-nowrap px-3.5 py-2.5 text-start font-geist font-bold uppercase tracking-[.08em] text-content-faint' const TD = 'px-3.5 py-2.5 align-top' const CODE = 'font-geist tabular-nums' export default function AuditLogPanel({ serverTimezone }: AuditLogPanelProps): React.ReactElement { const { t } = useTranslation() const { entries, total, loading, loadFirstPage, loadMore, fmtTime, fmtDetails, userLabel } = useAuditLog(serverTimezone) let body: React.ReactNode if (loading && entries.length === 0) { body = (
| {t('admin.audit.col.time')} | {t('admin.audit.col.user')} | {t('admin.audit.col.action')} | {t('admin.audit.col.resource')} | {t('admin.audit.col.ip')} | {t('admin.audit.col.details')} |
|---|---|---|---|---|---|
| {fmtTime(e.created_at)} | {/* A table cell ignores max-width under auto layout, so the box inside truncates. */} {userLabel(e)} | {e.action} | {e.resource || '—'} | {e.ip || '—'} | {fmtDetails(e.details)} |