feat: implement responsive dashboard layout with column-aware widget sizing

**Status Tab Layout Changes:**
- User Info widget: 1x2 vertical (left column) instead of 2x1 horizontal
- User Stats widget: scales from 1x3 (narrow) to 2x3 (wide)
- User Mood widget: 1x1 positioned below User Info
- User Attributes widget: scales from 2x4 (narrow) to 3x4 (wide), full width

**Technical Changes:**
- Update widget definitions to use column-aware defaultSize() functions
- userInfoWidget: Returns 1x2 for desktop, 1x1 for mobile
- userStatsWidget: Returns 1x3 for 2 cols, 2x3 for 3+ cols
- userAttributesWidget: Returns 2x4 for 2 cols, 3x4 for 3+ cols
- Remove autoLayout from resetLayout() to preserve default positions
- Add resetWidgetSizesToDefault() to apply column-aware sizes
- Update CSS for 1x1 compact avatar (round) and 1x2 wide avatar layouts

**User Info Widget Improvements:**
- 1x2 layout: Horizontal split with name left, level right over avatar
- 1x1 layout: Round avatar with bottom nameplate (flush positioning)
- Transparent glass-style backgrounds for better avatar visibility
- Proper aspect-ratio for circular avatar in compact mode

**Result:**
- Widgets scale intelligently based on panel width (2-4 columns)
- Desktop users get larger, more spacious layouts
- Mobile/narrow screens get efficient vertical stacking
- Reset Layout respects custom positions while applying responsive sizes
- Window resize triggers autoLayout via ResizeObserver for reflow
This commit is contained in:
Lucas 'Paperboy' Rose-Winters
2025-11-06 20:42:57 +11:00
parent 43bcd14311
commit 8dc07a938a
6 changed files with 207 additions and 66 deletions
+132 -19
View File
@@ -1938,7 +1938,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
/* User info widget - avatar background with text overlay */
.rpg-user-info-container {
display: flex;
align-items: center;
align-items: flex-end;
justify-content: center;
height: 100%;
width: 100%;
@@ -1963,20 +1963,71 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
z-index: 1;
}
/* Text container with backdrop */
.rpg-user-info-text {
display: flex;
flex-direction: column;
gap: 0.2rem;
align-items: center;
text-align: center;
/* Round avatar image (used in 1x1 compact mode, hidden by default) */
.rpg-user-avatar-img {
display: none;
position: absolute;
width: 75%;
height: 75%;
object-fit: cover;
border-radius: 50%;
z-index: 0;
}
/* Name and level containers - base styles */
.rpg-user-name-container,
.rpg-user-level-container {
position: relative;
z-index: 2;
padding: 0.5rem 0.75rem;
background: rgba(0, 0, 0, 0.5);
padding: 0.3rem 0.6rem;
background: rgba(0, 0, 0, 0.15);
backdrop-filter: blur(4px);
border-radius: 0.375rem;
border: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
align-items: center;
justify-content: center;
}
/* WIDE LAYOUT (2x1+): Horizontal split over avatar background */
.rpg-user-info-wide .rpg-user-avatar-img {
display: none;
}
.rpg-user-info-wide .rpg-user-info-container::before {
display: block;
}
.rpg-user-info-wide .rpg-user-name-container {
position: absolute;
left: 0.5rem;
top: 50%;
transform: translateY(-50%);
max-width: 45%;
padding: 0.2rem 0.4rem;
}
.rpg-user-info-wide .rpg-user-level-container {
position: absolute;
right: 0.5rem;
top: 50%;
transform: translateY(-50%);
max-width: 35%;
padding: 0.2rem 0.4rem;
}
/* Smaller text for wide layout to prevent overlap */
.rpg-user-info-wide .rpg-user-name {
font-size: 0.7rem;
}
.rpg-user-info-wide .rpg-level-label {
font-size: 0.6rem;
}
.rpg-user-info-wide .rpg-level-value {
font-size: 0.65rem;
padding: 0.1rem 0.3rem;
}
/* User name */
@@ -2029,27 +2080,89 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
background: var(--rpg-bg);
}
/* Compact mode for narrow widths (< 3 grid units) */
/* COMPACT LAYOUT (1x1): Round avatar with bottom nameplate */
.rpg-user-info-compact {
padding: 0.25rem !important;
align-items: center;
justify-content: center;
padding: 0 !important;
}
.rpg-user-info-compact .rpg-user-info-text {
gap: 0.15rem !important;
padding: 0.35rem 0.5rem !important;
/* Hide background image and overlay in 1x1 mode */
.rpg-user-info-compact {
background-image: none !important;
}
.rpg-user-info-compact::before {
display: none;
}
/* Show round avatar image - proper circle */
.rpg-user-info-compact .rpg-user-avatar-img {
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
height: 100%;
aspect-ratio: 1 / 1;
object-fit: cover;
object-position: center;
border-radius: 50%;
}
/* Name container at bottom - flush, no top/bottom padding on widget */
.rpg-user-info-compact .rpg-user-name-container {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 0.2rem 0.3rem;
border-radius: 0;
}
.rpg-user-info-compact .rpg-user-name {
font-size: 0.75rem !important;
font-size: 0.65rem;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Level container also at bottom, positioned next to name */
.rpg-user-info-compact .rpg-user-level-container {
position: absolute;
bottom: 0;
right: 0;
padding: 0.2rem 0.3rem;
border-radius: 0;
background: transparent;
border: none;
backdrop-filter: none;
}
.rpg-user-info-compact .rpg-user-level {
display: flex;
align-items: center;
gap: 0.2rem;
}
.rpg-user-info-compact .rpg-level-label {
font-size: 0.65rem !important;
font-size: 0.55rem;
font-weight: 600;
color: var(--rpg-text);
opacity: 0.7;
}
.rpg-user-info-compact .rpg-level-value {
font-size: 0.75rem !important;
padding: 0.1rem 0.3rem !important;
font-size: 0.65rem;
font-weight: 700;
color: var(--rpg-highlight);
padding: 0.1rem 0.3rem;
background: rgba(0, 0, 0, 0.3);
border-radius: 0.25rem;
min-width: 1.2rem;
text-align: center;
}
/* Stat bars - rem for text, vh for bar height */