Skip to content

Add a named canvas with click-to-edit toolbar field#92

Merged
mucow24 merged 2 commits into
mainfrom
claude/elegant-shamir-ad35f3
Apr 30, 2026
Merged

Add a named canvas with click-to-edit toolbar field#92
mucow24 merged 2 commits into
mainfrom
claude/elegant-shamir-ad35f3

Conversation

@mucow24
Copy link
Copy Markdown
Owner

@mucow24 mucow24 commented Apr 30, 2026

Summary

  • Adds a name field to ProjectDocument (default "Untitled canvas") with a new set_canvas_name reducer command — undoable like set_background.
  • Renders the name prominently in the top toolbar between the File menu and the Canvas focus icon. Clicking the name opens an inline input that commits on Enter or blur, cancels on Escape, and falls back to the default if the user clears it.
  • Drives PNG export and JSON save filenames via a shared sanitizeBasename helper, so multiple projects no longer collide on `billboard-export.png` / `billboard-project.json`.

Notes for reviewers

  • Schema treats `name` as optional and the normaliser fills the default; legacy saved files load without changes.
  • File IO primitives stay dumb — sanitisation lives in src/editor/io/filename.ts with focused unit tests. `downloadCanvasAsPng` already took a `fileName`; `downloadProject` gains an optional one with the previous default preserved.
  • App.tsx dispatches `set_canvas_name` inline, matching how `set_background` is wired (no new store action).
  • Two pre-existing assertions on `downloadCanvasAsPng` (App integration + useEditorController) updated to include the new filename argument.

Test plan

  • `npm run lint && npm run typecheck` — clean
  • `npm test` — 657 / 657 pass (new tests for sanitiser, reducer, schema/normaliser/codec/defaults, toolbar, project file)
  • `npm run e2e -- editor.files-and-persistence` — new spec exercises default → rename → save filename → reload restoration → load file restores name → export filename
  • Manual preview verification (per project convention) — confirmed by author

🤖 Generated with Claude Code

mucow24 and others added 2 commits April 30, 2026 16:00
ProjectDocument now carries a `name` (default "Untitled canvas") that
participates in undo/redo via a new `set_canvas_name` reducer command,
serialises into the saved JSON, and drives the export/save filenames
via a shared `sanitizeBasename` helper so multiple projects no longer
collide as `billboard-export.png` / `billboard-project.json`.

The toolbar shows the name prominently between the File menu and the
Canvas focus icon. Clicking it opens an inline input that commits on
Enter or blur, cancels on Escape, and falls back to the default when
the user clears it. Legacy saved files load correctly: the schema
treats `name` as optional and the normaliser fills the default.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@mucow24 mucow24 merged commit 7562175 into main Apr 30, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant