No "Open in Workspace" / load-back action on Gallery designs #74

Closed
opened 2026-09-14 03:17:02 +00:00 by Mark · 2 comments
Owner

Where: src/components/gallery/DesignCard.tsx, src/components/gallery/RightClickMenu.tsx.

Bug:

  • Gallery cards expose: favorite, delete, duplicate, rename, move-to-folder. No way to load a saved design back into the Workspace.
  • Workspace state machine starts at 'empty' and only accepts a fresh file upload (useWorkspace.ts:325-371). No LOAD_DESIGN action.
  • Design type (src/components/gallery/types.ts) currently stores counts and thumbnailColors only — no geometry, so even if a "Load" button existed, there'd be nothing to load.

Fix consistent with existing patterns:
Mirror saveCurrentDesign (useWorkspace.ts:501-548) in reverse.

  1. Extend the persistence shape. In saveCurrentDesign (useWorkspace.ts:511-543), include the geometry:

    const design: Design = {
      ...existing fields,
      snapshot: { stitchObjects, threadStops, designSettings },
    };
    

    Add snapshot?: { stitchObjects: StitchObject[]; threadStops: ThreadStop[]; designSettings: DesignSettings } to the Design type.

  2. Add LOAD_DESIGN action to useWorkspace.ts's Action union and reducer:

    case 'LOAD_DESIGN': return pushHistory({
      ...state,
      stitchObjects: action.snapshot.stitchObjects,
      threadStops: action.snapshot.threadStops,
      designSettings: action.snapshot.designSettings,
      appState: 'digitized',
      uploadedImage: null,
      colorRegions: [],
    });
    
  3. Wire UI. Add onLoad to DesignCard and RightClickMenu props. On click: dispatch LOAD_DESIGN then navigate('/workspace'). Add an "Open in Workspace" entry to RightClickMenu and a play-icon button on DesignCard next to the existing favorite star.

Acceptance: opening a saved design loads its geometry into the Workspace canvas in digitized state with history snapshot taken so the user can undo the load.

**Where:** `src/components/gallery/DesignCard.tsx`, `src/components/gallery/RightClickMenu.tsx`. **Bug:** - Gallery cards expose: favorite, delete, duplicate, rename, move-to-folder. No way to load a saved design back into the Workspace. - Workspace state machine starts at `'empty'` and only accepts a fresh file upload (`useWorkspace.ts:325-371`). No `LOAD_DESIGN` action. - `Design` type (`src/components/gallery/types.ts`) currently stores counts and `thumbnailColors` only — no geometry, so even if a "Load" button existed, there'd be nothing to load. **Fix consistent with existing patterns:** Mirror `saveCurrentDesign` (`useWorkspace.ts:501-548`) in reverse. 1. **Extend the persistence shape.** In `saveCurrentDesign` (`useWorkspace.ts:511-543`), include the geometry: ```ts const design: Design = { ...existing fields, snapshot: { stitchObjects, threadStops, designSettings }, }; ``` Add `snapshot?: { stitchObjects: StitchObject[]; threadStops: ThreadStop[]; designSettings: DesignSettings }` to the `Design` type. 2. **Add `LOAD_DESIGN` action** to `useWorkspace.ts`'s `Action` union and reducer: ```ts case 'LOAD_DESIGN': return pushHistory({ ...state, stitchObjects: action.snapshot.stitchObjects, threadStops: action.snapshot.threadStops, designSettings: action.snapshot.designSettings, appState: 'digitized', uploadedImage: null, colorRegions: [], }); ``` 3. **Wire UI.** Add `onLoad` to `DesignCard` and `RightClickMenu` props. On click: dispatch `LOAD_DESIGN` then `navigate('/workspace')`. Add an "Open in Workspace" entry to `RightClickMenu` and a play-icon button on `DesignCard` next to the existing favorite star. Acceptance: opening a saved design loads its geometry into the Workspace canvas in `digitized` state with history snapshot taken so the user can undo the load.
Author
Owner

