'use client' import React, { useState, useEffect } from 'react' import { useParams } from 'next/navigation' interface MonitoringEvent { id: string event_type: 'incident' | 'update' | 'drift_alert' | 'regulation_change' title: string description: string severity: 'low' | 'medium' | 'high' | 'critical' status: 'open' | 'investigating' | 'resolved' | 'closed' created_at: string resolved_at: string | null resolved_by: string | null resolution_notes: string | null } const EVENT_TYPE_CONFIG: Record = { incident: { label: 'Vorfall', color: 'text-red-700', bgColor: 'bg-red-100', icon: '🚨', }, update: { label: 'Update', color: 'text-blue-700', bgColor: 'bg-blue-100', icon: '🔄', }, drift_alert: { label: 'Drift-Warnung', color: 'text-orange-700', bgColor: 'bg-orange-100', icon: '📉', }, regulation_change: { label: 'Regulierungsaenderung', color: 'text-purple-700', bgColor: 'bg-purple-100', icon: '📜', }, } const SEVERITY_CONFIG: Record = { low: { label: 'Niedrig', color: 'bg-green-100 text-green-700' }, medium: { label: 'Mittel', color: 'bg-yellow-100 text-yellow-700' }, high: { label: 'Hoch', color: 'bg-orange-100 text-orange-700' }, critical: { label: 'Kritisch', color: 'bg-red-100 text-red-700' }, } const STATUS_CONFIG: Record = { open: { label: 'Offen', color: 'bg-red-100 text-red-700' }, investigating: { label: 'In Untersuchung', color: 'bg-yellow-100 text-yellow-700' }, resolved: { label: 'Geloest', color: 'bg-green-100 text-green-700' }, closed: { label: 'Geschlossen', color: 'bg-gray-100 text-gray-700' }, } function EventTypeBadge({ type }: { type: string }) { const config = EVENT_TYPE_CONFIG[type] || EVENT_TYPE_CONFIG.incident return ( {config.icon} {config.label} ) } function SeverityBadge({ severity }: { severity: string }) { const config = SEVERITY_CONFIG[severity] || SEVERITY_CONFIG.low return ( {config.label} ) } function StatusBadge({ status }: { status: string }) { const config = STATUS_CONFIG[status] || STATUS_CONFIG.open return ( {config.label} ) } interface EventFormData { event_type: string title: string description: string severity: string } function EventForm({ onSubmit, onCancel, }: { onSubmit: (data: EventFormData) => void onCancel: () => void }) { const [formData, setFormData] = useState({ event_type: 'incident', title: '', description: '', severity: 'medium', }) return (

Neues Monitoring-Ereignis

setFormData({ ...formData, title: e.target.value })} placeholder="z.B. KI-Modell Drift erkannt" className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent dark:bg-gray-700 dark:border-gray-600 dark:text-white" />