Commit Graph

36 Commits

Author SHA1 Message Date
Leopoldadmin 3cbcba11bb docs: add complete codebase analysis report (50 issues documented) 2026-06-29 22:36:46 +02:00
Leopoldadmin 463aa2ef77 fix: collab sync overwrites blocks with empty array
- collab.blocks sync had no guard against empty arrays
- when project loads, collab syncs empty blocks from server
- this overwrites createDefaultBlocks() with empty array
- added if (collab.blocks.length > 0) guard, same as layers
2026-06-29 16:44:38 +02:00
Leopoldadmin 1b2d6815cb fix: remove Bibliothek from left sidebar (was always on right)
- Removed BlockLibrary section from LeftSidebar.tsx
- Removed unused BlockLibrary import
- Removed unused block-related props from LeftSidebar destructuring
- Bibliothek belongs in right sidebar as a tab (already existed there)
2026-06-29 13:35:50 +02:00
Leopoldadmin 2c6f7b2e8b fix: Bibliothek section always visible in left sidebar
- LeftSidebar was hiding entire Bibliothek section when blocks array was empty
- Removed blocks.length > 0 conditional wrapper
- Added blocks || [] fallback to prevent crash
- Library tree now visible even with no blocks
2026-06-29 13:13:43 +02:00
Leopoldadmin ba978cd13c 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
2026-06-29 10:44:53 +02:00
Leopoldadmin 6b0b637636 fix: collab sync no longer overwrites layers with empty array
- Root cause: App.tsx collab sync effect called setLayers(collab.layers)
  even when collab.layers was empty, wiping out initialLayers
- Effect: RenderEngine.render() iterates layers to draw elements;
  with 0 layers, no elements render (appear to disappear)
- Fix: guard against empty collab.layers

Fixes: drawing tools work on desktop and mobile, objects persist after release
2026-06-29 00:34:39 +02:00
Leopoldadmin db2b70f15b fix: touch release confirms drawing tool
- Add pointercancel listener (treated same as pointerup)
- Remove e.preventDefault() from pointerdown/pointerup (was suppressing touch events)
- Expand onMouseUp tool list: arc, polygon, revcloud now confirm on release

Fixes: object disappears on touch release, tools work same on mobile as desktop
2026-06-28 23:54:07 +02:00
Leopoldadmin 88ddebcd86 fix: drawing tools use pointer events for mouse+touch support
- InteractionEngine: pointerdown on canvas, pointermove/pointerup on document

- Pointer capture for smooth dragging outside canvas

- CSS: touch-action: none on canvas to prevent browser touch interception

- Fixes: tools not working on desktop (mouseup lost outside canvas) and mobile (no touch support)
2026-06-28 23:15:48 +02:00
Leopoldadmin 3f93a236e1 fix: add close buttons to mobile sidebars
- RightSidebar: added onCollapse prop and close button in header

- LeftSidebar: wired existing onCollapse prop in App.tsx

- CSS: show .leftbar-toggle and .rightbar-close on mobile

