From 2ab48190ea73f4663099e8b27d1d9873a79f882c Mon Sep 17 00:00:00 2001 From: Lucas 'Paperboy' Rose-Winters Date: Tue, 4 Nov 2025 13:34:36 +1100 Subject: [PATCH] feat: Add Exit Edit Mode button visibility toggle and tab management UI Fix Exit Edit Mode button: - Move button before Lock button (left side as requested) - Add visibility toggle in editModeManager.js - Show done button when entering edit mode - Hide done button when exiting edit mode - Fixes critical bug where button stayed hidden permanently Add tab management UI: - Create promptDialog.js for text input modals (rename, create) - Create tabContextMenu.js with right-click context menu on tabs - Integrate with TabManager API for all operations: - Add New Tab (with validation) - Rename Tab (with validation) - Change Icon (icon picker with 20 common icons) - Duplicate Tab (copies widgets) - Delete Tab (with confirmation, blocks if last tab) - Auto-save after tab operations - Event delegation for dynamic tab elements Files changed: - dashboardTemplate.html: Move done button to correct position - editModeManager.js: Add visibility toggles in enter/exit methods - promptDialog.js: New dialog system for text input - tabContextMenu.js: New context menu system - dashboardIntegration.js: Initialize tab context menu --- src/systems/dashboard/dashboardIntegration.js | 19 + src/systems/dashboard/dashboardTemplate.html | 8 +- src/systems/dashboard/editModeManager.js | 8 +- src/systems/dashboard/promptDialog.js | 282 ++++++++++ src/systems/dashboard/tabContextMenu.js | 526 ++++++++++++++++++ 5 files changed, 837 insertions(+), 6 deletions(-) create mode 100644 src/systems/dashboard/promptDialog.js create mode 100644 src/systems/dashboard/tabContextMenu.js diff --git a/src/systems/dashboard/dashboardIntegration.js b/src/systems/dashboard/dashboardIntegration.js index 35c8b16..d452664 100644 --- a/src/systems/dashboard/dashboardIntegration.js +++ b/src/systems/dashboard/dashboardIntegration.js @@ -14,6 +14,7 @@ import { WidgetRegistry } from './widgetRegistry.js'; import { generateDefaultDashboard } from './defaultLayout.js'; import { TabScrollManager } from './tabScrollManager.js'; import { HeaderOverflowManager } from './headerOverflowManager.js'; +import { TabContextMenu } from './tabContextMenu.js'; import { showConfirmDialog } from './confirmDialog.js'; // Widget imports @@ -31,6 +32,7 @@ import { registerQuestsWidget } from './widgets/questsWidget.js'; let dashboardManager = null; let tabScrollManager = null; let headerOverflowManager = null; +let tabContextMenu = null; /** * Get the dashboard manager instance @@ -123,6 +125,23 @@ export async function initializeDashboard(dependencies) { tabScrollManager.init(); } + // Initialize tab context menu + if (tabsContainer && dashboardManager?.tabManager) { + tabContextMenu = new TabContextMenu({ + tabManager: dashboardManager.tabManager, + onTabChange: (event, data) => { + console.log('[RPG Companion] Tab context menu event:', event, data); + // Re-render tabs after tab operations + dashboardManager.renderTabs(); + // Save dashboard state + if (dashboardManager.autoSave) { + saveSettings(); + } + } + }); + tabContextMenu.init(tabsContainer); + } + // Initialize header overflow manager const headerRight = document.querySelector('#rpg-dashboard-header-right'); if (headerRight) { diff --git a/src/systems/dashboard/dashboardTemplate.html b/src/systems/dashboard/dashboardTemplate.html index 6fa6cad..79e61dd 100644 --- a/src/systems/dashboard/dashboardTemplate.html +++ b/src/systems/dashboard/dashboardTemplate.html @@ -12,6 +12,10 @@
+ + @@ -24,10 +28,6 @@ - -