'use client' import React from 'react' import Link from 'next/link' import { useSDK, SDK_PACKAGES, getStepsForPackage } from '@/lib/sdk' import { ProjectSelector } from '@/components/sdk/ProjectSelector/ProjectSelector' import { RegulatoryNewsFeed } from '@/components/sdk/regulatory-news/RegulatoryNewsFeed' import { PresetSection } from './_components/PresetSection' import type { SDKPackageId } from '@/lib/sdk/types' // ============================================================================= // DASHBOARD CARDS // ============================================================================= function StatCard({ title, value, subtitle, icon, color }: { title: string; value: string | number; subtitle: string; icon: React.ReactNode; color: string }) { return (

{title}

{value}

{subtitle}

{icon}
) } function PackageCard({ pkg, completion, stepsCount, isLocked, projectId }: { pkg: (typeof SDK_PACKAGES)[number]; completion: number; stepsCount: number; isLocked: boolean; projectId?: string }) { const steps = getStepsForPackage(pkg.id) const firstStep = steps[0] const baseHref = firstStep?.url || '/sdk' const href = projectId ? `${baseHref}?project=${projectId}` : baseHref const content = (
{isLocked ? ( ) : completion === 100 ? ( ) : pkg.icon}
{pkg.order}.

{pkg.name}

{pkg.description}

{stepsCount} Schritte {completion}%
{!isLocked &&

Ergebnis: {pkg.result}

}
) return isLocked ? content : {content} } function QuickActionCard({ title, description, icon, href, color, projectId }: { title: string; description: string; icon: React.ReactNode; href: string; color: string; projectId?: string }) { const finalHref = projectId ? `${href}?project=${projectId}` : href return (
{icon}

{title}

{description}

) } // ============================================================================= // MAIN DASHBOARD // ============================================================================= export default function SDKDashboard() { const { state, packageCompletion, completionPercentage, setCustomerType, projectId } = useSDK() const effectiveCustomerType = state.customerType || 'new' if (!projectId) return const totalSteps = SDK_PACKAGES.reduce((sum, pkg) => { const steps = getStepsForPackage(pkg.id) return sum + steps.filter(s => !(s.id === 'import' && effectiveCustomerType === 'new')).length }, 0) const completedCheckpoints = Object.values(state.checkpoints).filter(cp => cp.passed).length const totalRisks = state.risks.length const criticalRisks = state.risks.filter(r => r.severity === 'CRITICAL' || r.severity === 'HIGH').length const isPackageLocked = (packageId: SDKPackageId): boolean => { if (state.preferences?.allowParallelWork) return false const pkg = SDK_PACKAGES.find(p => p.id === packageId) if (!pkg || pkg.order === 1) return false const prevPkg = SDK_PACKAGES.find(p => p.order === pkg.order - 1) if (!prevPkg) return false return packageCompletion[prevPkg.id] < 100 } return (
{/* Header */}

AI Compliance SDK

{effectiveCustomerType === 'new' ? 'Neukunden-Modus: Erstellen Sie alle Compliance-Dokumente von Grund auf.' : 'Bestandskunden-Modus: Erweitern Sie bestehende Dokumente.'}

{/* Industry Presets with Document Preview */} {/* Applicable Regulations Card */} {state.complianceScope?.decision && (

Erkannte Regulierungen

Basierend auf Ihrem Scope-Profiling (Level {state.complianceScope.decision.level})

Details & Anpassen
{(state.complianceScope.decision.requiredDocuments || []).length > 0 ? ( ['DSGVO', 'AI Act', 'NIS2', 'HinSchG', 'TTDSG'].filter(reg => { const docs = state.complianceScope?.decision?.requiredDocuments || [] const triggers = state.complianceScope?.decision?.hardTriggers || [] if (reg === 'DSGVO') return true if (reg === 'AI Act') return triggers.some((t: string) => t.toLowerCase().includes('ai') || t.toLowerCase().includes('ki')) if (reg === 'NIS2') return triggers.some((t: string) => t.toLowerCase().includes('nis') || t.toLowerCase().includes('kritisch')) if (reg === 'HinSchG') return triggers.some((t: string) => t.toLowerCase().includes('whistleblower') || t.toLowerCase().includes('hinweis')) return false }).map(reg => ( {reg} )) ) : ( DSGVO )}
)} {!state.complianceScope?.decision && (

Scope-Profiling noch nicht abgeschlossen

Fuehren Sie das Scope-Profiling durch um zu erfahren welche Regulierungen fuer Ihr Unternehmen gelten.

)} {/* Stats Grid */}
} color="bg-purple-50" /> } color="bg-blue-50" /> } color="bg-green-50" /> 0 ? `${criticalRisks} kritisch` : 'Keine kritischen'} icon={} color="bg-orange-50" />
{/* Bestandskunden: Gap Analysis Banner */} {effectiveCustomerType === 'existing' && state.importedDocuments.length === 0 && (
📄

Bestehende Dokumente importieren

Laden Sie Ihre vorhandenen Compliance-Dokumente hoch. Unsere KI analysiert sie und zeigt Ihnen, welche Erweiterungen erforderlich sind.

Dokumente hochladen
)} {/* Gap Analysis Results */} {state.gapAnalysis && (
📊

Gap-Analyse Ergebnis

{state.gapAnalysis.totalGaps} Luecken gefunden

{state.gapAnalysis.criticalGaps}
Kritisch
{state.gapAnalysis.highGaps}
Hoch
{state.gapAnalysis.mediumGaps}
Mittel
{state.gapAnalysis.lowGaps}
Niedrig
)} {/* 5 Packages */}

Compliance-Pakete

{SDK_PACKAGES.map(pkg => { const steps = getStepsForPackage(pkg.id) const visibleSteps = steps.filter(s => !(s.id === 'import' && effectiveCustomerType === 'new')) return })}
{/* Quick Actions */}

Schnellaktionen

} href="/sdk/advisory-board" color="bg-purple-50" projectId={projectId} /> } href="/sdk/screening" color="bg-red-50" projectId={projectId} /> } href="/sdk/dsfa" color="bg-blue-50" projectId={projectId} /> } href="/sdk/rag" color="bg-green-50" projectId={projectId} />
{/* Compliance Report Download */}

Compliance-Report

Umfassender PDF-Bericht ueber alle Module, Rollen, Risiken und Massnahmen.

{/* Recent Activity */} {state.commandBarHistory.length > 0 && (

Letzte Aktivitaeten

{state.commandBarHistory.slice(0, 5).map(entry => (
{entry.success ? : }

{entry.query}

{new Date(entry.timestamp).toLocaleString('de-DE')}

{entry.type}
))}
)}
) }