- Both buttons call setMobile{Left,Right}Open(false) to close overlays
2026-06-28 22:35:33 +02:00
Leopoldadmin 8c878e4bba fix: hide empty MobileDrawers overlays that covered real sidebar content on mobile
- MobileDrawers component rendered empty drawer-left/drawer-right overlays
- These had drawer-body with 0 children, covering the real leftbar/rightbar
- Real sidebars with actual content now visible as slide-in overlays
2026-06-28 18:26:47 +02:00
Leopoldadmin 0785efbbc5 fix: mobile sidebar tool labels visible + scrollable overflow
- overflow-y: auto on mobile sidebars so all tools are reachable
- Re-enable tool-section-label, tool-btn-label, leftbar-title on mobile
- Tool grid 2-column with labels for better mobile UX
2026-06-28 18:19:35 +02:00
Leopoldadmin 7b4a45df49 fix: mobile sidebar slide-in overlay with hamburger and panel toggle buttons
- LeftSidebar/RightSidebar: added className prop for 'open' class
- Topbar: wired hamburger onClick + added mobile-drawer-toggle button for right panel
- App.tsx: added SettingsModal import/state/render, passed className props to sidebars
- styles.css: mobile sidebars now fixed slide-in overlays (translateX) instead of display:none
- ui.types.ts: added className to RightSidebarProps, onOpenLeftDrawer/onOpenRightDrawer to TopbarProps
- Tested at 390px viewport: both sidebars slide in correctly, transform verified via DOM
2026-06-28 17:55:26 +02:00
Leopoldadmin e2bba8b882 fix: add Content-Type header to createProjectShare API call 2026-06-28 14:37:49 +02:00
Leopoldadmin e9b6f188c8 fix: security and UX improvements for notifications and shares
- Add ownership checks on all notification and share routes (403 Forbidden)
- Validate permission field (only view/edit/admin allowed)
- Remove user_id from POST notifications (only self-notifications)
- Add getNotification/getProjectShare to DB interface + adapter
- Add res.ok checks on all frontend API calls
- Add click-outside handler for notification dropdown
- Add initial notification load on mount for badge count
- Add email validation + duplicate check in ShareDialog
- Add Enter key handler in ShareDialog
- Add submitting state to prevent double-click
- Guard against null token in Dashboard
2026-06-28 14:16:50 +02:00
Leopoldadmin 20432f4b47 feat: add notifications and project shares features
- Backend: notifications + shares routes, DB tables, SqliteAdapter methods
- Frontend: NotificationPanel (bell icon + dropdown), ShareDialog, Dashboard integration
- Styles: notification + share dialog CSS
2026-06-28 13:59:49 +02:00
Leopoldadmin a4371ca3ce fix: layer panel collapsible tree + element actions (visibility toggle, delete) + RenderEngine skips invisible elements 2026-06-27 23:59:12 +02:00
Leopoldadmin affa6be151 feat: layer panel with element tree - shows layers + elements as children with count badges, sub-layers supported 2026-06-27 14:27:34 +02:00
Leopoldadmin 4303076ce4 feat: click-drag drawing, layer tree, settings modal, UI improvements
- interaction: click-drag drawing for 2-point tools (line, rect, circle, dimension, leader)
- interaction: preview rendering during drag with setPreviewElement
- interaction: handleDrawDown only sets phase=drawing on first point
- CanvasArea: sync activeLayerId to LayerManager
- CanvasArea: callback refresh useEffect prevents stale closures
- App.tsx: functional setElements updates for handleElementCreated/Deleted/Modified
- LayerPanel: tree structure with sub-layers (onReorder, onAddSubLayer)
- TreeView: drag-and-drop reordering support
- RightSidebar: onReorder, onAddSubLayer, onUpdateElement props
- PropertiesPanel: onUpdateElement prop
- SettingsModal: personal/password/language/theme/users/plugins/AI tabs
- styles.css: extensive UI styling additions
- types: updated RightSidebarProps, CanvasAreaProps, LayerPanelProps
2026-06-27 14:12:37 +02:00
Leopoldadmin 39422a4348 fix: layer IDs globally unique - use timestamp-based IDs instead of hardcoded layer-0/1/2/3/4
Root cause: layers.id is TEXT PRIMARY KEY (global unique across all drawings).
Hardcoded IDs layer-0..layer-4 collided when multiple projects tried to create
the same layer IDs. Second project got UNIQUE constraint failed on POST /layers.
Without layers, elements had dangling layer_id refs causing FOREIGN KEY errors.

Fix: makeInitialLayers() generates unique IDs: layer-{timestamp}-{index}.
activeLayerId initialized from first layer, not hardcoded.
activeLayerName uses activeLayerId variable, not hardcoded layer-0.
On project load with existing layers, activeLayerId set from first DB layer.
2026-06-26 20:53:41 +02:00
Leopoldadmin 7ad0e11873 fix: element creation fails with empty layer_id (FOREIGN KEY constraint)
Three fixes:
1. interaction/index.ts: Add layerId to created element in confirmDraw()
2. CanvasArea.tsx: Sync layers to LayerManager via layerManagerRef
3. App.tsx: Fallback to activeLayerId in handleElementCreated if layerId missing

Root cause: LayerManager.activeLayerId was empty because layers were never
synced from React state to the interaction layer LayerManager. New elements
got layer_id="" which failed SQLite FOREIGN KEY constraint.

