All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 32s
CI / test-python-backend-compliance (push) Successful in 31s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 19s
Kaputtes (admin) Layout geloescht (Role-Selection, 404-Sidebar, localhost-Dashboard). SDK-Flow nach /sdk/sdk-flow verschoben. Route-Gruppe (sdk) aufgeloest. Root-Seite redirected auf /sdk. ~25 ungenutzte Dateien/Verzeichnisse entfernt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
596 lines
22 KiB
TypeScript
596 lines
22 KiB
TypeScript
'use client'
|
|
|
|
import React, { useState, useEffect } from 'react'
|
|
import { useRouter } from 'next/navigation'
|
|
import { useSDK, ServiceModule } from '@/lib/sdk'
|
|
import { StepHeader, STEP_EXPLANATIONS } from '@/components/sdk/StepHeader'
|
|
|
|
// =============================================================================
|
|
// TYPES
|
|
// =============================================================================
|
|
|
|
type ModuleCategory = 'gdpr' | 'ai-act' | 'iso27001' | 'nis2' | 'custom'
|
|
type ModuleStatus = 'active' | 'inactive' | 'pending'
|
|
|
|
interface DisplayModule extends ServiceModule {
|
|
category: ModuleCategory
|
|
status: ModuleStatus
|
|
requirementsCount: number
|
|
controlsCount: number
|
|
completionPercent: number
|
|
}
|
|
|
|
interface BackendModule {
|
|
id: string
|
|
name: string
|
|
display_name: string
|
|
description: string
|
|
service_type: string | null
|
|
processes_pii: boolean
|
|
ai_components: boolean
|
|
criticality: string
|
|
is_active: boolean
|
|
compliance_score: number | null
|
|
regulation_count: number
|
|
risk_count: number
|
|
}
|
|
|
|
// =============================================================================
|
|
// FALLBACK MODULES (used when backend is unavailable)
|
|
// =============================================================================
|
|
|
|
const fallbackModules: Omit<DisplayModule, 'status' | 'completionPercent'>[] = [
|
|
{
|
|
id: 'mod-gdpr',
|
|
name: 'DSGVO Compliance',
|
|
description: 'Datenschutz-Grundverordnung - Vollstaendige Umsetzung aller Anforderungen',
|
|
category: 'gdpr',
|
|
regulations: ['DSGVO', 'BDSG'],
|
|
criticality: 'HIGH',
|
|
processesPersonalData: true,
|
|
hasAIComponents: false,
|
|
requirementsCount: 45,
|
|
controlsCount: 32,
|
|
},
|
|
{
|
|
id: 'mod-ai-act',
|
|
name: 'AI Act Compliance',
|
|
description: 'EU AI Act - Klassifizierung und Anforderungen fuer KI-Systeme',
|
|
category: 'ai-act',
|
|
regulations: ['EU AI Act'],
|
|
criticality: 'HIGH',
|
|
processesPersonalData: false,
|
|
hasAIComponents: true,
|
|
requirementsCount: 28,
|
|
controlsCount: 18,
|
|
},
|
|
{
|
|
id: 'mod-iso27001',
|
|
name: 'ISO 27001',
|
|
description: 'Informationssicherheits-Managementsystem nach ISO/IEC 27001',
|
|
category: 'iso27001',
|
|
regulations: ['ISO 27001', 'ISO 27002'],
|
|
criticality: 'MEDIUM',
|
|
processesPersonalData: false,
|
|
hasAIComponents: false,
|
|
requirementsCount: 114,
|
|
controlsCount: 93,
|
|
},
|
|
{
|
|
id: 'mod-nis2',
|
|
name: 'NIS2 Richtlinie',
|
|
description: 'Netz- und Informationssicherheit fuer kritische Infrastrukturen',
|
|
category: 'nis2',
|
|
regulations: ['NIS2'],
|
|
criticality: 'HIGH',
|
|
processesPersonalData: false,
|
|
hasAIComponents: false,
|
|
requirementsCount: 36,
|
|
controlsCount: 24,
|
|
},
|
|
]
|
|
|
|
// =============================================================================
|
|
// HELPERS
|
|
// =============================================================================
|
|
|
|
function categorizeModule(name: string): ModuleCategory {
|
|
const lower = name.toLowerCase()
|
|
if (lower.includes('dsgvo') || lower.includes('gdpr') || lower.includes('datenschutz')) return 'gdpr'
|
|
if (lower.includes('ai act') || lower.includes('ki-verordnung')) return 'ai-act'
|
|
if (lower.includes('iso 27001') || lower.includes('iso27001') || lower.includes('isms')) return 'iso27001'
|
|
if (lower.includes('nis2') || lower.includes('netz- und informations')) return 'nis2'
|
|
return 'custom'
|
|
}
|
|
|
|
function mapBackendToDisplay(m: BackendModule): Omit<DisplayModule, 'status' | 'completionPercent'> {
|
|
return {
|
|
id: m.id,
|
|
name: m.display_name || m.name,
|
|
description: m.description || '',
|
|
category: categorizeModule(m.display_name || m.name),
|
|
regulations: [],
|
|
criticality: (m.criticality || 'MEDIUM').toUpperCase(),
|
|
processesPersonalData: m.processes_pii,
|
|
hasAIComponents: m.ai_components,
|
|
requirementsCount: m.regulation_count || 0,
|
|
controlsCount: m.risk_count || 0,
|
|
}
|
|
}
|
|
|
|
// =============================================================================
|
|
// COMPONENTS
|
|
// =============================================================================
|
|
|
|
function ModuleCard({
|
|
module,
|
|
isActive,
|
|
onActivate,
|
|
onDeactivate,
|
|
onConfigure,
|
|
}: {
|
|
module: DisplayModule
|
|
isActive: boolean
|
|
onActivate: () => void
|
|
onDeactivate: () => void
|
|
onConfigure: () => void
|
|
}) {
|
|
const categoryColors = {
|
|
gdpr: 'bg-blue-100 text-blue-700',
|
|
'ai-act': 'bg-purple-100 text-purple-700',
|
|
iso27001: 'bg-green-100 text-green-700',
|
|
nis2: 'bg-orange-100 text-orange-700',
|
|
custom: 'bg-gray-100 text-gray-700',
|
|
}
|
|
|
|
const statusColors = {
|
|
active: 'bg-green-100 text-green-700',
|
|
inactive: 'bg-gray-100 text-gray-500',
|
|
pending: 'bg-yellow-100 text-yellow-700',
|
|
}
|
|
|
|
return (
|
|
<div className={`bg-white rounded-xl border-2 p-6 transition-all ${
|
|
isActive ? 'border-purple-400 shadow-lg' : 'border-gray-200 hover:border-purple-300'
|
|
}`}>
|
|
<div className="flex items-start justify-between">
|
|
<div className="flex-1">
|
|
<div className="flex items-center gap-2 mb-2">
|
|
<span className={`px-2 py-1 text-xs rounded-full ${categoryColors[module.category]}`}>
|
|
{module.category.toUpperCase()}
|
|
</span>
|
|
<span className={`px-2 py-1 text-xs rounded-full ${statusColors[module.status]}`}>
|
|
{module.status === 'active' ? 'Aktiv' : module.status === 'pending' ? 'Ausstehend' : 'Inaktiv'}
|
|
</span>
|
|
{module.hasAIComponents && (
|
|
<span className="px-2 py-1 text-xs rounded-full bg-indigo-100 text-indigo-700">
|
|
KI
|
|
</span>
|
|
)}
|
|
</div>
|
|
<h3 className="text-lg font-semibold text-gray-900">{module.name}</h3>
|
|
<p className="text-sm text-gray-500 mt-1">{module.description}</p>
|
|
{module.regulations.length > 0 && (
|
|
<div className="mt-2 flex flex-wrap gap-1">
|
|
{module.regulations.map(reg => (
|
|
<span key={reg} className="px-2 py-0.5 text-xs bg-gray-100 text-gray-600 rounded">
|
|
{reg}
|
|
</span>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="mt-4 grid grid-cols-2 gap-4 text-sm">
|
|
<div>
|
|
<span className="text-gray-500">Anforderungen:</span>
|
|
<span className="ml-2 font-medium">{module.requirementsCount}</span>
|
|
</div>
|
|
<div>
|
|
<span className="text-gray-500">Kontrollen:</span>
|
|
<span className="ml-2 font-medium">{module.controlsCount}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="mt-4">
|
|
<div className="flex items-center justify-between text-sm mb-1">
|
|
<span className="text-gray-500">Fortschritt</span>
|
|
<span className="font-medium text-purple-600">{module.completionPercent}%</span>
|
|
</div>
|
|
<div className="h-2 bg-gray-100 rounded-full overflow-hidden">
|
|
<div
|
|
className={`h-full rounded-full transition-all ${
|
|
module.completionPercent === 100 ? 'bg-green-500' : 'bg-purple-600'
|
|
}`}
|
|
style={{ width: `${module.completionPercent}%` }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="mt-4 flex items-center gap-2">
|
|
{isActive ? (
|
|
<>
|
|
<button
|
|
onClick={onConfigure}
|
|
className="flex-1 px-4 py-2 text-sm bg-purple-50 text-purple-700 rounded-lg hover:bg-purple-100 transition-colors"
|
|
>
|
|
Konfigurieren
|
|
</button>
|
|
<button
|
|
onClick={onDeactivate}
|
|
className="px-4 py-2 text-sm text-red-600 hover:bg-red-50 rounded-lg transition-colors"
|
|
>
|
|
Deaktivieren
|
|
</button>
|
|
</>
|
|
) : (
|
|
<button
|
|
onClick={onActivate}
|
|
className="flex-1 px-4 py-2 text-sm bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors"
|
|
>
|
|
Modul aktivieren
|
|
</button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
// =============================================================================
|
|
// MAIN PAGE
|
|
// =============================================================================
|
|
|
|
export default function ModulesPage() {
|
|
const { state, dispatch } = useSDK()
|
|
const router = useRouter()
|
|
const [filter, setFilter] = useState<string>('all')
|
|
const [availableModules, setAvailableModules] = useState<Omit<DisplayModule, 'status' | 'completionPercent'>[]>(fallbackModules)
|
|
const [isLoadingModules, setIsLoadingModules] = useState(true)
|
|
const [backendError, setBackendError] = useState<string | null>(null)
|
|
const [showCreateModal, setShowCreateModal] = useState(false)
|
|
const [newModuleName, setNewModuleName] = useState('')
|
|
const [newModuleCategory, setNewModuleCategory] = useState<ModuleCategory>('custom')
|
|
const [newModuleDescription, setNewModuleDescription] = useState('')
|
|
const [actionError, setActionError] = useState<string | null>(null)
|
|
|
|
// Load modules from backend
|
|
useEffect(() => {
|
|
async function loadModules() {
|
|
try {
|
|
const response = await fetch('/api/sdk/v1/modules')
|
|
if (response.ok) {
|
|
const data = await response.json()
|
|
if (data.modules && data.modules.length > 0) {
|
|
const mapped = data.modules.map(mapBackendToDisplay)
|
|
setAvailableModules(mapped)
|
|
setBackendError(null)
|
|
}
|
|
} else {
|
|
setBackendError('Backend nicht erreichbar — zeige Standard-Module')
|
|
}
|
|
} catch {
|
|
setBackendError('Backend nicht erreichbar — zeige Standard-Module')
|
|
} finally {
|
|
setIsLoadingModules(false)
|
|
}
|
|
}
|
|
loadModules()
|
|
}, [])
|
|
|
|
// Convert SDK modules to display modules with additional UI properties
|
|
const displayModules: DisplayModule[] = availableModules.map(template => {
|
|
const activeModule = state.modules.find(m => m.id === template.id)
|
|
const isActive = !!activeModule
|
|
|
|
// Calculate completion based on linked requirements and controls
|
|
const linkedRequirements = state.requirements.filter(r =>
|
|
r.applicableModules.includes(template.id)
|
|
)
|
|
const completedRequirements = linkedRequirements.filter(
|
|
r => r.status === 'IMPLEMENTED' || r.status === 'VERIFIED'
|
|
)
|
|
const completionPercent = linkedRequirements.length > 0
|
|
? Math.round((completedRequirements.length / linkedRequirements.length) * 100)
|
|
: 0
|
|
|
|
return {
|
|
...template,
|
|
status: isActive ? 'active' as ModuleStatus : 'inactive' as ModuleStatus,
|
|
completionPercent,
|
|
}
|
|
})
|
|
|
|
const filteredModules = filter === 'all'
|
|
? displayModules
|
|
: displayModules.filter(m => m.category === filter || m.status === filter)
|
|
|
|
const activeModulesCount = state.modules.length
|
|
const totalRequirements = displayModules
|
|
.filter(m => state.modules.some(sm => sm.id === m.id))
|
|
.reduce((sum, m) => sum + m.requirementsCount, 0)
|
|
const totalControls = displayModules
|
|
.filter(m => state.modules.some(sm => sm.id === m.id))
|
|
.reduce((sum, m) => sum + m.controlsCount, 0)
|
|
|
|
const handleActivateModule = async (module: DisplayModule) => {
|
|
const serviceModule: ServiceModule = {
|
|
id: module.id,
|
|
name: module.name,
|
|
description: module.description,
|
|
regulations: module.regulations,
|
|
criticality: module.criticality,
|
|
processesPersonalData: module.processesPersonalData,
|
|
hasAIComponents: module.hasAIComponents,
|
|
}
|
|
dispatch({ type: 'ADD_MODULE', payload: serviceModule })
|
|
setActionError(null)
|
|
|
|
try {
|
|
const res = await fetch(`/api/sdk/v1/modules/${encodeURIComponent(module.id)}/activate`, {
|
|
method: 'POST',
|
|
})
|
|
if (!res.ok) throw new Error('Aktivierung fehlgeschlagen')
|
|
} catch {
|
|
// Rollback optimistic update
|
|
const rollbackModules = state.modules.filter(m => m.id !== module.id)
|
|
dispatch({ type: 'SET_STATE', payload: { modules: rollbackModules } })
|
|
setActionError(`Modul "${module.name}" konnte nicht aktiviert werden.`)
|
|
setTimeout(() => setActionError(null), 5000)
|
|
}
|
|
}
|
|
|
|
const handleDeactivateModule = async (moduleId: string) => {
|
|
const previousModules = [...state.modules]
|
|
const updatedModules = state.modules.filter(m => m.id !== moduleId)
|
|
dispatch({ type: 'SET_STATE', payload: { modules: updatedModules } })
|
|
setActionError(null)
|
|
|
|
try {
|
|
const res = await fetch(`/api/sdk/v1/modules/${encodeURIComponent(moduleId)}/deactivate`, {
|
|
method: 'POST',
|
|
})
|
|
if (!res.ok) throw new Error('Deaktivierung fehlgeschlagen')
|
|
} catch {
|
|
// Rollback optimistic update
|
|
dispatch({ type: 'SET_STATE', payload: { modules: previousModules } })
|
|
setActionError('Modul konnte nicht deaktiviert werden.')
|
|
setTimeout(() => setActionError(null), 5000)
|
|
}
|
|
}
|
|
|
|
const handleCreateModule = async () => {
|
|
if (!newModuleName.trim()) return
|
|
|
|
try {
|
|
const res = await fetch('/api/sdk/v1/modules', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({
|
|
name: newModuleName,
|
|
category: newModuleCategory,
|
|
description: newModuleDescription,
|
|
}),
|
|
})
|
|
|
|
if (res.ok) {
|
|
const data = await res.json()
|
|
const newMod: Omit<DisplayModule, 'status' | 'completionPercent'> = {
|
|
id: data.id || `custom-${Date.now()}`,
|
|
name: newModuleName,
|
|
description: newModuleDescription,
|
|
category: newModuleCategory,
|
|
regulations: [],
|
|
criticality: 'MEDIUM',
|
|
processesPersonalData: false,
|
|
hasAIComponents: false,
|
|
requirementsCount: 0,
|
|
controlsCount: 0,
|
|
}
|
|
setAvailableModules(prev => [...prev, newMod])
|
|
}
|
|
|
|
setShowCreateModal(false)
|
|
setNewModuleName('')
|
|
setNewModuleCategory('custom')
|
|
setNewModuleDescription('')
|
|
} catch {
|
|
setActionError('Modul konnte nicht erstellt werden.')
|
|
setTimeout(() => setActionError(null), 5000)
|
|
}
|
|
}
|
|
|
|
const stepInfo = STEP_EXPLANATIONS['modules']
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
{/* Step Header */}
|
|
<StepHeader
|
|
stepId="modules"
|
|
title={stepInfo.title}
|
|
description={stepInfo.description}
|
|
explanation={stepInfo.explanation}
|
|
tips={stepInfo.tips}
|
|
>
|
|
<button
|
|
onClick={() => setShowCreateModal(true)}
|
|
className="flex items-center gap-2 px-4 py-2 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors"
|
|
>
|
|
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
|
</svg>
|
|
Eigenes Modul erstellen
|
|
</button>
|
|
</StepHeader>
|
|
|
|
{/* Error Toast */}
|
|
{actionError && (
|
|
<div className="fixed top-4 right-4 z-50 bg-red-50 border border-red-200 rounded-lg p-4 shadow-lg max-w-sm">
|
|
<div className="flex items-start gap-2">
|
|
<svg className="w-5 h-5 text-red-600 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
|
|
</svg>
|
|
<p className="text-sm text-red-700">{actionError}</p>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Create Module Modal */}
|
|
{showCreateModal && (
|
|
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50">
|
|
<div className="bg-white rounded-xl p-6 w-full max-w-md shadow-2xl">
|
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Eigenes Modul erstellen</h3>
|
|
<div className="space-y-4">
|
|
<div>
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Name</label>
|
|
<input
|
|
type="text"
|
|
value={newModuleName}
|
|
onChange={e => setNewModuleName(e.target.value)}
|
|
placeholder="z.B. ISO 42001 AI Management"
|
|
className="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-purple-500"
|
|
/>
|
|
</div>
|
|
<div>
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Kategorie</label>
|
|
<select
|
|
value={newModuleCategory}
|
|
onChange={e => setNewModuleCategory(e.target.value as ModuleCategory)}
|
|
className="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-purple-500"
|
|
>
|
|
<option value="gdpr">DSGVO</option>
|
|
<option value="ai-act">AI Act</option>
|
|
<option value="iso27001">ISO 27001</option>
|
|
<option value="nis2">NIS2</option>
|
|
<option value="custom">Eigene</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label className="block text-sm font-medium text-gray-700 mb-1">Beschreibung</label>
|
|
<textarea
|
|
value={newModuleDescription}
|
|
onChange={e => setNewModuleDescription(e.target.value)}
|
|
placeholder="Was deckt dieses Modul ab?"
|
|
rows={3}
|
|
className="w-full px-3 py-2 border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-purple-500"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="flex justify-end gap-2 mt-6">
|
|
<button
|
|
onClick={() => setShowCreateModal(false)}
|
|
className="px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg"
|
|
>
|
|
Abbrechen
|
|
</button>
|
|
<button
|
|
onClick={handleCreateModule}
|
|
disabled={!newModuleName.trim()}
|
|
className="px-4 py-2 text-sm bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50"
|
|
>
|
|
Erstellen
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Backend Status */}
|
|
{backendError && (
|
|
<div className="bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm text-amber-700">
|
|
{backendError}
|
|
</div>
|
|
)}
|
|
|
|
{/* Loading */}
|
|
{isLoadingModules && (
|
|
<div className="text-center py-8 text-gray-500">Lade Module vom Backend...</div>
|
|
)}
|
|
|
|
{/* Stats */}
|
|
<div className="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
<div className="bg-white rounded-xl border border-gray-200 p-6">
|
|
<div className="text-sm text-gray-500">Verfuegbare Module</div>
|
|
<div className="text-3xl font-bold text-gray-900">{availableModules.length}</div>
|
|
</div>
|
|
<div className="bg-white rounded-xl border border-green-200 p-6">
|
|
<div className="text-sm text-green-600">Aktivierte Module</div>
|
|
<div className="text-3xl font-bold text-green-600">{activeModulesCount}</div>
|
|
</div>
|
|
<div className="bg-white rounded-xl border border-blue-200 p-6">
|
|
<div className="text-sm text-blue-600">Anforderungen (aktiv)</div>
|
|
<div className="text-3xl font-bold text-blue-600">{totalRequirements}</div>
|
|
</div>
|
|
<div className="bg-white rounded-xl border border-purple-200 p-6">
|
|
<div className="text-sm text-purple-600">Kontrollen (aktiv)</div>
|
|
<div className="text-3xl font-bold text-purple-600">{totalControls}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Active Modules Alert */}
|
|
{activeModulesCount === 0 && (
|
|
<div className="bg-amber-50 border border-amber-200 rounded-xl p-4">
|
|
<div className="flex items-start gap-3">
|
|
<svg className="w-5 h-5 text-amber-600 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="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" />
|
|
</svg>
|
|
<div>
|
|
<h4 className="font-medium text-amber-800">Keine Module aktiviert</h4>
|
|
<p className="text-sm text-amber-700 mt-1">
|
|
Aktivieren Sie mindestens ein Compliance-Modul, um mit der Erfassung von Anforderungen und Kontrollen fortzufahren.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Filter */}
|
|
<div className="flex items-center gap-2">
|
|
<span className="text-sm text-gray-500">Filter:</span>
|
|
{['all', 'active', 'inactive', 'gdpr', 'ai-act', 'iso27001', 'nis2'].map(f => (
|
|
<button
|
|
key={f}
|
|
onClick={() => setFilter(f)}
|
|
className={`px-3 py-1 text-sm rounded-full transition-colors ${
|
|
filter === f
|
|
? 'bg-purple-600 text-white'
|
|
: 'bg-gray-100 text-gray-600 hover:bg-gray-200'
|
|
}`}
|
|
>
|
|
{f === 'all' ? 'Alle' :
|
|
f === 'active' ? 'Aktiv' :
|
|
f === 'inactive' ? 'Inaktiv' :
|
|
f.toUpperCase()}
|
|
</button>
|
|
))}
|
|
</div>
|
|
|
|
{/* Module Grid */}
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
{filteredModules.map(module => (
|
|
<ModuleCard
|
|
key={module.id}
|
|
module={module}
|
|
isActive={state.modules.some(m => m.id === module.id)}
|
|
onActivate={() => handleActivateModule(module)}
|
|
onDeactivate={() => handleDeactivateModule(module.id)}
|
|
onConfigure={() => router.push(`/sdk/modules/${module.id}`)}
|
|
/>
|
|
))}
|
|
</div>
|
|
|
|
{filteredModules.length === 0 && (
|
|
<div className="bg-white rounded-xl border border-gray-200 p-12 text-center">
|
|
<div className="w-16 h-16 mx-auto bg-gray-100 rounded-full flex items-center justify-center mb-4">
|
|
<svg className="w-8 h-8 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="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 2" />
|
|
</svg>
|
|
</div>
|
|
<h3 className="text-lg font-semibold text-gray-900">Keine Module gefunden</h3>
|
|
<p className="mt-2 text-gray-500">Passen Sie den Filter an oder fuegen Sie neue Module hinzu.</p>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|