import { EvidenceGallery } from './evidence-gallery' const TYPE_LABELS: Record = { injury: 'Injury / Medical', near_miss: 'Near Miss', hazard: 'Hazard', asset_damage: 'Asset Damage', environmental: 'Environmental', security: 'Security', fire: 'Fire / Emergency', } const STATUS_COLORS: Record = { reported: 'bg-yellow-100 text-yellow-800', triaged: 'bg-blue-100 text-blue-800', investigating: 'bg-purple-100 text-purple-800', capa_pending: 'bg-orange-100 text-orange-800', verification: 'bg-indigo-100 text-indigo-800', closed: 'bg-green-100 text-green-800', } const MEDICAL_LABELS: Record = { none: 'None', first_aid: 'First Aid', medical_treatment: 'Medical Treatment', lti: 'Lost Time Injury (LTI)', } type Incident = { id: string reference_no: string | null incident_type: string description: string status: string severity: number | null injury_involved: boolean asset_involved: boolean medical_status: string | null lost_days: number | null reported_at: string closed_at: string | null sites: { id: string; name: string } | null zones: { id: string; name: string } | null reporter: { id: string; name: string; email: string } | null evidence_files: Array<{ id: string stage: string file_url: string file_type: string uploaded_at: string }> } interface Props { incident: Incident } function Field({ label, value }: { label: string; value: React.ReactNode }) { return (
{label}
{value ?? '—'}
) } export function IncidentDetail({ incident }: Props) { const reportStageFiles = incident.evidence_files.filter(f => f.stage === 'report') return (

{incident.reference_no ?? 'Pending reference'}

{TYPE_LABELS[incident.incident_type] ?? incident.incident_type}

{incident.status.replace(/_/g, ' ').toUpperCase()}
{incident.injury_involved && ( )} {incident.injury_involved && incident.lost_days != null && ( )}

Description

{incident.description}

Evidence — Report Stage {reportStageFiles.length} file{reportStageFiles.length !== 1 ? 's' : ''}

) }