'use client' import React, { useState } from 'react' interface GapReport { profile_name: string regulations: Array<{ id: string name: string risk_level: string confidence: number reasoning: string requirements?: string[] }> summary: { total_applicable_regulations: number total_gaps: number gaps_by_status: Record gaps_by_severity: Record overall_compliance_percent: number estimated_effort_weeks: number } gaps: Array<{ mc_id: string mc_name: string regulation: string status: string title: string severity: string priority: { score: number; rank: number } recommendation: string control_count: number }> } interface Props { report: GapReport onBack: () => void } const STATUS_COLORS: Record = { fulfilled: 'bg-green-100 text-green-800', partial: 'bg-yellow-100 text-yellow-800', missing: 'bg-red-100 text-red-800', unclear: 'bg-gray-100 text-gray-800', } const STATUS_LABELS: Record = { fulfilled: 'Erfuellt', partial: 'Teilweise', missing: 'Offen', unclear: 'Unklar', } const SEVERITY_COLORS: Record = { CRITICAL: 'bg-red-600 text-white', HIGH: 'bg-orange-500 text-white', MEDIUM: 'bg-yellow-400 text-gray-900', LOW: 'bg-blue-100 text-blue-800', } export function GapDashboard({ report, onBack }: Props) { const [filterSeverity, setFilterSeverity] = useState('all') const [filterStatus, setFilterStatus] = useState('all') const [expandedGap, setExpandedGap] = useState(null) const filteredGaps = report.gaps.filter(g => { if (filterSeverity !== 'all' && g.severity !== filterSeverity) return false if (filterStatus !== 'all' && g.status !== filterStatus) return false return true }) const s = report.summary return (
{/* Back button */} {/* Summary Cards */}
= 80 ? 'green' : 'orange'} />
{/* Applicable Regulations */}

Anwendbare Regulierungen

{report.regulations.map(reg => (
{reg.name} {reg.risk_level}

{reg.reasoning}

))}
{/* Filters */}
{filteredGaps.length} von {report.gaps.length} Anforderungen
{/* Gap List */}
{filteredGaps.map(gap => ( setExpandedGap(expandedGap === gap.mc_id ? null : gap.mc_id)} > {expandedGap === gap.mc_id && ( )} ))}
# Anforderung Regulierung Status Prioritaet Controls
{gap.priority.rank}
{gap.title}
{gap.mc_name}
{gap.regulation} {STATUS_LABELS[gap.status] || gap.status} {gap.severity} {gap.control_count}

Empfehlung:

{gap.recommendation}

Priority Score: {gap.priority.score.toFixed(1)} | MC: {gap.mc_id}

) } function SummaryCard({ label, value, color }: { label: string; value: string | number; color: string }) { const bg = { blue: 'bg-blue-50 border-blue-200', red: 'bg-red-50 border-red-200', green: 'bg-green-50 border-green-200', orange: 'bg-orange-50 border-orange-200', purple: 'bg-purple-50 border-purple-200', }[color] || 'bg-gray-50 border-gray-200' const text = { blue: 'text-blue-700', red: 'text-red-700', green: 'text-green-700', orange: 'text-orange-700', purple: 'text-purple-700', }[color] || 'text-gray-700' return (

{label}

{value}

) }