'use client' /** * ArchitectureView - Shows backend modules and their connection status * * This component helps track which backend modules are connected to the frontend * during migration and ensures no modules get lost. */ import { useState } from 'react' import Link from 'next/link' import { MODULE_REGISTRY, getModulesByCategory, getModuleStats, getCategoryStats, type BackendModule } from '@/lib/module-registry' interface ArchitectureViewProps { category?: BackendModule['category'] showAllCategories?: boolean } const STATUS_CONFIG = { connected: { label: 'Verbunden', color: 'bg-green-100 text-green-700 border-green-200', dot: 'bg-green-500' }, partial: { label: 'Teilweise', color: 'bg-yellow-100 text-yellow-700 border-yellow-200', dot: 'bg-yellow-500' }, 'not-connected': { label: 'Nicht verbunden', color: 'bg-red-100 text-red-700 border-red-200', dot: 'bg-red-500' }, deprecated: { label: 'Veraltet', color: 'bg-slate-100 text-slate-700 border-slate-200', dot: 'bg-slate-500' } } const PRIORITY_CONFIG = { critical: { label: 'Kritisch', color: 'text-red-600' }, high: { label: 'Hoch', color: 'text-orange-600' }, medium: { label: 'Mittel', color: 'text-yellow-600' }, low: { label: 'Niedrig', color: 'text-slate-600' } } const CATEGORY_CONFIG: Record = { compliance: { name: 'DSGVO & Compliance', icon: 'shield', color: 'purple' }, ai: { name: 'KI & Automatisierung', icon: 'brain', color: 'teal' }, infrastructure: { name: 'Infrastruktur & DevOps', icon: 'server', color: 'orange' }, education: { name: 'Bildung & Schule', icon: 'graduation', color: 'blue' }, communication: { name: 'Kommunikation & Alerts', icon: 'mail', color: 'green' }, development: { name: 'Entwicklung & Produkte', icon: 'code', color: 'slate' } } export function ArchitectureView({ category, showAllCategories = false }: ArchitectureViewProps) { const [expandedModule, setExpandedModule] = useState(null) const [filterStatus, setFilterStatus] = useState('all') const modules = category && !showAllCategories ? getModulesByCategory(category) : MODULE_REGISTRY const filteredModules = filterStatus === 'all' ? modules : modules.filter(m => m.frontend.status === filterStatus) const stats = category && !showAllCategories ? getCategoryStats(category) : getModuleStats() return (
{/* Stats Overview */}

Migrations-Fortschritt {category && !showAllCategories && ( - {CATEGORY_CONFIG[category].name} )}

{stats.percentComplete}%
{/* Progress Bar */}
{/* Status Counts */}
{stats.connected}
Verbunden
{stats.partial}
Teilweise
{stats.notConnected}
Nicht verbunden
{stats.total}
Gesamt
{/* Filter */}
Filter:
{/* Module List */}
{filteredModules.map((module) => (
{/* Module Header */} {/* Module Details */} {expandedModule === module.id && (
{/* Backend Info */}

Backend

Service: {module.backend.service}
Port: {module.backend.port}
Base Path: {module.backend.basePath}
Endpoints
{module.backend.endpoints.map((ep, idx) => (
{ep.method} {ep.path} - {ep.description}
))}
{/* Frontend Info */}

Frontend

Admin v2 Seite: {module.frontend.adminV2Page ? ( {module.frontend.adminV2Page} ) : ( Noch nicht angelegt )}
Altes Admin (Referenz): {module.frontend.oldAdminPage ? ( {module.frontend.oldAdminPage} ) : ( - )}
{module.notes && (
{module.notes}
)} {module.dependencies && module.dependencies.length > 0 && (
Abhaengigkeiten:
{module.dependencies.map((dep) => ( {dep} ))}
)}
)}
))}
{/* Category Summary (if showing all) */} {showAllCategories && (

Kategorie-Uebersicht

{(Object.keys(CATEGORY_CONFIG) as BackendModule['category'][]).map((cat) => { const catStats = getCategoryStats(cat) return (
{CATEGORY_CONFIG[cat].name} {catStats.percentComplete}%
50 ? 'bg-yellow-500' : 'bg-red-500' }`} style={{ width: `${catStats.percentComplete}%` }} />
{catStats.connected}/{catStats.total} verbunden {catStats.notConnected > 0 && ( {catStats.notConnected} offen )}
) })}
)}
) }