'use client' import React from 'react' import Link from 'next/link' import { useSDK, SDK_PACKAGES, getStepsForPackage } from '@/lib/sdk' import { CustomerTypeSelector } from '@/components/sdk/CustomerTypeSelector' import type { CustomerType, 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, }: { pkg: (typeof SDK_PACKAGES)[number] completion: number stepsCount: number isLocked: boolean }) { const steps = getStepsForPackage(pkg.id) const firstStep = steps[0] const href = firstStep?.url || '/sdk' const content = (
{isLocked ? ( ) : completion === 100 ? ( ) : ( pkg.icon )}
{pkg.order}.

{pkg.name}

{pkg.description}

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

Ergebnis: {pkg.result}

)}
) if (isLocked) { return content } return ( {content} ) } function QuickActionCard({ title, description, icon, href, color, }: { title: string description: string icon: React.ReactNode href: string color: string }) { return (
{icon}

{title}

{description}

) } // ============================================================================= // MAIN DASHBOARD // ============================================================================= export default function SDKDashboard() { const { state, packageCompletion, completionPercentage, setCustomerType } = useSDK() // Calculate total steps const totalSteps = SDK_PACKAGES.reduce((sum, pkg) => { const steps = getStepsForPackage(pkg.id) // Filter import step for new customers return sum + steps.filter(s => !(s.id === 'import' && state.customerType === 'new')).length }, 0) // Calculate stats 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 // Check if previous package is complete const prevPkg = SDK_PACKAGES.find(p => p.order === pkg.order - 1) if (!prevPkg) return false return packageCompletion[prevPkg.id] < 100 } // Show customer type selector if not set if (!state.customerType) { return (
{ setCustomerType(type) }} />
) } return (
{/* Header */}

AI Compliance SDK

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

{/* 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 */} {state.customerType === 'existing' && state.importedDocuments.length === 0 && (
📄

Bestehende Dokumente importieren

Laden Sie Ihre vorhandenen Compliance-Dokumente hoch. Unsere KI analysiert sie und zeigt Ihnen, welche Erweiterungen fuer KI-Compliance 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' && state.customerType === 'new')) return ( ) })}
{/* Quick Actions */}

Schnellaktionen

} href="/sdk/advisory-board" color="bg-purple-50" /> } href="/sdk/screening" color="bg-red-50" /> } href="/sdk/dsfa" color="bg-blue-50" /> } href="/sdk/rag" color="bg-green-50" />
{/* 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}
))}
)}
) }