From d3c1f0a137ba05f8f108d4ed1e0c2eeb88dd57c3 Mon Sep 17 00:00:00 2001 From: Lucas 'Paperboy' Rose-Winters Date: Sun, 2 Nov 2025 10:23:36 +1100 Subject: [PATCH] feat(dashboard): integrate tracker editor with widget system Implemented hierarchical customization where trackerConfig controls content (fields, names, AI instructions) and dashboard controls layout (positioning, tabs, widget instances). Both systems now work together instead of conflicting. **Widget Integration:** - userStatsWidget: Respects trackerConfig for stat names and enable/disable - userStatsWidget: Supports per-widget stat filtering via config.visibleStats - userStatsWidget: Dynamically generates config options from trackerConfig - infoBoxWidgets: All widgets (calendar, weather, temperature, clock, location) check trackerConfig.infoBox.widgets.*.enabled before rendering - Widgets show "disabled" state with link to Tracker Settings when field disabled **Dashboard UI:** - Added Tracker Settings button to dashboard header (sliders icon) - Button opens tracker editor modal for global field configuration - Button positioned next to Edit Layout for clear separation of concerns **Tracker Editor:** - Added help text explaining relationship with dashboard system - Help text clarifies: Tracker Settings = content, Edit Layout = positioning - Styled with info banner at top of modal **Migration:** - Enhanced migrateV1ToV2Dashboard() to respect trackerConfig - Removes userStats widget if all stats disabled in trackerConfig - Removes presentCharacters widget if thoughts disabled in trackerConfig - Ensures smooth upgrade path from v1.x **CSS:** - Added .rpg-editor-help styling for tracker editor help banner - Added .rpg-widget-empty-state for disabled widget messaging - Info-style banner with icon and clear typography **Result:** Two-level customization system: 1. Tracker Settings (global): What fields exist, their names, AI instructions 2. Edit Layout (local): Where widgets appear, per-widget overrides Files modified: - src/systems/dashboard/widgets/userStatsWidget.js (+75 lines) - src/systems/dashboard/widgets/infoBoxWidgets.js (+67 lines) - src/systems/dashboard/dashboardIntegration.js (+15 lines) - src/systems/dashboard/dashboardTemplate.html (+4 lines) - src/systems/dashboard/defaultLayout.js (+22 lines) - template.html (+6 lines) - style.css (+58 lines) --- src/systems/dashboard/dashboardIntegration.js | 15 +++ src/systems/dashboard/dashboardTemplate.html | 4 + src/systems/dashboard/defaultLayout.js | 22 ++++- .../dashboard/widgets/infoBoxWidgets.js | 67 +++++++++++++ .../dashboard/widgets/userStatsWidget.js | 97 +++++++++++++++---- style.css | 58 +++++++++++ template.html | 6 ++ 7 files changed, 246 insertions(+), 23 deletions(-) diff --git a/src/systems/dashboard/dashboardIntegration.js b/src/systems/dashboard/dashboardIntegration.js index 5e77321..a1d932e 100644 --- a/src/systems/dashboard/dashboardIntegration.js +++ b/src/systems/dashboard/dashboardIntegration.js @@ -305,6 +305,21 @@ function setupDashboardEventListeners(dependencies) { }); } + // Tracker Settings button (open tracker editor modal) + const trackerSettingsBtn = document.querySelector('#rpg-dashboard-tracker-settings'); + if (trackerSettingsBtn) { + trackerSettingsBtn.addEventListener('click', () => { + console.log('[RPG Companion] Tracker Settings button clicked'); + // Trigger the tracker editor button from main UI + const trackerEditorBtn = document.getElementById('rpg-open-tracker-editor'); + if (trackerEditorBtn) { + trackerEditorBtn.click(); + } else { + console.warn('[RPG Companion] Tracker editor button not found'); + } + }); + } + // Done button (exit edit mode) const doneBtn = document.querySelector('#rpg-dashboard-done-edit'); if (doneBtn) { diff --git a/src/systems/dashboard/dashboardTemplate.html b/src/systems/dashboard/dashboardTemplate.html index a3d420b..5b99601 100644 --- a/src/systems/dashboard/dashboardTemplate.html +++ b/src/systems/dashboard/dashboardTemplate.html @@ -20,6 +20,10 @@ + + + +
+ + Tracker Settings control available fields, names, and AI instructions. To arrange widgets on your dashboard, use Edit Layout mode. +
+