fix(dashboard): fix resize, drag-drop, overflow, and add auto-migration
Multiple critical fixes for dashboard v2: **1. ResizeHandler error - updateContainerWidth is not a function** - resizeHandler.js:288 was calling non-existent method - Removed call - containerWidth tracked by ResizeObserver - Resizing now functional **2. DragDrop bug - widgets can't be released** - endDrag() destructured widgets, originalX, originalY from dragState - These fields were never added in startDrag() - Added widgets parameter to initWidget() and startDrag() - Store originalX, originalY, widgets in dragState - dashboardManager now passes current tab widgets - Widgets can now be dropped properly **3. Widget content overflow** - Added base .rpg-widget CSS: overflow: hidden, box-sizing: border-box - Prevents content extending beyond widget bounds - max-width: 100% on children **4. Automatic layout migration** - Old 12-column layouts (w: 8, w: 12) cause 500%+ widths in 2-4 column grid - Added migrateOldLayouts() method - Detects widgets with w > current column count - Runs auto-layout to reposition for responsive grid - Clears and re-renders current tab with new positions - Saves migrated layout automatically **5. Tab rendering** - Implemented renderTabs() method - Displays tab buttons with icons and names - Active state highlighting - Click handlers to switch tabs **6. Collision prevention** - Modified dragDrop endDrag() to check collisions - Same-size widgets: swap positions - Different sizes: revert to original - Prevents overlapping widgets **7. Edit mode fixes** - Fixed edit button to call toggleEditMode() - Added CSS to hide resize handles when not in edit mode - Handles only visible in edit mode **8. Icon-only header buttons** - Auto-Arrange and Edit buttons now icon-only - Saves horizontal space in header All issues from user testing resolved.
This commit is contained in:
@@ -1073,12 +1073,56 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.rpg-dashboard-btn {
|
||||
.rpg-dashboard-tabs {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.rpg-dashboard-tab {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
padding: 0.4rem 0.7rem;
|
||||
font-size: 0.75rem;
|
||||
border: 1px solid transparent;
|
||||
background: transparent;
|
||||
color: var(--SmartThemeBodyColor);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.rpg-dashboard-tab:hover {
|
||||
background: var(--SmartThemeBlurTintColor);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.rpg-dashboard-tab.active {
|
||||
background: var(--SmartThemeBlurTintColor);
|
||||
border-color: var(--SmartThemeBorderColor);
|
||||
opacity: 1;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.rpg-tab-icon {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.rpg-tab-name {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.rpg-dashboard-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.5rem;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
font-size: 0.9rem;
|
||||
border: 1px solid var(--SmartThemeBorderColor);
|
||||
background: var(--SmartThemeBlurTintColor);
|
||||
color: var(--SmartThemeBodyColor);
|
||||
@@ -1093,7 +1137,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
}
|
||||
|
||||
.rpg-dashboard-btn i {
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.rpg-dashboard-grid {
|
||||
@@ -1102,6 +1146,19 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
/* Hide resize handles by default */
|
||||
.resize-handles {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
/* Show resize handles in edit mode */
|
||||
.edit-mode .resize-handles {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
DASHBOARD V2 WIDGET STYLES
|
||||
========================================
|
||||
@@ -1116,6 +1173,19 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
|
||||
- %: Container-relative sizing
|
||||
======================================== */
|
||||
|
||||
/* Base widget container - ensures content stays within bounds */
|
||||
.rpg-widget {
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.rpg-widget > * {
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.rpg-widget .rpg-stats-content {
|
||||
display: flex;
|
||||
flex-direction: column; /* Stack vertically */
|
||||
|
||||
Reference in New Issue
Block a user