task(CAD-14): phase 4b - dynamic plugin tools section in left sidebar (all registry tools reachable, single tool location)
This commit is contained in:
@@ -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 type { LeftSidebarProps } from '../types/ui.types';
|
||||||
import { SEATING_TEMPLATES } from '../services/seatingService';
|
import { SEATING_TEMPLATES } from '../services/seatingService';
|
||||||
|
import { pluginRegistry } from '../plugins';
|
||||||
|
|
||||||
interface ToolDef {
|
interface ToolDef {
|
||||||
tool: string;
|
tool: string;
|
||||||
@@ -138,6 +139,35 @@ const LeftSidebar: React.FC<LeftSidebarProps> = ({ activeTool, onToolChange, sel
|
|||||||
</div>
|
</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) && (
|
{(onGroup || onUngroup) && (
|
||||||
<div className="tool-section" key="grouping">
|
<div className="tool-section" key="grouping">
|
||||||
{renderSectionLabel("Gruppierung", "grouping")}
|
{renderSectionLabel("Gruppierung", "grouping")}
|
||||||
|
|||||||
Reference in New Issue
Block a user