Skip to content

Conversation

@CodeWithBehnam
Copy link
Owner

Summary

  • Create src/lib/constants.ts with all magic strings and repeated values
  • Centralize localStorage keys, node paths, drag data types, size limits, error messages
  • Update 12 files to import and use the centralized constants
  • Fix lint errors in test files

Changes

  • New file: src/lib/constants.ts - Central location for all magic strings
  • Updated: 12 source files and 2 test files to use constants

Test plan

  • Run bun run typecheck - passes
  • Run bun run lint - passes
  • Run bun run test:run - all 27 tests pass
  • Verify app still works correctly with the refactored code

Behnam Ebrahimi

- Create src/lib/constants.ts with all magic strings:
  - STORAGE_KEYS for localStorage keys
  - PNG_WORKFLOW_KEY for workflow metadata
  - NODE_PATHS for all node type paths
  - DRAG_DATA_TYPES for drag-and-drop data transfer
  - SIZE_LIMITS for file size thresholds
  - ERROR_MESSAGES with factory functions
  - MIME_TYPES and image format helpers
  - ASPECT_RATIOS and model name constants

- Update 12 files to use centralized constants:
  - workflow-storage.ts
  - useClipboard.ts
  - png-metadata.ts
  - graph-executor.ts
  - WorkflowCanvas.tsx
  - ContextMenu.tsx
  - ImageHistory.tsx
  - SettingsDialog.tsx
  - ErrorBoundary.tsx
  - ImageHistoryContext.tsx
  - prompt-templates.ts
  - Test files

- Fix lint errors in test files (unused variables, empty blocks)

Co-Authored-By: Behnam & Claude Code
@CodeWithBehnam CodeWithBehnam merged commit 56407ea into main Dec 25, 2025
2 checks passed
@CodeWithBehnam CodeWithBehnam deleted the refactor/extract-constants branch December 25, 2025 17:29
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.

2 participants