/** * PluginManager – UI component for managing plugins */ import React, { useState, useEffect } from 'react'; import { pluginRegistry } from '../plugins'; import type { PluginState } from '../plugins'; const categoryLabels: Record = { tools: 'Werkzeuge', elements: 'Elemente', 'import-export': 'Import/Export', theme: 'Theme', other: 'Sonstige', }; const categoryIcons: Record = { tools: , elements: , 'import-export': , theme: , other: , }; const PluginManager: React.FC = () => { const [states, setStates] = useState([]); const [expandedId, setExpandedId] = useState(null); useEffect(() => { const update = () => setStates(pluginRegistry.getStates()); update(); return pluginRegistry.subscribe(update); }, []); const handleToggle = (id: string) => { pluginRegistry.toggle(id); }; if (states.length === 0) { return (
Keine Plugins installiert.
); } return (
Plugins {states.filter(s => s.enabled).length} aktiv · {states.length} gesamt
{states.map((state) => (
setExpandedId(expandedId === state.manifest.id ? null : state.manifest.id)}>
{categoryIcons[state.manifest.category] || categoryIcons.other}
{state.manifest.name}
v{state.manifest.version} · {categoryLabels[state.manifest.category] || state.manifest.category}
{expandedId === state.manifest.id && (

{state.manifest.description}

Autor: {state.manifest.author}
)}
))}
); }; export default PluginManager;