Commit Graph

2 Commits

Author SHA1 Message Date
Lucas 'Paperboy' Rose-Winters 122bb3194a feat(dashboard): add auto-layout button with smart widget packing
Implements intelligent auto-layout system that efficiently arranges widgets to maximize space usage while respecting panel width constraints.

**Key Features:**
- Smart packing algorithm that sorts by widget area and finds optimal positions
- Respects responsive column count (2-4 columns based on panel width)
- Prefers full-width widgets when possible to eliminate gaps
- Fallback to narrower widths for better vertical packing
- Maintains minimum widget sizes

**Implementation:**
- GridEngine.autoLayout() - Core packing algorithm with collision detection
- DashboardManager.autoLayoutWidgets() - High-level API that re-renders after layout
- Auto-Arrange button in dashboard header (uses fa-table-cells-large icon)
- Event handler wired to call autoLayoutWidgets with preferFullWidth=true

**Algorithm Strategy:**
1. Sort widgets by area (largest first) for efficient packing
2. For each widget, try full-width placement first
3. Find first available position using row-by-row scan
4. If position is too far down, try narrower widths
5. Mark cells as occupied to prevent overlaps

**Testing Notes:**
- Works with current responsive column system (2-4 columns)
- Respects minimum sizes and column constraints
- Re-renders all widgets after repositioning
- Auto-saves layout changes

Part of Epic 2: Dashboard Widget Library
2025-10-23 14:00:00 +11:00
Lucas 'Paperboy' Rose-Winters f9c483d848 feat: Phase 1 complete + Task 2.1 User Stats Widget
Phase 1 Foundation:
- DashboardManager: Complete orchestrator for all Epic 1 systems (572 lines)
- WidgetBase: Common utilities for widget development (498 lines)

Task 2.1 User Stats Widget:
- Extracted and refactored from renderUserStats()
- Clean vanilla JS implementation (408 lines)
- Editable stat values with live updates
- Progress bars with configurable colors
- User portrait, name, and level display
- Classic D&D stats (STR/DEX/CON/INT/WIS/CHA) with +/- buttons
- Fully configurable (show/hide sections, visible stats)
- Mobile-responsive with layout adjustments
- No jQuery dependencies

Dashboard Manager features:
- Widget lifecycle management (add/remove/update)
- Tab coordination with TabManager
- Drag/drop and resize integration
- Edit mode management
- Layout persistence (save/load/export/import)
- Auto-save with debouncing
- Event-driven architecture

Epic 2 progress: 1/4 core widgets complete
2025-10-23 10:47:39 +11:00