'use client' import Link from 'next/link' import type { DashboardData, MappingsData, FindingsData, NextAction } from './types' import { DOMAIN_LABELS } from './types' interface OverviewTabProps { dashboard: DashboardData | null mappings: MappingsData | null findings: FindingsData | null nextActions: NextAction[] evidenceDistribution: { by_confidence: Record four_eyes_pending: number total: number } | null score: number scoreColor: string scoreBgColor: string loadData: () => void regulations: Array<{ id: string; code: string; name: string; regulation_type: string; requirement_count: number }> } export function OverviewTab({ dashboard, mappings, findings, nextActions, evidenceDistribution, score, scoreColor, scoreBgColor, loadData, regulations, }: OverviewTabProps) { return ( <> {/* Quick Actions */}

Schnellzugriff

{[ { href: '/sdk/audit-checklist', icon: 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01', label: 'Audit Checkliste', sub: `${dashboard?.total_requirements || '...'} Anforderungen`, color: 'purple' }, { href: '/sdk/controls', icon: 'M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z', label: 'Controls', sub: `${dashboard?.total_controls || '...'} Massnahmen`, color: 'green' }, { href: '/sdk/evidence', icon: 'M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z', label: 'Evidence', sub: 'Nachweise', color: 'blue' }, { href: '/sdk/risks', icon: 'M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z', label: 'Risk Matrix', sub: '5x5 Risiken', color: 'red' }, { href: '/sdk/process-tasks', icon: 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4', label: 'Prozesse', sub: 'Aufgaben', color: 'indigo' }, { href: '/sdk/audit-report', icon: 'M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z', label: 'Audit Report', sub: 'PDF Export', color: 'orange' }, ].map(item => (

{item.label}

{item.sub}

))}
{/* Score and Stats Row */}

Compliance Score

{score.toFixed(0)}%

{dashboard?.controls_by_status?.pass || 0} von {dashboard?.total_controls || 0} Controls bestanden

{[ { label: 'Verordnungen', value: dashboard?.total_regulations || 0, sub: `${dashboard?.total_requirements || 0} Anforderungen`, iconColor: 'blue', icon: 'M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z' }, { label: 'Controls', value: dashboard?.total_controls || 0, sub: `${dashboard?.controls_by_status?.pass || 0} bestanden`, iconColor: 'green', icon: 'M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z' }, { label: 'Nachweise', value: dashboard?.total_evidence || 0, sub: `${dashboard?.evidence_by_status?.valid || 0} aktiv`, iconColor: 'purple', icon: 'M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z' }, { label: 'Risiken', value: dashboard?.total_risks || 0, sub: `${(dashboard?.risks_by_level?.high || 0) + (dashboard?.risks_by_level?.critical || 0)} kritisch`, iconColor: 'red', icon: 'M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z' }, ].map(stat => (

{stat.label}

{stat.value}

{stat.sub}

))}
{/* Anti-Fake-Evidence Section (Phase 3) */} {dashboard && (

Anti-Fake-Evidence Status

{/* Confidence Distribution Bar */} {evidenceDistribution && evidenceDistribution.total > 0 && (

Confidence-Verteilung ({evidenceDistribution.total} Nachweise)

{(['E0', 'E1', 'E2', 'E3', 'E4'] as const).map(level => { const count = evidenceDistribution.by_confidence[level] || 0 const pct = (count / evidenceDistribution.total) * 100 if (pct === 0) return null const colors: Record = { E0: 'bg-red-400', E1: 'bg-yellow-400', E2: 'bg-blue-400', E3: 'bg-green-400', E4: 'bg-emerald-400' } return (
{pct >= 10 ? `${level} (${count})` : ''}
) })}
{(['E0', 'E1', 'E2', 'E3', 'E4'] as const).map(level => { const count = evidenceDistribution.by_confidence[level] || 0 const dotColors: Record = { E0: 'bg-red-400', E1: 'bg-yellow-400', E2: 'bg-blue-400', E3: 'bg-green-400', E4: 'bg-emerald-400' } return ( {level}: {count} ) })}
)} {/* Multi-Score Dimensions */} {dashboard.multi_score && (

Multi-dimensionaler Score

{([ { key: 'requirement_coverage', label: 'Anforderungsabdeckung', color: 'bg-blue-500' }, { key: 'evidence_strength', label: 'Evidence-Staerke', color: 'bg-green-500' }, { key: 'validation_quality', label: 'Validierungsqualitaet', color: 'bg-purple-500' }, { key: 'evidence_freshness', label: 'Aktualitaet', color: 'bg-yellow-500' }, { key: 'control_effectiveness', label: 'Control-Wirksamkeit', color: 'bg-indigo-500' }, ] as const).map(dim => { const value = (dashboard.multi_score as Record)[dim.key] || 0 return (
{dim.label}
{typeof value === 'number' ? value.toFixed(0) : value}%
) })}
Audit-Readiness
= 80 ? 'bg-green-500' : (dashboard.multi_score.overall_readiness || 0) >= 60 ? 'bg-yellow-500' : 'bg-red-500' }`} style={{ width: `${dashboard.multi_score.overall_readiness || 0}%` }} />
{typeof dashboard.multi_score.overall_readiness === 'number' ? dashboard.multi_score.overall_readiness.toFixed(0) : 0}%
)} {/* Bottom row: Four-Eyes + Hard Blocks */}
{evidenceDistribution?.four_eyes_pending || 0}
Four-Eyes Reviews ausstehend
{dashboard.multi_score?.hard_blocks && dashboard.multi_score.hard_blocks.length > 0 ? (
Hard Blocks ({dashboard.multi_score.hard_blocks.length})
    {dashboard.multi_score.hard_blocks.slice(0, 3).map((block: string, i: number) => (
  • {block}
  • ))}
) : (
0
Keine Hard Blocks
)}
)} {/* Next Actions + Findings */}
{/* Next Actions */}

Naechste Aktionen

{nextActions.length === 0 ? (

Keine offenen Aktionen.

) : (
{nextActions.map(action => (
0 ? 'bg-red-500' : 'bg-yellow-500' }`} />

{action.title}

{action.control_id} · {DOMAIN_LABELS[action.domain] || action.domain} {action.days_overdue > 0 && {action.days_overdue}d ueberfaellig}

{action.status}
))}
)}
{/* Audit Findings */}

