feat: delete function, sidebar collapse, layer drag&drop, library tree

- Delete: trash button in PropertiesPanel + existing Delete key support
- Left sidebar: desktop collapse toggle button
- Right sidebar: desktop collapse toggle + SVG icon size fix (replaced emoji)
- Layer panel: drag&drop enabled (reorder, move to layers, sub-layers)
- Library tree: BlockLibrary added to left sidebar
- App.tsx: handleReorderLayer, handleAddSubLayer, handleUpdateElement
- styles.css: collapse + drag&drop visual indicators
This commit is contained in:
2026-06-29 10:44:53 +02:00
parent 6b0b637636
commit ba978cd13c
7 changed files with 222 additions and 21 deletions
+103 -1
View File
@@ -147,6 +147,9 @@ const CADEditor: React.FC<CADEditorProps> = ({ projectId, token, onNavigateBack
// Mobile drawers // Mobile drawers
const [mobileLeftOpen, setMobileLeftOpen] = useState(false); const [mobileLeftOpen, setMobileLeftOpen] = useState(false);
const [mobileRightOpen, setMobileRightOpen] = useState(false); const [mobileRightOpen, setMobileRightOpen] = useState(false);
// Desktop sidebar collapse
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = useState(false);
const [rightSidebarCollapsed, setRightSidebarCollapsed] = useState(false);
const [settingsOpen, setSettingsOpen] = useState(false); const [settingsOpen, setSettingsOpen] = useState(false);
const [activeDrawerTab, setActiveDrawerTab] = useState<DrawerTab>('tool'); const [activeDrawerTab, setActiveDrawerTab] = useState<DrawerTab>('tool');
@@ -792,6 +795,89 @@ const CADEditor: React.FC<CADEditorProps> = ({ projectId, token, onNavigateBack
setCommandHistory((prev) => [...prev, { prefix: '·', text: 'Zoom: an Ansicht angepasst', type: 'info' }]); setCommandHistory((prev) => [...prev, { prefix: '·', text: 'Zoom: an Ansicht angepasst', type: 'info' }]);
}, []); }, []);
// Layer reorder (drag & drop)
const handleReorderLayer = useCallback((draggedId: string, targetId: string, position: 'before' | 'after' | 'inside') => {
setLayers((prev) => {
const dragged = prev.find((l) => l.id === draggedId);
if (!dragged) return prev;
if (position === 'inside') {
// Make dragged a child of target
const updated = prev.map((l) =>
l.id === draggedId ? { ...l, parentId: targetId } : l
);
return updated;
}
// before/after: reorder at same level
const target = prev.find((l) => l.id === targetId);
if (!target) return prev;
const parentId = target.parentId;
const siblings = prev
.filter((l) => l.parentId === parentId && l.id !== draggedId)
.sort((a, b) => a.sortOrder - b.sortOrder);
const targetIdx = siblings.findIndex((l) => l.id === targetId);
const insertIdx = position === 'before' ? targetIdx : targetIdx + 1;
siblings.splice(insertIdx, 0, { ...dragged, parentId });
// Reassign sortOrder
const reordered = siblings.map((l, i) => ({ ...l, sortOrder: i }));
// Merge back: non-siblings keep original, siblings get reordered
const nonSiblings = prev.filter((l) => l.parentId !== parentId || l.id === draggedId);
const result = [...nonSiblings.filter((l) => l.id !== draggedId), ...reordered];
return result;
});
setCommandHistory((prev) => [...prev, { prefix: '·', text: 'Ebene verschoben', type: 'info' }]);
}, []);
// Add sub-layer
const handleAddSubLayer = useCallback((parentId: string) => {
setLayers((prev) => {
const parent = prev.find((l) => l.id === parentId);
if (!parent) return prev;
const newId = `layer-${Date.now()}`;
const siblings = prev.filter((l) => l.parentId === parentId);
const newLayer: CADLayer = {
id: newId, name: `Teilebene ${siblings.length + 1}`, visible: true, locked: false,
color: parent.color, lineType: 'solid', transparency: 0,
sortOrder: siblings.length, parentId,
};
if (drawingId && token) {
createLayerTyped(token, drawingId, newLayer).catch((err) => {
console.error('Failed to save sub-layer:', err);
});
}
return [...prev, newLayer];
});
}, [drawingId, token]);
// Update single element (from properties panel)
const handleUpdateElement = useCallback((updated: CADElement) => {
setElements((prev) => {
const newElements = prev.map((e) => (e.id === updated.id ? updated : e));
historyManagerRef.current.pushSnapshot({
elements: newElements, layers, blocks, groups, bgConfig,
}, 'Element geändert');
return newElements;
});
syncHistory();
collab.setElement(updated);
if (token) {
setSavedStatus('Speichert…');
updateElement(token, updated.id, updated).then(() => {
setSavedStatus('gespeichert');
}).catch((err) => {
console.error('Failed to update element:', err);
setSavedStatus('Fehler beim Speichern');
});
}
setSelectedElement(updated);
}, [layers, blocks, groups, bgConfig, syncHistory, token, collab]);
const handleBgApply = useCallback((config: BackgroundConfig, _image: HTMLImageElement | null) => { const handleBgApply = useCallback((config: BackgroundConfig, _image: HTMLImageElement | null) => {
setBgConfig(config); setBgConfig(config);
setBgImportOpen(false); setBgImportOpen(false);
@@ -950,7 +1036,7 @@ const CADEditor: React.FC<CADEditorProps> = ({ projectId, token, onNavigateBack
onTabChange={setActiveRibbonTab} onTabChange={setActiveRibbonTab}
onAction={handleRibbonAction} onAction={handleRibbonAction}
/> />
<div className="app-body"> <div className={`app-body${leftSidebarCollapsed ? ' left-collapsed' : ''}${rightSidebarCollapsed ? ' right-collapsed' : ''}`}>
<LeftSidebar <LeftSidebar
activeTool={activeTool} activeTool={activeTool}
onToolChange={handleToolChange} onToolChange={handleToolChange}
@@ -958,6 +1044,17 @@ const CADEditor: React.FC<CADEditorProps> = ({ projectId, token, onNavigateBack
onTemplateSelect={handleTemplateSelect} onTemplateSelect={handleTemplateSelect}
className={mobileLeftOpen ? 'open' : ''} className={mobileLeftOpen ? 'open' : ''}
onCollapse={() => setMobileLeftOpen(false)} onCollapse={() => setMobileLeftOpen(false)}
collapsed={leftSidebarCollapsed}
onToggleCollapse={() => setLeftSidebarCollapsed((p) => !p)}
blocks={blocks}
onDragBlock={handleDragBlock}
onBlockCategoryChange={handleBlockCategoryChange}
onBlockSearch={handleBlockSearch}
onRenameBlock={handleRenameBlock}
onDuplicateBlock={handleDuplicateBlock}
onDeleteBlock={handleDeleteBlock}
onSvgImport={handleSvgImport}
onSaveGroupAsBlock={handleSaveGroupAsBlock}
/> />
<CanvasArea <CanvasArea
cursorPos={cursorPos} cursorPos={cursorPos}
@@ -1022,6 +1119,11 @@ const CADEditor: React.FC<CADEditorProps> = ({ projectId, token, onNavigateBack
kiLoading={kiLoading} kiLoading={kiLoading}
className={mobileRightOpen ? 'open' : ''} className={mobileRightOpen ? 'open' : ''}
onCollapse={() => setMobileRightOpen(false)} onCollapse={() => setMobileRightOpen(false)}
collapsed={rightSidebarCollapsed}
onToggleCollapse={() => setRightSidebarCollapsed((p) => !p)}
onReorder={handleReorderLayer}
onAddSubLayer={handleAddSubLayer}
onUpdateElement={handleUpdateElement}
/> />
</div> </div>
<CommandLine <CommandLine
+13 -12
View File
@@ -131,6 +131,7 @@ const LayerPanel: React.FC<LayerPanelProps> = ({
selectedId={activeLayerId} selectedId={activeLayerId}
onSelect={onSelectLayer} onSelect={onSelectLayer}
onReorder={onReorder} onReorder={onReorder}
draggable={true}
renderIcon={(node) => node.icon} renderIcon={(node) => node.icon}
renderActions={(node) => { renderActions={(node) => {
const layer = layers.find((l) => l.id === node.id); const layer = layers.find((l) => l.id === node.id);
@@ -140,16 +141,16 @@ const LayerPanel: React.FC<LayerPanelProps> = ({
<button <button
onClick={(e) => { e.stopPropagation(); onToggleLayer(layer.id); }} onClick={(e) => { e.stopPropagation(); onToggleLayer(layer.id); }}
title={layer.visible ? 'Sichtbar' : 'Versteckt'} title={layer.visible ? 'Sichtbar' : 'Versteckt'}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: layer.visible ? 'var(--text-color, #ccc)' : 'var(--text-muted, #666)' }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: layer.visible ? 'var(--text-color, #ccc)' : 'var(--text-muted, #666)', display: 'flex', alignItems: 'center' }}
> >
{layer.visible ? '👁' : '🚫'} {layer.visible ? <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg> : <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>}
</button> </button>
<button <button
onClick={(e) => { e.stopPropagation(); onToggleLock?.(layer.id); }} onClick={(e) => { e.stopPropagation(); onToggleLock?.(layer.id); }}
title={layer.locked ? 'Gesperrt' : 'Entsperrt'} title={layer.locked ? 'Gesperrt' : 'Entsperrt'}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: layer.locked ? 'var(--accent, #f59e0b)' : 'var(--text-muted, #666)' }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: layer.locked ? 'var(--accent, #f59e0b)' : 'var(--text-muted, #666)', display: 'flex', alignItems: 'center' }}
> >
{layer.locked ? '🔒' : '🔓'} {layer.locked ? <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg> : <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/></svg>}
</button> </button>
<button <button
onClick={(e) => { e.stopPropagation(); handleAddSubLayer(layer.id); }} onClick={(e) => { e.stopPropagation(); handleAddSubLayer(layer.id); }}
@@ -161,16 +162,16 @@ const LayerPanel: React.FC<LayerPanelProps> = ({
<button <button
onClick={(e) => { e.stopPropagation(); onDuplicateLayer?.(layer.id); }} onClick={(e) => { e.stopPropagation(); onDuplicateLayer?.(layer.id); }}
title="Duplizieren" title="Duplizieren"
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: 'var(--text-color, #ccc)' }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: 'var(--text-color, #ccc)', display: 'flex', alignItems: 'center' }}
> >
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
</button> </button>
<button <button
onClick={(e) => { e.stopPropagation(); onDeleteLayer?.(layer.id); }} onClick={(e) => { e.stopPropagation(); onDeleteLayer?.(layer.id); }}
title="Loschen" title="Loschen"
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: '#f44336' }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: '#f44336', display: 'flex', alignItems: 'center' }}
> >
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
</button> </button>
</div> </div>
); );
@@ -183,16 +184,16 @@ const LayerPanel: React.FC<LayerPanelProps> = ({
<button <button
onClick={(e) => { e.stopPropagation(); onToggleElementVisible?.(element.id); }} onClick={(e) => { e.stopPropagation(); onToggleElementVisible?.(element.id); }}
title={isVisible ? 'Sichtbar' : 'Versteckt'} title={isVisible ? 'Sichtbar' : 'Versteckt'}
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: isVisible ? 'var(--text-color, #ccc)' : 'var(--text-muted, #666)' }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: isVisible ? 'var(--text-color, #ccc)' : 'var(--text-muted, #666)', display: 'flex', alignItems: 'center' }}
> >
{isVisible ? '👁' : '🚫'} {isVisible ? <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg> : <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>}
</button> </button>
<button <button
onClick={(e) => { e.stopPropagation(); onElementsDeleted?.([element.id]); }} onClick={(e) => { e.stopPropagation(); onElementsDeleted?.([element.id]); }}
title="Loschen" title="Loschen"
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: '#f44336' }} style={{ background: 'none', border: 'none', cursor: 'pointer', padding: '2px', color: '#f44336', display: 'flex', alignItems: 'center' }}
> >
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
</button> </button>
</div> </div>
); );
+26 -2
View File
@@ -1,6 +1,7 @@
import React from 'react'; import React 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 BlockLibrary from './BlockLibrary';
interface ToolDef { interface ToolDef {
tool: string; tool: string;
@@ -56,9 +57,9 @@ const sections: Array<{ label: string; tools: ToolDef[] }> = [
{ label: 'Bestuhlung', tools: sectionBestuhlung }, { label: 'Bestuhlung', tools: sectionBestuhlung },
]; ];
const LeftSidebar: React.FC<LeftSidebarProps> = ({ activeTool, onToolChange, selectedTemplate, onTemplateSelect, onCollapse, className }) => { const LeftSidebar: React.FC<LeftSidebarProps> = ({ activeTool, onToolChange, selectedTemplate, onTemplateSelect, onCollapse, className, collapsed, onToggleCollapse, blocks, onDragBlock, onBlockCategoryChange, onBlockSearch, onRenameBlock, onDuplicateBlock, onDeleteBlock, onSvgImport, onSaveGroupAsBlock }) => {
return ( return (
<aside className={`leftbar${className ? ' ' + className : ''}`} aria-label="Werkzeugpalette"> <aside className={`leftbar${className ? ' ' + className : ''}${collapsed ? ' leftbar-collapsed' : ''}`} aria-label="Werkzeugpalette">
<div className="leftbar-header"> <div className="leftbar-header">
<span className="leftbar-title">Werkzeuge</span> <span className="leftbar-title">Werkzeuge</span>
<button className="leftbar-toggle" aria-label="Linke Leiste ausblenden" onClick={onCollapse}> <button className="leftbar-toggle" aria-label="Linke Leiste ausblenden" onClick={onCollapse}>
@@ -120,7 +121,30 @@ const LeftSidebar: React.FC<LeftSidebarProps> = ({ activeTool, onToolChange, sel
</div> </div>
)} )}
{blocks && blocks.length > 0 && (
<div className="tool-section" key="library">
<div className="tool-section-label">Bibliothek</div>
<BlockLibrary
blocks={blocks}
category="Alle"
onCategoryChange={onBlockCategoryChange ?? (() => {})}
onSearch={onBlockSearch ?? (() => {})}
onDragBlock={onDragBlock ?? (() => {})}
onRenameBlock={onRenameBlock}
onDuplicateBlock={onDuplicateBlock}
onDeleteBlock={onDeleteBlock}
onSvgImport={onSvgImport}
onSaveGroupAsBlock={onSaveGroupAsBlock}
/>
</div>
)}
<div className="leftbar-footer"> <div className="leftbar-footer">
{onToggleCollapse && (
<button className="leftbar-footer-btn" title="Linke Leiste ein-/ausklappen" aria-label="Linke Leiste ein-/ausklappen" onClick={onToggleCollapse}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg>
</button>
)}
<button className="leftbar-footer-btn" title="Plugin hinzufügen" aria-label="Plugin hinzufügen"> <button className="leftbar-footer-btn" title="Plugin hinzufügen" aria-label="Plugin hinzufügen">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg>
</button> </button>
+16 -4
View File
@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import type { PropertiesPanelProps } from '../types/ui.types'; import type { PropertiesPanelProps } from '../types/ui.types';
const PropertiesPanel: React.FC<PropertiesPanelProps> = ({ selectedElement, layers, onUpdateProperty }) => { const PropertiesPanel: React.FC<PropertiesPanelProps> = ({ selectedElement, layers, onUpdateProperty, onDelete }) => {
const el = selectedElement; const el = selectedElement;
const x = el ? String(el.x) : '0'; const x = el ? String(el.x) : '0';
const y = el ? String(el.y) : '0'; const y = el ? String(el.y) : '0';
@@ -17,9 +17,21 @@ const PropertiesPanel: React.FC<PropertiesPanelProps> = ({ selectedElement, laye
<div className="panel-section"> <div className="panel-section">
<div className="panel-section-title"> <div className="panel-section-title">
<span>Auswahl · 1 Stuhl</span> <span>Auswahl · 1 Stuhl</span>
<button style={{ color: 'var(--color-text-muted)', fontSize: '11px' }} title="Mehr Optionen"> <div style={{ display: 'flex', gap: '4px' }}>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg> {onDelete && el && (
</button> <button
onClick={onDelete}
title="Auswahl löschen (Entf)"
aria-label="Auswahl löschen"
style={{ color: '#f44336', background: 'none', border: 'none', cursor: 'pointer', padding: '2px', display: 'flex', alignItems: 'center' }}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
</button>
)}
<button style={{ color: 'var(--color-text-muted)', fontSize: '11px', background: 'none', border: 'none', cursor: 'pointer', padding: '2px' }} title="Mehr Optionen">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
</button>
</div>
</div> </div>
</div> </div>
+9 -2
View File
@@ -24,12 +24,19 @@ const RightSidebar: React.FC<RightSidebarProps> = ({
onBlockCategoryChange, onBlockSearch, onDragBlock, onBlockCategoryChange, onBlockSearch, onDragBlock,
kiMessages, kiSuggestions, onKISend, onKISuggestionClick, kiLoading, onUpdateElement, kiMessages, kiSuggestions, onKISend, onKISuggestionClick, kiLoading, onUpdateElement,
onCollapse, onCollapse,
collapsed,
onToggleCollapse,
}) => { }) => {
return ( return (
<aside className={`rightbar${className ? ' ' + className : ''}`} aria-label="Eigenschaften-Panels"> <aside className={`rightbar${className ? ' ' + className : ''}${collapsed ? ' rightbar-collapsed' : ''}`} aria-label="Eigenschaften-Panels">
<button className="rightbar-close" aria-label="Rechte Leiste schließen" onClick={onCollapse}> <button className="rightbar-close" aria-label="Rechte Leiste schließen" onClick={onCollapse}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>
</button> </button>
{onToggleCollapse && (
<button className="rightbar-collapse-toggle" aria-label="Rechte Leiste ein-/ausklappen" onClick={onToggleCollapse} title="Rechte Leiste ein-/ausklappen">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg>
</button>
)}
<div className="rightbar-tabs" role="tablist"> <div className="rightbar-tabs" role="tablist">
{tabs.map((tab) => ( {tabs.map((tab) => (
<button <button
@@ -49,7 +56,7 @@ const RightSidebar: React.FC<RightSidebarProps> = ({
<div className="rightbar-content"> <div className="rightbar-content">
<div className={`rightbar-panel${activePanel === 'tool' ? ' active' : ''}`} data-panel-content="tool"> <div className={`rightbar-panel${activePanel === 'tool' ? ' active' : ''}`} data-panel-content="tool">
{activePanel === 'tool' && <PropertiesPanel selectedElement={selectedElement} layers={layers} onUpdateProperty={(key, value) => { {activePanel === 'tool' && <PropertiesPanel selectedElement={selectedElement} layers={layers} onDelete={selectedElement && onElementsDeleted ? () => onElementsDeleted([selectedElement.id]) : undefined} onUpdateProperty={(key, value) => {
if (!selectedElement || !onUpdateElement) return; if (!selectedElement || !onUpdateElement) return;
const updated = { ...selectedElement }; const updated = { ...selectedElement };
if (key === 'x' || key === 'y' || key === 'width' || key === 'height') { if (key === 'x' || key === 'y' || key === 'width' || key === 'height') {
+40
View File
@@ -2172,3 +2172,43 @@ body.drawer-open { overflow: hidden; }
} }
.dashboard-share-btn:hover { border-color: var(--color-primary); color: var(--color-primary); } .dashboard-share-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
/* ─── Desktop Sidebar Collapse ─────────────────────────── */
.rightbar-collapse-toggle {
position: absolute;
top: 8px;
right: 32px;
width: 24px;
height: 24px;
display: grid;
place-items: center;
background: var(--color-surface-2);
border: 1px solid var(--color-border);
border-radius: 4px;
cursor: pointer;
color: var(--color-text-muted);
z-index: 10;
transition: all var(--t-fast);
}
.rightbar-collapse-toggle:hover {
background: var(--color-surface-3);
color: var(--color-text);
}
.rightbar-collapse-toggle svg { width: 14px; height: 14px; }
.app-body.right-collapsed .rightbar { width: 0; min-width: 0; overflow: hidden; border-left: none; }
.app-body.right-collapsed .rightbar-tabs,
.app-body.right-collapsed .rightbar-content,
.app-body.right-collapsed .rightbar-close { display: none; }
.leftbar-collapsed .tool-section,
.leftbar-collapsed .leftbar-title,
.leftbar-collapsed .leftbar-footer-btn:not(:first-child) { display: none; }
.leftbar-collapsed .leftbar-header { justify-content: center; padding: 4px; border: none; }
.leftbar-collapsed .leftbar-toggle svg { transform: rotate(180deg); }
/* Tree drag & drop indicators */
.tree-drag-before { border-top: 2px solid var(--color-primary); }
.tree-drag-after { border-bottom: 2px solid var(--color-primary); }
.tree-drag-inside { background: var(--color-surface-2); outline: 2px solid var(--color-primary); outline-offset: -2px; }
.tree-dragging { opacity: 0.5; }
+15
View File
@@ -87,6 +87,18 @@ export interface LeftSidebarProps {
onTemplateSelect?: (templateName: string | null) => void; onTemplateSelect?: (templateName: string | null) => void;
onCollapse?: () => void; onCollapse?: () => void;
className?: string; className?: string;
collapsed?: boolean;
onToggleCollapse?: () => void;
blocks?: BlockDefinition[];
onDragBlock?: (blockId: string) => void;
onBlockDrop?: (blockId: string, x: number, y: number) => void;
onBlockCategoryChange?: (cat: string) => void;
onBlockSearch?: (query: string) => void;
onRenameBlock?: (id: string, name: string) => void;
onDuplicateBlock?: (id: string) => void;
onDeleteBlock?: (id: string) => void;
onSvgImport?: (svg: string, name: string, category: string) => void;
onSaveGroupAsBlock?: (name: string) => void;
} }
export interface CanvasAreaProps { export interface CanvasAreaProps {
@@ -160,12 +172,15 @@ export interface RightSidebarProps {
onUpdateElement?: (el: CADElement) => void; onUpdateElement?: (el: CADElement) => void;
className?: string; className?: string;
onCollapse?: () => void; onCollapse?: () => void;
collapsed?: boolean;
onToggleCollapse?: () => void;
} }
export interface PropertiesPanelProps { export interface PropertiesPanelProps {
selectedElement: CADElement | null; selectedElement: CADElement | null;
layers: CADLayer[]; layers: CADLayer[];
onUpdateProperty: (key: string, value: unknown) => void; onUpdateProperty: (key: string, value: unknown) => void;
onDelete?: () => void;
} }
export interface LayerPanelProps { export interface LayerPanelProps {