feat: implement Skills widget with level progression and categories
Add comprehensive Skills widget to dashboard system with category organization,
XP tracking, level progression, and multiple view modes.
Widget Features:
- Three sub-tabs: All Skills, By Category, Quick View
- Level-up and level-down buttons for manual progression
- XP progress bars with visual feedback
- Search and filter functionality
- Category collapse/expand in By Category view
- Editable skill names and categories
- Delete skills and categories
- Add new skills and categories
- Configurable max level and XP display
UI Improvements:
- Scrollable content area for large skill lists
- Responsive card layout
- Shortened tab labels for compact display ("All", "Quick" vs "All Skills", "Quick View")
- Proper flex layout for skill names (no longer truncated)
- Level badges and action buttons
Technical Implementation:
- Event handler deduplication to prevent exponential level-up bug
- Flag-based handler attachment: container.dataset.handlersAttached
- Nested flex containers for proper space distribution
- Scrollable views wrapper matching Inventory/Quests pattern
Dashboard Integration:
- Added Skills tab to defaultLayout.js (tab 5)
- Icon: fa-solid fa-book (fixed invalid fa-book-sparkles)
- Dimensions: 3x7 grid cells
- Default config: All Skills tab, show XP, show categories
- Auto-arrange support in dashboardManager.js
- Skills category group with priority order 6
- Auto-creates Skills tab when skills widgets detected
- Widget registration in dashboardIntegration.js
Widget Files:
- src/systems/dashboard/widgets/userSkillsWidget.js (new)
- Full widget implementation with all sub-tabs and features
- State management with Map-based storage
- Category-based and flat views
- Search/filter/sort functionality
Styling:
- style.css: Added skills widget styles
- Skill cards, headers, action buttons
- Level-down button with accent color
- XP progress bars
- Category sections
Fixes from iteration:
1. Invalid FontAwesome icon (fa-book-sparkles → fa-book)
2. Tab labels too wide (shortened to single words)
3. Skill names truncated (fixed with proper flex structure)
4. Widget height incorrect (adjusted to h:7)
5. Level-up exponential bug (duplicate handlers, added flag guard)
6. No level-down button (added with minimum level 1)
7. No scrollbar on long lists (added .rpg-skills-views wrapper)
Category: skills
Integration: Fully integrated with dashboard v2.0 system
Tested: Layout, interactions, scrolling, level progression
Refs: AI tracker integration (separate commit)
This commit is contained in:
@@ -27,6 +27,7 @@ import { registerSceneInfoWidget } from './widgets/sceneInfoWidget.js';
|
||||
import { registerPresentCharactersWidget } from './widgets/presentCharactersWidget.js';
|
||||
import { registerInventoryWidget } from './widgets/inventoryWidget.js';
|
||||
import { registerQuestsWidget } from './widgets/questsWidget.js';
|
||||
import { registerUserSkillsWidget } from './widgets/userSkillsWidget.js';
|
||||
|
||||
// Global dashboard manager instance
|
||||
let dashboardManager = null;
|
||||
@@ -254,6 +255,9 @@ function registerAllWidgets(registry, dependencies) {
|
||||
// Quest widget
|
||||
registerQuestsWidget(registry, dependencies);
|
||||
|
||||
// Skills widget
|
||||
registerUserSkillsWidget(registry, dependencies);
|
||||
|
||||
console.log(`[RPG Companion] Registered ${registry.getAll().length} widgets`);
|
||||
}
|
||||
|
||||
|
||||
@@ -949,7 +949,8 @@ export class DashboardManager {
|
||||
scene: [],
|
||||
social: [],
|
||||
inventory: [],
|
||||
quests: []
|
||||
quests: [],
|
||||
skills: []
|
||||
};
|
||||
|
||||
widgets.forEach(widget => {
|
||||
@@ -1031,6 +1032,19 @@ export class DashboardManager {
|
||||
this.gridEngine.autoLayout(groups.quests, { preserveOrder: true });
|
||||
}
|
||||
|
||||
// Create Skills tab if there are skills widgets
|
||||
if (groups.skills.length > 0) {
|
||||
this.dashboard.tabs.push({
|
||||
id: 'tab-skills',
|
||||
name: 'Skills',
|
||||
icon: 'fa-solid fa-book',
|
||||
order: 5,
|
||||
widgets: groups.skills
|
||||
});
|
||||
|
||||
this.gridEngine.autoLayout(groups.skills, { preserveOrder: true });
|
||||
}
|
||||
|
||||
console.log('[DashboardManager] Created', this.dashboard.tabs.length, 'tabs');
|
||||
|
||||
// Re-render tabs and switch to first tab
|
||||
@@ -1070,7 +1084,8 @@ export class DashboardManager {
|
||||
'social': 3,
|
||||
'inventory': 4,
|
||||
'quests': 5,
|
||||
'other': 6
|
||||
'skills': 6,
|
||||
'other': 7
|
||||
};
|
||||
|
||||
// Specific widget type ordering within user category
|
||||
|
||||
@@ -167,6 +167,29 @@ export function generateDefaultDashboard() {
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
// Tab 5: Skills (Full tab for skills system)
|
||||
{
|
||||
id: 'tab-skills',
|
||||
name: 'Skills',
|
||||
icon: 'fa-solid fa-book',
|
||||
order: 4,
|
||||
widgets: [
|
||||
{
|
||||
id: 'widget-userskills',
|
||||
type: 'userSkills',
|
||||
x: 0,
|
||||
y: 0,
|
||||
w: 3,
|
||||
h: 7,
|
||||
config: {
|
||||
defaultSubTab: 'all',
|
||||
showXP: true,
|
||||
showCategories: true,
|
||||
maxLevel: 10
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user