'use client' import React, { useState, useEffect } from 'react' import { useParams, useRouter } from 'next/navigation' import Link from 'next/link' interface ModuleDetail { id: string name: string display_name: string description: string is_active: boolean criticality: string processes_pii: boolean ai_components: boolean compliance_score: number | null regulation_count: number risk_count: number requirements?: Array<{ id: string title: string status: string regulation: string }> controls?: Array<{ id: string title: string status: string description: string }> regulations?: string[] } export default function ModuleDetailPage() { const params = useParams() const router = useRouter() const moduleId = params.moduleId as string const [module, setModule] = useState(null) const [loading, setLoading] = useState(true) const [error, setError] = useState(null) useEffect(() => { async function load() { try { const response = await fetch(`/api/sdk/v1/modules/${encodeURIComponent(moduleId)}`) if (!response.ok) { throw new Error('Modul nicht gefunden') } const data = await response.json() setModule(data) } catch (err) { setError(err instanceof Error ? err.message : 'Fehler beim Laden') } finally { setLoading(false) } } if (moduleId) load() }, [moduleId]) if (loading) { return (
Lade Modul-Details...
) } if (error || !module) { return (

Fehler

{error || 'Modul nicht gefunden'}

Zurueck zur Uebersicht
) } const criticalityColors: Record = { HIGH: 'bg-red-100 text-red-700', MEDIUM: 'bg-yellow-100 text-yellow-700', LOW: 'bg-green-100 text-green-700', } return (
{/* Breadcrumb */}
Module / {module.display_name || module.name}
{/* Header */}

{module.display_name || module.name}

{module.description}

{module.is_active ? 'Aktiv' : 'Inaktiv'} {module.criticality} {module.processes_pii && ( PII )} {module.ai_components && ( KI )}
{/* Stats */}
Compliance Score
{module.compliance_score != null ? `${module.compliance_score}%` : '—'}
Regulierungen
{module.regulation_count || 0}
Risiken
{module.risk_count || 0}
{/* Requirements */} {module.requirements && module.requirements.length > 0 && (

Anforderungen

{module.requirements.map(req => (

{req.title}

{req.regulation}

{req.status}
))}
)} {/* Controls */} {module.controls && module.controls.length > 0 && (

Kontrollen

{module.controls.map(ctrl => (

{ctrl.title}

{ctrl.status}

{ctrl.description}

))}
)} {/* Regulations */} {module.regulations && module.regulations.length > 0 && (

Zugeordnete Regulierungen

{module.regulations.map(reg => ( {reg} ))}
)}
) }