Initial commit: Clean DSS implementation
Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm
Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)
Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability
Migration completed: $(date)
🤖 Clean migration with full functionality preserved
This commit is contained in:
84
admin-ui/js/core/layout-manager.js
Normal file
84
admin-ui/js/core/layout-manager.js
Normal file
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
* layout-manager.js
|
||||
* Manages workdesk switching and layout state
|
||||
*/
|
||||
|
||||
class LayoutManager {
|
||||
constructor() {
|
||||
this.currentWorkdesk = null;
|
||||
this.workdesks = new Map();
|
||||
this.shell = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the layout manager with a shell instance
|
||||
*/
|
||||
init(shell) {
|
||||
this.shell = shell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a workdesk class for a team
|
||||
*/
|
||||
registerWorkdesk(teamId, WorkdeskClass) {
|
||||
this.workdesks.set(teamId, WorkdeskClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to a different team's workdesk
|
||||
*/
|
||||
async switchWorkdesk(teamId) {
|
||||
if (!this.shell) {
|
||||
throw new Error('LayoutManager not initialized with shell');
|
||||
}
|
||||
|
||||
// Cleanup current workdesk
|
||||
if (this.currentWorkdesk) {
|
||||
this.currentWorkdesk.destroy();
|
||||
this.currentWorkdesk = null;
|
||||
}
|
||||
|
||||
// Load workdesk class if not already registered
|
||||
if (!this.workdesks.has(teamId)) {
|
||||
try {
|
||||
const module = await import(`../workdesks/${teamId}-workdesk.js`);
|
||||
this.registerWorkdesk(teamId, module.default);
|
||||
} catch (error) {
|
||||
console.error(`Failed to load workdesk for team ${teamId}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Create new workdesk instance
|
||||
const WorkdeskClass = this.workdesks.get(teamId);
|
||||
this.currentWorkdesk = new WorkdeskClass(this.shell);
|
||||
|
||||
// Render the workdesk
|
||||
this.currentWorkdesk.render();
|
||||
|
||||
return this.currentWorkdesk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current active workdesk
|
||||
*/
|
||||
getCurrentWorkdesk() {
|
||||
return this.currentWorkdesk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up all workdesks
|
||||
*/
|
||||
destroy() {
|
||||
if (this.currentWorkdesk) {
|
||||
this.currentWorkdesk.destroy();
|
||||
this.currentWorkdesk = null;
|
||||
}
|
||||
this.workdesks.clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Singleton instance
|
||||
const layoutManager = new LayoutManager();
|
||||
|
||||
export default layoutManager;
|
||||
Reference in New Issue
Block a user