Reopening: the kilo-gsd run for #74 closed this issue but the user-visible bug is not fully fixed.

What landed (partial):

  • useWorkspace.ts got a LOAD_DESIGN reducer case (~L369) that consumes {stitchObjects, threadStops, designSettings} and transitions to 'digitized'.
  • saveCurrentDesign (~L653) now persists snapshot: {stitchObjects, threadStops, designSettings} into the saved Design.
  • Design type gained snapshot?: DesignSnapshot.

Both changes are bundled in commit 0399d0a (which the runner credited to a different issue). No commit references #74.

What's still missing (the actual user-facing bug):

  • src/components/gallery/DesignCard.tsx is unchanged since the project import (git log -- src/components/gallery/DesignCard.tsx shows only 1c11999 init: project bootstrap from archive).
  • L218, L222: the <DropdownMenuItem> "Open in Workspace" and "Open in Editor" items still have onClick={() => {}} (empty no-op).
  • L337, L347: the two hero buttons on the design card omit onClick entirely — clicking does nothing.

The LOAD_DESIGN reducer exists but nothing dispatches it. Closing this issue was premature.

Reopening: the kilo-gsd run for #74 closed this issue but the user-visible bug is not fully fixed. **What landed (partial):** - `useWorkspace.ts` got a `LOAD_DESIGN` reducer case (~L369) that consumes `{stitchObjects, threadStops, designSettings}` and transitions to `'digitized'`. - `saveCurrentDesign` (~L653) now persists `snapshot: {stitchObjects, threadStops, designSettings}` into the saved `Design`. - `Design` type gained `snapshot?: DesignSnapshot`. Both changes are bundled in commit `0399d0a` (which the runner credited to a different issue). No commit references #74. **What's still missing (the actual user-facing bug):** - `src/components/gallery/DesignCard.tsx` is **unchanged** since the project import (`git log -- src/components/gallery/DesignCard.tsx` shows only `1c11999 init: project bootstrap from archive`). - L218, L222: the `<DropdownMenuItem>` "Open in Workspace" and "Open in Editor" items still have `onClick={() => {}}` (empty no-op). - L337, L347: the two hero buttons on the design card omit `onClick` entirely — clicking does nothing. The `LOAD_DESIGN` reducer exists but nothing dispatches it. Closing this issue was premature.
Mark 2026-09-18 14:18:28 +00:00
Author
Owner

Fix landed on origin/main via two commits:

  • 48cb353 — feat(gallery): add Open in Workspace to load saved designs (#74) — wires DesignCard dropdown / hero / play-icon / RightClickMenu onLoad entries; adds LOAD_DESIGN reducer + sessionStorage bridge + issue-74.test.tsx (197 lines).
  • e5ead50 — fix(#74): snapshot pre-load state so UNDO after LOAD_DESIGN reverts to empty workspace — additional 429 lines of reducer + integration tests (issue-74-reducer.test.ts, pages/issue-74.test.tsx).

Monitor log confirms: all 8 Verify commands passed (vitest + lint + tsc), pushed to main, Forgejo close fired. Subsequent launcher runs blocked on prior in-progress card state — archive path.

Fix landed on origin/main via two commits: - 48cb353 — feat(gallery): add Open in Workspace to load saved designs (#74) — wires DesignCard dropdown / hero / play-icon / RightClickMenu onLoad entries; adds LOAD_DESIGN reducer + sessionStorage bridge + issue-74.test.tsx (197 lines). - e5ead50 — fix(#74): snapshot pre-load state so UNDO after LOAD_DESIGN reverts to empty workspace — additional 429 lines of reducer + integration tests (issue-74-reducer.test.ts, pages/issue-74.test.tsx). Monitor log confirms: all 8 Verify commands passed (vitest + lint + tsc), pushed to main, Forgejo close fired. Subsequent launcher runs blocked on prior in-progress card state — archive path.
Sign in to join this conversation.
No description provided.