diff --git a/src/systems/dashboard/dashboardManager.js b/src/systems/dashboard/dashboardManager.js index f1e0390..e3c8842 100644 --- a/src/systems/dashboard/dashboardManager.js +++ b/src/systems/dashboard/dashboardManager.js @@ -804,9 +804,9 @@ export class DashboardManager { // Specific widget type ordering within user category const userWidgetOrder = { - 'userInfo': 1, // Name/level at top - 'userStats': 2, // Health/energy bars - 'userMood': 3, // Mood + 'userInfo': 1, // Name/level at top-left + 'userMood': 2, // Mood at top-right (before stats so it sits beside userInfo) + 'userStats': 3, // Health/energy bars (after mood, goes below userInfo+mood) 'userAttributes': 4 // STR/DEX/etc }; @@ -1231,8 +1231,17 @@ export class DashboardManager { const definition = this.registry.get(widget.type); if (definition && definition.defaultSize) { const oldSize = `${widget.w}x${widget.h}`; - widget.w = definition.defaultSize.w; - widget.h = definition.defaultSize.h; + + // Support defaultSize as function (column-aware sizing) + let defaultSize; + if (typeof definition.defaultSize === 'function') { + defaultSize = definition.defaultSize(this.gridEngine.columns); + } else { + defaultSize = definition.defaultSize; + } + + widget.w = defaultSize.w; + widget.h = defaultSize.h; const newSize = `${widget.w}x${widget.h}`; if (oldSize !== newSize) { console.log(`[DashboardManager] Reset ${widget.type} from ${oldSize} to ${newSize}`); diff --git a/src/systems/dashboard/widgetRegistry.js b/src/systems/dashboard/widgetRegistry.js index 8af7a09..8ce572c 100644 --- a/src/systems/dashboard/widgetRegistry.js +++ b/src/systems/dashboard/widgetRegistry.js @@ -87,7 +87,10 @@ export class WidgetRegistry { if (!definition.minSize.w || !definition.minSize.h) { throw new Error('[WidgetRegistry] Widget minSize must have w and h properties'); } - if (!definition.defaultSize.w || !definition.defaultSize.h) { + // defaultSize can be a function (column-aware) or static object + if (typeof definition.defaultSize === 'function') { + // If function, we can't validate until runtime, skip validation + } else if (!definition.defaultSize.w || !definition.defaultSize.h) { throw new Error('[WidgetRegistry] Widget defaultSize must have w and h properties'); } diff --git a/src/systems/dashboard/widgets/userInfoWidget.js b/src/systems/dashboard/widgets/userInfoWidget.js index 59dfd00..8b12a7d 100644 --- a/src/systems/dashboard/widgets/userInfoWidget.js +++ b/src/systems/dashboard/widgets/userInfoWidget.js @@ -38,13 +38,19 @@ export function registerUserInfoWidget(registry, dependencies) { description: 'User avatar, name, and level display', category: 'user', minSize: { w: 1, h: 1 }, - defaultSize: { w: 1, h: 1 }, // Start compact (1x1), expansion will grow it based on columns - // Column-aware max size: mobile (2-col) stays 1x1, desktop (3-4 col) expands vertically to 1x2 + // Column-aware default size: start at 2x1 in desktop so mood doesn't block expansion + defaultSize: (columns) => { + if (columns <= 2) { + return { w: 1, h: 1 }; // Mobile: compact 1x1 + } + return { w: 2, h: 1 }; // Desktop: 2x1 from the start + }, + // Column-aware max size: same as defaultSize to prevent further expansion maxAutoSize: (columns) => { if (columns <= 2) { return { w: 1, h: 1 }; // Mobile: stay compact to allow mood widget beside it } - return { w: 1, h: 2 }; // Desktop: expand vertically, mood fits top-right + return { w: 2, h: 1 }; // Desktop: 2x1, mood sits in top-right }, requiresSchema: false, diff --git a/style.css b/style.css index fe5f7bb..66d67dd 100644 --- a/style.css +++ b/style.css @@ -4323,7 +4323,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld { /* User Stats Widget - add bottom padding to prevent last bar (Arousal) from being clipped */ .rpg-widget .rpg-stats-grid { - padding-bottom: 0.3rem !important; + padding-bottom: 0.5rem !important; } /* Mood Widget - increase conditions text size for readability */