task(CAD-14): phase 4b - dynamic plugin tools section in left sidebar (all registry tools reachable, single tool location)

This commit is contained in:
Agent Zero
2026-09-16 23:12:14 +02:00
parent 2a05257ab5
commit d5acf76d0b
+31 -1
View File
@@ -1,6 +1,7 @@
import React, { useState, useCallback } from 'react';
import React, { useState, useCallback, useMemo } from 'react';
import type { LeftSidebarProps } from '../types/ui.types';
import { SEATING_TEMPLATES } from '../services/seatingService';
import { pluginRegistry } from '../plugins';
interface ToolDef {
tool: string;
@@ -138,6 +139,35 @@ const LeftSidebar: React.FC<LeftSidebarProps> = ({ activeTool, onToolChange, sel
</div>
))}
{/* CAD-14 Phase 4b: Dynamische Sektion fuer Registry-Werkzeuge ohne
statischen Button (truss, boxcorner, circle-truss, measure, ...).
Ein Ort fuer ALLE Werkzeuge — keine Doppelung mehr. */}
{(() => {
const staticIds = new Set(sections.flatMap((s) => s.tools.map((t) => t.tool)));
const v2Tools = pluginRegistry.getToolsV2().filter((t) => !staticIds.has(t.manifest.id));
if (v2Tools.length === 0) return null;
return (
<div className="tool-section" key="v2-extra">
{renderSectionLabel('Werkzeuge (Plugins)', 'v2-extra')}
<div className="tool-grid" style={collapsedSections['v2-extra'] ? { display: 'none' } : undefined}>
{v2Tools.map((tool) => (
<button
key={tool.manifest.id}
className={`tool-btn${activeTool === tool.manifest.id ? ' active' : ''}`}
data-v2tool={tool.manifest.id}
data-tool={tool.manifest.id}
title={tool.manifest.description ?? tool.manifest.label}
onClick={() => onToolChange(tool.manifest.id)}
>
<span className="tool-btn-label" style={{ fontSize: 14 }}>{tool.manifest.icon}</span>
<span className="tool-btn-label">{tool.manifest.label}</span>
</button>
))}
</div>
</div>
);
})()}
{(onGroup || onUngroup) && (
<div className="tool-section" key="grouping">
{renderSectionLabel("Gruppierung", "grouping")}