Skip to content

Refactor codebase into testable lib modules and thin UI layers.#1

Merged
mdadul merged 2 commits into
mainfrom
cursor/foundation-code-quality-refactor
Jun 15, 2026
Merged

Refactor codebase into testable lib modules and thin UI layers.#1
mdadul merged 2 commits into
mainfrom
cursor/foundation-code-quality-refactor

Conversation

@mdadul

@mdadul mdadul commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Behavior-preserving foundation refactor that moves shared logic into src/lib/, thins Zustand stores and React components, and adds project docs — no intentional changes to editor UX, store action semantics, shortcuts, or export output.

  • Lib extractions + tests: templates (filter-templates, apply-template-to-screen), export (prepare-export-screen, export-form-state), canvas (coordinates, create-canvas-gradient), assets (persist-project-asset), elements (element-meta, selection-fields), constants barrel split, and shared test fixtures
  • Component / hook splits: ExportDialog tabs + reducers, CanvasWorkspace viewport/selection/drop/text-edit/screen-context hooks, PropertiesPanel and BackgroundControls per-section components, unified TemplateCard / FloatingMenu, useProjectsCatalog for landing
  • Store modularization: project-store delegates to stores/project/* (screen/element mutations, alignment, coalescing, template helpers)
  • Docs: Framekit README, CONTRIBUTING.md, MIT LICENSE, GitHub repo URL fix

Line-count highlights

File Before → After
CanvasWorkspace.tsx ~960 → ~551
PropertiesPanel.tsx ~727 → ~145
project-store.ts ~617 → ~441
ExportDialog.tsx large monolith → tab components + hooks
BackgroundControls.tsx ~500 → ~87 (+ background/ sections)
routes/index.tsx ~142 → ~28

Test plan

  • npm test — 67 tests passing
  • npm run build — TypeScript + Vite production build green
  • npm run lint — no new lint violations in touched files
  • Manual smoke: landing page → create/open project
  • Manual smoke: add/edit elements, undo/redo, template apply
  • Manual smoke: export preview + PNG/ZIP download
  • Manual smoke: .ssgproj import/export
  • Manual smoke: screen context menu + inline text edit on canvas

mdadul and others added 2 commits June 15, 2026 08:22
Extract shared business logic, split large panels and canvas hooks, and add Framekit docs without changing editor or export behavior.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@mdadul mdadul merged commit c1fe772 into main Jun 15, 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