Replace frontend with deployed TS version from a08dd73

- Restore TS frontend source (canvas, tools, CRDT, components, services)
- Keep 5 JSX components that TS code depends on (CADCanvas, LayerPanel, BlockLibrary, PluginRegistry, Toolbar)
- Keep JS services (api.js, blockService.js) that components depend on
- Fix vite/plugin-react version mismatch (downgrade to v4 for vite 6)
- Add axios dependency
- Skip tsc in build script (vite/esbuild handles transpilation)
- Fix index.html lang=de, favicon path
- Add vite proxy config for /api and /ws
- Backend unchanged (already from deployed containers)
This commit is contained in:
Agent Zero
2026-06-28 02:16:58 +02:00
parent 6e508fb68e
commit 05ccebad8d
89 changed files with 12577 additions and 1231 deletions
+31
View File
@@ -43,6 +43,37 @@ const CADCanvas = forwardRef(({ activeTool, setActiveTool, onCanvasReady }, ref)
if (shape) fabricRef.current.add(shape);
});
fabricRef.current.renderAll();
},
// Get selected elements for block creation
getSelectedElements: () => {
if (!fabricRef.current) return [];
const activeObject = fabricRef.current.getActiveObject();
if (!activeObject) return [];
// If it's a group, return all objects in the group
if (activeObject.type === 'group') {
return activeObject.getObjects().map(obj => ({
id: obj.id || Date.now() + Math.random(),
type: obj.type,
...obj.toObject(['id', 'type', 'left', 'top', 'width', 'height', 'radius', 'x1', 'y1', 'x2', 'y2', 'points', 'fill', 'stroke', 'strokeWidth'])
}));
}
// If it's a single object, return it
return [{
id: activeObject.id || Date.now() + Math.random(),
type: activeObject.type,
...activeObject.toObject(['id', 'type', 'left', 'top', 'width', 'height', 'radius', 'x1', 'y1', 'x2', 'y2', 'points', 'fill', 'stroke', 'strokeWidth'])
}];
},
// Generate SVG data for selected elements
generateSvgData: () => {
if (!fabricRef.current) return '';
const activeObject = fabricRef.current.getActiveObject();
if (!activeObject) return '';
// Clone the object to avoid modifying the original
return activeObject.toSVG();
}
}));