'use client' import React from 'react' import { Incident, IncidentSeverity, INCIDENT_SEVERITY_INFO, INCIDENT_STATUS_INFO, INCIDENT_CATEGORY_INFO, is72hDeadlineExpired } from '@/lib/sdk/incidents/types' import { CountdownTimer } from './CountdownTimer' function Badge({ bgColor, color, label }: { bgColor: string; color: string; label: string }) { return {label} } export function IncidentCard({ incident, onClick }: { incident: Incident; onClick?: () => void }) { const severityInfo = INCIDENT_SEVERITY_INFO[incident.severity] const statusInfo = INCIDENT_STATUS_INFO[incident.status] const categoryInfo = INCIDENT_CATEGORY_INFO[incident.category] const expired = is72hDeadlineExpired(incident.detectedAt) const isNotified = incident.authorityNotification && (incident.authorityNotification.status === 'submitted' || incident.authorityNotification.status === 'acknowledged') const severityBorderColors: Record = { critical: 'border-red-300 hover:border-red-400', high: 'border-orange-300 hover:border-orange-400', medium: 'border-yellow-300 hover:border-yellow-400', low: 'border-green-200 hover:border-green-300' } const borderColor = incident.status === 'closed' ? 'border-green-200 hover:border-green-300' : expired && !isNotified ? 'border-red-400 hover:border-red-500' : severityBorderColors[incident.severity] const measuresCount = incident.measures.length const completedMeasures = incident.measures.filter(m => m.status === 'completed').length return (
{/* Header Badges */}
{incident.referenceNumber}
{/* Title */}

{incident.title}

{incident.description}

{/* 72h Countdown - prominent */}
{/* Right Side - Key Numbers */}
Betroffene
{incident.estimatedAffectedPersons.toLocaleString('de-DE')}
{new Date(incident.detectedAt).toLocaleDateString('de-DE')}
{/* Footer */}
{completedMeasures}/{measuresCount} Massnahmen {incident.timeline.length} Eintraege
{incident.assignedTo ? `Zugewiesen: ${incident.assignedTo}` : 'Nicht zugewiesen' } {incident.status !== 'closed' ? ( Bearbeiten ) : ( Details )}
) }