Audit Findings

Audit Checkliste →
Hauptabweichungen

{findings?.open_majors || 0}

offen (blockiert Zertifizierung)

Nebenabweichungen

{findings?.open_minors || 0}

offen (erfordert CAPA)

Gesamt: {findings?.total || 0} Findings ({findings?.major_count || 0} Major, {findings?.minor_count || 0} Minor, {findings?.ofi_count || 0} OFI) {(findings?.open_majors || 0) === 0 ? ( Zertifizierung moeglich ) : ( Zertifizierung blockiert )}
{/* Control-Mappings & Domain Chart */}

Control-Mappings

Alle anzeigen →

{mappings?.total || 0}

Mappings gesamt

Nach Verordnung

{mappings?.by_regulation && Object.entries(mappings.by_regulation).slice(0, 5).map(([reg, count]) => ( {reg}: {count} ))} {!mappings?.by_regulation && ( Keine Mappings vorhanden )}

Controls nach Domain

{Object.entries(dashboard?.controls_by_domain || {}).slice(0, 6).map(([domain, stats]) => { const total = stats.total || 0 const pass = stats.pass || 0 const partial = stats.partial || 0 const passPercent = total > 0 ? ((pass + partial * 0.5) / total) * 100 : 0 return (
{DOMAIN_LABELS[domain] || domain}
{passPercent.toFixed(0)}%
) })}
{/* Regulations Table */}

Verordnungen & Standards ({regulations.length})

{regulations.slice(0, 15).map((reg) => ( ))}
Code Name Typ Anforderungen
{reg.code}

{reg.name}

{reg.regulation_type === 'eu_regulation' ? 'EU-VO' : reg.regulation_type === 'eu_directive' ? 'EU-RL' : reg.regulation_type === 'bsi_standard' ? 'BSI' : reg.regulation_type === 'de_law' ? 'DE' : reg.regulation_type} {reg.requirement_count}
) }