feat(dashboard): replace emojis with Font Awesome, add theme support, and styled dialogs
This commit implements three major improvements to the dashboard system: 1. **Font Awesome Icons for Tabs** - Replace emoji tab icons (📊, 🌍, 🎒) with Font Awesome classes - Update defaultLayout.js with fa-solid icon classes - Add automatic migration for existing saved dashboards with emoji icons - Implement migrateEmojiIcons() to convert old emoji icons on load - Update fallback icons throughout the system 2. **Custom Theme Support for Dashboard** - Replace all --SmartTheme* variables with --rpg-* variables - Ensure custom themes (sci-fi, fantasy, cyberpunk) apply to dashboard - Update CSS for tabs, buttons, dropdowns, modals, and widget cards - Dashboard now respects extension themes instead of main SillyTavern theme 3. **Styled Confirmation Dialogs** - Create confirmDialog.js with showConfirmDialog() and showAlertDialog() - Support three variants: danger (red), warning (yellow), info (blue) - Add keyboard navigation (Enter/Escape) and accessibility features - Replace all native confirm() and alert() calls with styled dialogs - Add confirmation dialog modal to dashboardTemplate.html Files Modified: - src/systems/dashboard/confirmDialog.js (NEW) - src/systems/dashboard/dashboardManager.js - src/systems/dashboard/defaultLayout.js - src/systems/dashboard/tabManager.js - src/systems/dashboard/dashboardIntegration.js - src/systems/dashboard/editModeManager.js - src/systems/dashboard/widgets/inventoryWidget.js - src/systems/dashboard/dashboardTemplate.html - style.css
This commit is contained in:
@@ -137,7 +137,7 @@ export class DashboardManager {
|
||||
this.dashboard.tabs.push({
|
||||
id: 'main',
|
||||
name: 'Main',
|
||||
icon: '🏠',
|
||||
icon: 'fa-solid fa-house',
|
||||
order: 0,
|
||||
widgets: []
|
||||
});
|
||||
@@ -361,7 +361,7 @@ export class DashboardManager {
|
||||
button.className = 'rpg-dashboard-tab';
|
||||
button.dataset.tabId = tab.id;
|
||||
button.innerHTML = `
|
||||
<span class="rpg-tab-icon">${tab.icon}</span>
|
||||
<span class="rpg-tab-icon"><i class="${tab.icon}"></i></span>
|
||||
<span class="rpg-tab-name">${tab.name}</span>
|
||||
`;
|
||||
|
||||
@@ -1189,6 +1189,47 @@ export class DashboardManager {
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate emoji icons to Font Awesome
|
||||
* @param {Object} config - Dashboard configuration
|
||||
* @returns {Object} Migrated configuration
|
||||
*/
|
||||
migrateEmojiIcons(config) {
|
||||
// Map of common emojis to Font Awesome classes
|
||||
const emojiToFontAwesome = {
|
||||
'📊': 'fa-solid fa-chart-line',
|
||||
'🌍': 'fa-solid fa-map',
|
||||
'🎒': 'fa-solid fa-bag-shopping',
|
||||
'🏠': 'fa-solid fa-house',
|
||||
'📄': 'fa-solid fa-file',
|
||||
'⚙️': 'fa-solid fa-gear',
|
||||
'👤': 'fa-solid fa-user',
|
||||
'📝': 'fa-solid fa-note-sticky',
|
||||
'🗂️': 'fa-solid fa-folder',
|
||||
'📁': 'fa-solid fa-folder-open'
|
||||
};
|
||||
|
||||
if (config && config.tabs) {
|
||||
config.tabs.forEach(tab => {
|
||||
// Check if icon is an emoji (contains emoji characters)
|
||||
if (tab.icon && /[\u{1F300}-\u{1F9FF}]/u.test(tab.icon)) {
|
||||
// Convert to Font Awesome if we have a mapping
|
||||
const faIcon = emojiToFontAwesome[tab.icon];
|
||||
if (faIcon) {
|
||||
console.log(`[DashboardManager] Migrating emoji icon "${tab.icon}" → "${faIcon}" for tab "${tab.name}"`);
|
||||
tab.icon = faIcon;
|
||||
} else {
|
||||
// Fallback to generic file icon
|
||||
console.warn(`[DashboardManager] Unknown emoji icon "${tab.icon}", using fa-solid fa-file for tab "${tab.name}"`);
|
||||
tab.icon = 'fa-solid fa-file';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply dashboard configuration
|
||||
* @param {Object} config - Dashboard configuration
|
||||
@@ -1196,6 +1237,9 @@ export class DashboardManager {
|
||||
applyDashboardConfig(config) {
|
||||
console.log('[DashboardManager] Applying dashboard config');
|
||||
|
||||
// Migrate emoji icons to Font Awesome
|
||||
config = this.migrateEmojiIcons(config);
|
||||
|
||||
// Update grid config from dashboard config
|
||||
if (config.gridConfig) {
|
||||
this.config.rowHeight = config.gridConfig.rowHeight || this.config.rowHeight;
|
||||
|
||||
Reference in New Issue
Block a user