import React from 'react'; import { useUIMode } from '../services/uiModeService'; import { useT } from '../i18n/strings'; import type { RibbonBarProps, RibbonTab } from '../types/ui.types'; import { pluginRegistry } from '../plugins'; import { V2_TOOLS_ENABLED } from '../kernel/featureFlags'; const tabs: Array<{ id: RibbonTab; label: string; svg: React.ReactNode }> = [ { id: 'start', label: 'Start', svg: }, { id: 'draw', label: 'Zeichnen', svg: }, { id: 'view', label: 'Ansicht', svg: }, { id: 'ki', label: 'KI', svg: }, ]; /** V2-Werkzeug-Kategorien → Gruppen-Label im Zeichnen-Tab. */ const V2_GROUP_LABELS: Record = { canvas: 'Zeichnen & Ändern', format: 'Bemaßung & Text', insert: 'Bestuhlung & Traversen', }; const RibbonBar: React.FC = ({ activeTab, onTabChange, onAction, canvasBgColor = '#1e1e2e', gridColor = '#3a3a4a', rulerEnabled = true, onCanvasBgColorChange, onGridColorChange, onToggleRuler, onIsV2ToolActive, }) => { const uiMode = useUIMode(); /** Rendert die V2-Werkzeuge einer Kategorie als Button-Gruppe. */ const renderV2Group = (category: string) => { const tools = pluginRegistry.getToolsV2() .filter((tool) => tool.manifest.ribbonTab === category) .filter((tool) => uiMode === 'pro' || (tool.manifest.tags ?? []).includes('basic')); if (tools.length === 0) return null; return (
{tools.map((tool) => { const isActive = onIsV2ToolActive?.(tool.manifest.id); return ( ); })} {category === 'insert' && ( )}
{V2_GROUP_LABELS[category] ?? category}
); }; return ( ); }; export default RibbonBar;