Also includes Yjs sync race condition fix from previous commit.
2026-06-26 20:31:50 +02:00
Leopoldadmin bd8bedcfed fix: remove debug console.log from InteractionEngine - tools verified working 2026-06-26 19:24:12 +02:00
Leopoldadmin f9f31db933 debug: add console.log to InteractionEngine to trace drawing flow 2026-06-26 19:01:45 +02:00
Leopoldadmin 7e530dd09a fix: stale closure bug preventing canvas tools from creating elements
- CanvasArea: add useEffect to refresh InteractionEngine callbacks when props change
- App.tsx: handleElementCreated/Deleted/Modified now use functional setElements updates
- Root cause: CanvasArea init useEffect had empty deps, capturing stale callbacks at mount
- handleElementCreated used [...elements, el] with stale elements=[] closure
- Each new element replaced all previous ones instead of appending
- All 343 tests pass, tsc clean
2026-06-26 18:57:09 +02:00
Leopoldadmin 3bec3938d0 fix: ribbon tabs now show per-tab content; add all missing handleRibbonAction handlers
- RibbonBar: conditional rendering per activeTab (start/insert/format/view/tools/ki)
- App.tsx: add onNavigateBack prop for new/open navigation
- App.tsx: implement handlers for new, open, save, copy, paste, zoom-fit, zoom-100, grid, layer, measure, search, plugins, ki, ki-draw, ki-analyze
- App.tsx: implement insert-line, insert-rect, insert-circle, insert-text, insert-freehand, insert-image
- App.tsx: implement format-* placeholder actions
- App.tsx: add clipboard state for copy/paste
- All 343 tests pass, tsc clean
2026-06-26 18:49:16 +02:00
Leopoldadmin ef23463a74 fix: CSS layout - .main → .app-body selector mismatch caused sidebar full-width
The component uses className="app-body" but CSS targeted .main for the grid layout.
This caused leftbar, canvas, and rightbar to all render at full viewport width
instead of the 3-column grid (leftbar 64px | canvas 1fr | rightbar 240px).
2026-06-26 18:37:20 +02:00
Leopoldadmin 6d15a692af fix: WebSocket wss:// same-origin URL + try/catch to prevent crash on HTTPS
- Change DEFAULT_WS_URL from ws://hostname:3001 to wss://window.location.host
- Wrap WebSocket constructor in try/catch to prevent React crash on connection error
- Fixes white page when opening a project (CADEditor crashed on insecure ws:// from HTTPS page)
2026-06-26 17:58:06 +02:00
Leopoldadmin 1bcfaffdd4 fix: replace hardcoded localhost:3001 with relative API URL + add canvas mock and integration test
- Fix frontend Network error: API_BASE now defaults to empty string (same-origin)
- Fix 3 files: api.ts, AuthContext.tsx, Dashboard.tsx
- Add Canvas 2D context mock in tests/setup.ts for jsdom
- Fix -0 vs +0 in ZoomPanController.getViewport()
- Add IntegrationWorkflow.test.ts (35 tests, full CAD workflow)
2026-06-26 17:48:24 +02:00
Leopoldadmin 89b91a1050 test: T29-T31 component tests (20) + frontend stresstest (7) + backend DB stresstest (6) with 50k elements 2026-06-26 16:20:09 +02:00
Leopoldadmin 1d6c2cb30e feat: T27 AuthService DB session persistence - replace in-memory Map with SQLite sessions table 2026-06-26 14:55:38 +02:00
Leopoldadmin 04271d4cbd ci: test webhook v4 2026-06-26 14:34:05 +02:00
Leopoldadmin 85c26b7826 ci: test webhook v3 2026-06-26 14:32:10 +02:00
Leopoldadmin 3876a22dd6 ci: test webhook pipeline v2 2026-06-26 14:28:02 +02:00
Leopoldadmin b195858b12 ci: test webhook pipeline 2026-06-26 14:26:50 +02:00
Leopoldadmin f853372c90 test: add Vitest setup with 115 tests (backend + frontend) 2026-06-26 14:19:50 +02:00
Leopoldadmin 19884b7b5d fix: use Docker resolver for backend DNS in nginx.conf 2026-06-26 11:01:03 +02:00
Leopoldadmin 4ec76fe406 feat: initial commit web-cad-neu with docker-compose, frontend and backend 2026-06-26 10:50:24 +02:00