Skip to content

ref: extract makeScreen factory and clean up drop/toast handling#22

Merged
trmquang93 merged 1 commit intomainfrom
ref/screen-factory-drop-cleanup
Apr 3, 2026
Merged

ref: extract makeScreen factory and clean up drop/toast handling#22
trmquang93 merged 1 commit intomainfrom
ref/screen-factory-drop-cleanup

Conversation

@trmquang93
Copy link
Copy Markdown
Collaborator

Summary

  • Extract makeScreen() factory function in useScreenManager.js to eliminate ~60 lines of duplicated screen object literals across 4 call sites
  • Decouple handleCanvasDrop from DragEvent — now accepts a files array directly, making it easier to test and reuse
  • Broaden canvas drop image filter from png/jpeg only to any image/* type
  • Add Z_INDEX.toast constant and toastTimerRef cleanup on unmount
  • Replace hardcoded rgba(97,175,239,0.08) with COLORS.accent008 in drop overlay
  • Default gridPositions rowGap to GRID_MARGIN instead of hardcoded 60

Test plan

  • Drop PNG/JPEG images onto canvas — screens created correctly
  • Drop other image types (e.g. WebP, GIF) — screens created correctly
  • Toast appears above all other UI elements
  • No memory leak from toast timer on unmount
  • Add state variant — new screen inherits correct defaults

- Extract makeScreen() factory to eliminate duplicated screen object
  literals across addScreen, addScreenAtCenter, addScreensBatch,
  and addStateVariant
- Decouple handleCanvasDrop from DragEvent — accept files array directly
- Broaden drop image filter to any image/* type (not just png/jpeg)
- Add toast z-index constant and toastTimerRef cleanup on unmount
- Replace hardcoded rgba with COLORS.accent008 in CanvasArea drop overlay
- Default gridPositions rowGap to GRID_MARGIN instead of hardcoded 60
@trmquang93 trmquang93 merged commit 2c206b6 into main Apr 3, 2026
1 check passed
@trmquang93 trmquang93 deleted the ref/screen-factory-drop-cleanup branch April 3, 2026 00:02
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