feat: Implement localStorage persistence for UI panel resize states in Draft and Deck views.

This commit is contained in:
2025-12-18 02:09:44 +01:00
parent db601048d9
commit e6e452b030
4 changed files with 45 additions and 4 deletions

View File

@@ -108,3 +108,4 @@
- [Pool Card Sizing](./devlog/2025-12-18-042500_pool_card_sizing.md): Completed. Fixed "enormous" card bug in horizontal pool by enforcing percentage-based height constraint.
- [Final Pool Layout Fix](./devlog/2025-12-18-043500_pool_sizing_final.md): Completed. Overhauled flex layout for Horizontal Pool to ensure card images scale 1:1 with panel height during resize, removing layout-blocking transitions.
- [Pool Overflow Constraint](./devlog/2025-12-18-044500_pool_overflow_fix.md): Completed. Enforce flex shrinkage with `min-h-0` and `overflow-hidden` to strictly bind card height to resizeable panel.
- [Resize Persistence](./devlog/2025-12-18-050000_resize_persistence.md): Completed. Implemented `localStorage` persistence for Sidebars and Pool Panels in both Draft and Deck Views.

View File

@@ -0,0 +1,18 @@
# Work Plan - Persist Resize State
## Request
The user wants resized areas (sidebar and pool) to be remembered (persisted) so they reopen with the same sizes.
## Changes
- **DraftView.tsx**:
- Updated initialization of `sidebarWidth` state to read from `localStorage.getItem('draft_sidebarWidth')`.
- Added `useEffect` to save `sidebarWidth` to `localStorage` whenever it changes.
- Verified `poolHeight` persistence logic already exists.
- **DeckBuilderView.tsx**:
- Updated initialization of `sidebarWidth` and `poolHeightPercent` to read from `localStorage` keys `deck_sidebarWidth` and `deck_poolHeightPercent`.
- Added `useEffect` hooks to persist both values to `localStorage`.
- Added `useEffect` to imports (fixed lint error).
## Verification
- **Test**: Refreshing the page after resizing the sidebar or pool panel should restore the previous dimensions exactly.