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:
Digital Production Factory
2025-12-09 18:45:48 -03:00
commit 276ed71f31
884 changed files with 373737 additions and 0 deletions

View File

@@ -0,0 +1,259 @@
/**
* ds-admin-settings.js
* Admin settings panel for DSS configuration
* Allows configuration of hostname, port, and local/remote setup
*/
import { useAdminStore } from '../../stores/admin-store.js';
export default class AdminSettings extends HTMLElement {
constructor() {
super();
this.adminStore = useAdminStore();
this.state = this.adminStore.getState();
}
connectedCallback() {
this.render();
this.setupEventListeners();
this.unsubscribe = this.adminStore.subscribe(() => {
this.state = this.adminStore.getState();
this.updateUI();
});
}
disconnectedCallback() {
if (this.unsubscribe) this.unsubscribe();
}
render() {
this.innerHTML = `
<div style="padding: 24px; max-width: 600px;">
<h2 style="margin-bottom: 24px; font-size: 20px;">DSS Settings</h2>
<!-- Hostname Setting -->
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 500;">
Hostname
</label>
<input
id="hostname-input"
type="text"
value="${this.state.hostname}"
style="
width: 100%;
padding: 8px 12px;
border: 1px solid var(--vscode-input-border);
background: var(--vscode-input-background);
color: var(--vscode-foreground);
border-radius: 4px;
font-family: monospace;
"
placeholder="localhost or IP address"
/>
<div style="font-size: 11px; color: var(--vscode-text-dim); margin-top: 4px;">
Default: localhost
</div>
</div>
<!-- Port Setting -->
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 8px; font-weight: 500;">
Storybook Port
</label>
<input
id="port-input"
type="number"
value="${this.state.port}"
style="
width: 100%;
padding: 8px 12px;
border: 1px solid var(--vscode-input-border);
background: var(--vscode-input-background);
color: var(--vscode-foreground);
border-radius: 4px;
font-family: monospace;
"
placeholder="6006"
min="1"
max="65535"
/>
<div style="font-size: 11px; color: var(--vscode-text-dim); margin-top: 4px;">
Default: 6006 (Storybook standard port)
</div>
</div>
<!-- DSS Setup Type -->
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 12px; font-weight: 500;">
DSS Setup Type
</label>
<div style="display: flex; gap: 16px;">
<label style="display: flex; align-items: center; cursor: pointer;">
<input
type="radio"
name="setup-type"
value="local"
${this.state.isRemote ? '' : 'checked'}
style="margin-right: 8px;"
/>
<span>Local</span>
</label>
<label style="display: flex; align-items: center; cursor: pointer;">
<input
type="radio"
name="setup-type"
value="remote"
${this.state.isRemote ? 'checked' : ''}
style="margin-right: 8px;"
/>
<span>Remote (Headless)</span>
</label>
</div>
<div style="font-size: 11px; color: var(--vscode-text-dim); margin-top: 8px;">
<strong>Local:</strong> Uses browser devtools and local services<br/>
<strong>Remote:</strong> Uses headless tools and MCP providers
</div>
</div>
<!-- Current Configuration Display -->
<div style="
background: var(--vscode-sidebar);
border: 1px solid var(--vscode-border);
border-radius: 4px;
padding: 12px;
margin-bottom: 24px;
">
<div style="font-size: 11px; color: var(--vscode-text-dim); margin-bottom: 8px;">CURRENT STORYBOOK URL:</div>
<div style="
font-family: monospace;
font-size: 12px;
word-break: break-all;
color: var(--vscode-foreground);
" id="storybook-url-display">
${this.getStorybookUrlDisplay()}
</div>
</div>
<!-- Action Buttons -->
<div style="display: flex; gap: 8px;">
<button
id="save-btn"
style="
padding: 8px 16px;
background: var(--vscode-button-background);
color: var(--vscode-button-foreground);
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
"
>
Save Settings
</button>
<button
id="reset-btn"
style="
padding: 8px 16px;
background: var(--vscode-button-secondaryBackground);
color: var(--vscode-button-secondaryForeground);
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
"
>
Reset to Defaults
</button>
</div>
</div>
`;
}
setupEventListeners() {
const hostnameInput = this.querySelector('#hostname-input');
const portInput = this.querySelector('#port-input');
const setupTypeRadios = this.querySelectorAll('input[name="setup-type"]');
const saveBtn = this.querySelector('#save-btn');
const resetBtn = this.querySelector('#reset-btn');
// Update on input (but don't save immediately)
hostnameInput.addEventListener('change', () => {
this.adminStore.setHostname(hostnameInput.value);
});
portInput.addEventListener('change', () => {
const port = parseInt(portInput.value);
if (port > 0 && port <= 65535) {
this.adminStore.setPort(port);
}
});
setupTypeRadios.forEach(radio => {
radio.addEventListener('change', (e) => {
this.adminStore.setRemote(e.target.value === 'remote');
});
});
saveBtn.addEventListener('click', () => {
this.showNotification('Settings saved successfully!');
console.log('[AdminSettings] Settings saved:', this.adminStore.getState());
});
resetBtn.addEventListener('click', () => {
if (confirm('Reset all settings to defaults?')) {
this.adminStore.reset();
this.render();
this.setupEventListeners();
this.showNotification('Settings reset to defaults');
}
});
}
updateUI() {
const hostnameInput = this.querySelector('#hostname-input');
const portInput = this.querySelector('#port-input');
const setupTypeRadios = this.querySelectorAll('input[name="setup-type"]');
const urlDisplay = this.querySelector('#storybook-url-display');
if (hostnameInput) hostnameInput.value = this.state.hostname;
if (portInput) portInput.value = this.state.port;
setupTypeRadios.forEach(radio => {
radio.checked = (radio.value === 'remote') === this.state.isRemote;
});
if (urlDisplay) {
urlDisplay.textContent = this.getStorybookUrlDisplay();
}
}
getStorybookUrlDisplay() {
return this.adminStore.getStorybookUrl('default');
}
showNotification(message) {
const notification = document.createElement('div');
notification.textContent = message;
notification.style.cssText = `
position: fixed;
bottom: 20px;
right: 20px;
background: var(--vscode-notifications-background);
color: var(--vscode-foreground);
padding: 12px 16px;
border-radius: 4px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
z-index: 1000;
animation: slideIn 0.3s ease;
`;
document.body.appendChild(notification);
setTimeout(() => {
notification.style.animation = 'slideOut 0.3s ease';
setTimeout(() => notification.remove(), 300);
}, 3000);
}
}
customElements.define('ds-admin-settings', AdminSettings);

View File

@@ -0,0 +1,324 @@
/**
* ds-project-list.js
* Project management component
* Create, edit, delete, and select projects
*/
import { useProjectStore } from '../../stores/project-store.js';
export default class ProjectList extends HTMLElement {
constructor() {
super();
this.projectStore = useProjectStore();
this.state = {
projects: this.projectStore.getProjects(),
currentProject: this.projectStore.getCurrentProject(),
showEditModal: false,
editingProject: null
};
}
connectedCallback() {
this.render();
this.setupEventListeners();
this.unsubscribe = this.projectStore.subscribe(() => {
this.state.projects = this.projectStore.getProjects();
this.state.currentProject = this.projectStore.getCurrentProject();
this.updateProjectList();
});
}
disconnectedCallback() {
if (this.unsubscribe) this.unsubscribe();
}
render() {
this.innerHTML = `
<div style="padding: 24px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px;">
<h2 style="margin: 0; font-size: 20px;">Projects</h2>
<button id="create-project-btn" style="
padding: 8px 16px;
background: var(--vscode-button-background);
color: var(--vscode-button-foreground);
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
">
+ New Project
</button>
</div>
<!-- Projects List -->
<div id="projects-container" style="display: flex; flex-direction: column; gap: 12px;">
${this.renderProjectsList()}
</div>
</div>
<!-- Edit Modal -->
<div id="edit-modal" style="
display: ${this.state.showEditModal ? 'flex' : 'none'};
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
align-items: center;
justify-content: center;
z-index: 1000;
">
<div style="
background: var(--vscode-editor-background);
border: 1px solid var(--vscode-border);
border-radius: 8px;
padding: 24px;
min-width: 400px;
max-width: 500px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
">
<h3 id="modal-title" style="margin: 0 0 16px 0; font-size: 18px;">
${this.state.editingProject ? 'Edit Project' : 'New Project'}
</h3>
<!-- Project ID -->
<div style="margin-bottom: 16px;">
<label style="display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500;">
Project ID (Jira Key)
</label>
<input
id="modal-project-id"
type="text"
${this.state.editingProject ? 'disabled' : ''}
value="${this.state.editingProject?.id || ''}"
placeholder="E.g., DSS-123"
style="
width: 100%;
padding: 8px 12px;
border: 1px solid var(--vscode-input-border);
background: var(--vscode-input-background);
color: var(--vscode-foreground);
border-radius: 4px;
font-family: monospace;
"
/>
<div style="font-size: 10px; color: var(--vscode-text-dim); margin-top: 4px;">
${this.state.editingProject ? 'Cannot change after creation' : 'Must match Jira project key'}
</div>
</div>
<!-- Project Name -->
<div style="margin-bottom: 16px;">
<label style="display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500;">
Project Name
</label>
<input
id="modal-project-name"
type="text"
value="${this.state.editingProject?.name || ''}"
placeholder="My Design System"
style="
width: 100%;
padding: 8px 12px;
border: 1px solid var(--vscode-input-border);
background: var(--vscode-input-background);
color: var(--vscode-foreground);
border-radius: 4px;
"
/>
</div>
<!-- Skin Selection -->
<div style="margin-bottom: 24px;">
<label style="display: block; margin-bottom: 6px; font-size: 12px; font-weight: 500;">
Default Skin
</label>
<select
id="modal-skin-select"
style="
width: 100%;
padding: 8px 12px;
border: 1px solid var(--vscode-input-border);
background: var(--vscode-input-background);
color: var(--vscode-foreground);
border-radius: 4px;
"
>
<option value="default" ${this.state.editingProject?.skinSelected === 'default' ? 'selected' : ''}>default</option>
<option value="light" ${this.state.editingProject?.skinSelected === 'light' ? 'selected' : ''}>light</option>
<option value="dark" ${this.state.editingProject?.skinSelected === 'dark' ? 'selected' : ''}>dark</option>
</select>
</div>
<!-- Buttons -->
<div style="display: flex; gap: 8px; justify-content: flex-end;">
<button id="modal-cancel-btn" style="
padding: 8px 16px;
background: var(--vscode-button-secondaryBackground);
color: var(--vscode-button-secondaryForeground);
border: none;
border-radius: 4px;
cursor: pointer;
">
Cancel
</button>
<button id="modal-save-btn" style="
padding: 8px 16px;
background: var(--vscode-button-background);
color: var(--vscode-button-foreground);
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: 500;
">
${this.state.editingProject ? 'Update' : 'Create'}
</button>
</div>
</div>
</div>
`;
}
renderProjectsList() {
if (this.state.projects.length === 0) {
return '<div style="color: var(--vscode-text-dim); text-align: center; padding: 32px;">No projects yet. Create one to get started!</div>';
}
return this.state.projects.map(project => `
<div data-project-id="${project.id}" style="
display: flex;
align-items: center;
gap: 12px;
padding: 12px;
background: ${this.state.currentProject?.id === project.id ? 'var(--vscode-selection)' : 'var(--vscode-sidebar)'};
border: 1px solid var(--vscode-border);
border-radius: 4px;
cursor: pointer;
transition: background 0.2s;
" onmouseover="this.style.background='var(--vscode-selection)'" onmouseout="this.style.background='${this.state.currentProject?.id === project.id ? 'var(--vscode-selection)' : 'var(--vscode-sidebar)'}'">
<div style="flex: 1;">
<div style="font-weight: 500; margin-bottom: 4px;">${project.name}</div>
<div style="font-size: 11px; color: var(--vscode-text-dim);">
ID: ${project.id} | Skin: ${project.skinSelected}
</div>
</div>
<div style="display: flex; gap: 4px;">
<button class="edit-project-btn" data-project-id="${project.id}" style="
padding: 4px 8px;
background: var(--vscode-button-secondaryBackground);
color: var(--vscode-button-secondaryForeground);
border: none;
border-radius: 2px;
cursor: pointer;
font-size: 11px;
">
Edit
</button>
<button class="delete-project-btn" data-project-id="${project.id}" style="
padding: 4px 8px;
background: #c1272d;
color: white;
border: none;
border-radius: 2px;
cursor: pointer;
font-size: 11px;
">
Delete
</button>
</div>
</div>
`).join('');
}
setupEventListeners() {
// Create button
this.querySelector('#create-project-btn').addEventListener('click', () => {
this.state.editingProject = null;
this.state.showEditModal = true;
this.render();
this.setupEventListeners();
});
// Project selection
this.querySelectorAll('[data-project-id]').forEach(el => {
el.addEventListener('click', (e) => {
if (!e.target.closest('button')) {
const projectId = el.dataset.projectId;
this.projectStore.selectProject(projectId);
}
});
});
// Edit buttons
this.querySelectorAll('.edit-project-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
e.stopPropagation();
const projectId = btn.dataset.projectId;
this.state.editingProject = this.projectStore.getProject(projectId);
this.state.showEditModal = true;
this.render();
this.setupEventListeners();
});
});
// Delete buttons
this.querySelectorAll('.delete-project-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
e.stopPropagation();
const projectId = btn.dataset.projectId;
const project = this.projectStore.getProject(projectId);
if (confirm(`Delete project "${project.name}"? This cannot be undone.`)) {
this.projectStore.deleteProject(projectId);
}
});
});
// Modal buttons
const modal = this.querySelector('#edit-modal');
if (modal) {
this.querySelector('#modal-cancel-btn').addEventListener('click', () => {
this.state.showEditModal = false;
this.state.editingProject = null;
this.render();
});
this.querySelector('#modal-save-btn').addEventListener('click', () => {
const id = this.querySelector('#modal-project-id').value.trim();
const name = this.querySelector('#modal-project-name').value.trim();
const skin = this.querySelector('#modal-skin-select').value;
if (!id || !name) {
alert('Please fill in all fields');
return;
}
if (this.state.editingProject) {
// Update
this.projectStore.updateProject(this.state.editingProject.id, {
name,
skinSelected: skin
});
} else {
// Create
this.projectStore.createProject({ id, name, skinSelected: skin });
}
this.state.showEditModal = false;
this.state.editingProject = null;
this.render();
this.setupEventListeners();
});
}
}
updateProjectList() {
const container = this.querySelector('#projects-container');
if (container) {
container.innerHTML = this.renderProjectsList();
this.setupEventListeners();
}
}
}
customElements.define('ds-project-list', ProjectList);

View File

@@ -0,0 +1,434 @@
/**
* ds-user-settings.js
* User settings page component
* Manages user profile, preferences, integrations, and account settings
* MVP3: Full integration with backend API and user-store
*/
import { useUserStore } from '../../stores/user-store.js';
export default class DSUserSettings extends HTMLElement {
constructor() {
super();
this.userStore = useUserStore();
this.activeTab = 'profile';
this.isLoading = false;
this.formChanges = {};
}
connectedCallback() {
this.render();
this.setupEventListeners();
this.subscribeToUserStore();
}
subscribeToUserStore() {
this.unsubscribe = this.userStore.subscribe(() => {
this.updateUI();
});
}
render() {
const user = this.userStore.getCurrentUser();
const displayName = this.userStore.getDisplayName();
const avatar = this.userStore.getAvatar();
this.innerHTML = `
<div style="display: flex; flex-direction: column; height: 100%; background: var(--vscode-bg);">
<!-- Header -->
<div style="padding: 24px; border-bottom: 1px solid var(--vscode-border);">
<div style="display: flex; align-items: center; gap: 16px; margin-bottom: 24px;">
<img src="${avatar}" alt="Avatar" style="width: 64px; height: 64px; border-radius: 8px; background: var(--vscode-sidebar);" />
<div>
<h1 style="margin: 0 0 4px 0; font-size: 24px;">${displayName}</h1>
<p style="margin: 0; color: var(--vscode-text-dim); font-size: 12px;">${user?.email || 'Not logged in'}</p>
</div>
</div>
</div>
<!-- Tabs -->
<div style="display: flex; border-bottom: 1px solid var(--vscode-border); padding: 0 24px; gap: 24px; flex-shrink: 0;">
<button class="settings-tab" data-tab="profile" style="padding: 12px 0; border: none; background: transparent; color: var(--vscode-text); cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; transition: all 0.2s;">
👤 Profile
</button>
<button class="settings-tab" data-tab="preferences" style="padding: 12px 0; border: none; background: transparent; color: var(--vscode-text-dim); cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; transition: all 0.2s;">
⚙️ Preferences
</button>
<button class="settings-tab" data-tab="integrations" style="padding: 12px 0; border: none; background: transparent; color: var(--vscode-text-dim); cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; transition: all 0.2s;">
🔗 Integrations
</button>
<button class="settings-tab" data-tab="about" style="padding: 12px 0; border: none; background: transparent; color: var(--vscode-text-dim); cursor: pointer; border-bottom: 2px solid transparent; font-size: 13px; transition: all 0.2s;">
About
</button>
</div>
<!-- Content -->
<div style="flex: 1; overflow-y: auto; padding: 24px;">
<!-- Profile Tab -->
<div id="profile-tab" class="settings-content">
<div style="max-width: 600px;">
<h2 style="margin: 0 0 16px 0; font-size: 18px;">Profile Settings</h2>
<div style="margin-bottom: 16px;">
<label style="display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px;">Full Name</label>
<input id="profile-name" type="text" value="${user?.name || ''}" placeholder="Your full name" style="width: 100%; padding: 8px 12px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 4px; font-size: 13px;" />
</div>
<div style="margin-bottom: 16px;">
<label style="display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px;">Email</label>
<input id="profile-email" type="email" value="${user?.email || ''}" placeholder="your@email.com" style="width: 100%; padding: 8px 12px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 4px; font-size: 13px;" />
</div>
<div style="margin-bottom: 16px;">
<label style="display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px;">Role</label>
<div style="padding: 8px 12px; background: var(--vscode-sidebar); border: 1px solid var(--vscode-border); color: var(--vscode-text-dim); border-radius: 4px; font-size: 13px;">
${user?.role || 'User'} <span style="color: var(--vscode-text-dim); font-size: 11px;">(Read-only)</span>
</div>
</div>
<div style="margin-bottom: 24px;">
<label style="display: block; font-size: 12px; font-weight: 500; margin-bottom: 4px;">Bio</label>
<textarea id="profile-bio" placeholder="Tell us about yourself..." style="width: 100%; padding: 8px 12px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 4px; font-size: 13px; min-height: 80px; resize: vertical;" >${user?.bio || ''}</textarea>
</div>
<div style="display: flex; gap: 8px;">
<button id="save-profile-btn" style="padding: 8px 16px; background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: none; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500;">
Save Changes
</button>
<button id="change-password-btn" style="padding: 8px 16px; background: var(--vscode-button-secondaryBackground); color: var(--vscode-button-secondaryForeground); border: none; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500;">
Change Password
</button>
</div>
</div>
</div>
<!-- Preferences Tab -->
<div id="preferences-tab" class="settings-content" style="display: none;">
<div style="max-width: 600px;">
<h2 style="margin: 0 0 16px 0; font-size: 18px;">Preferences</h2>
<h3 style="margin: 0 0 12px 0; font-size: 14px; color: var(--vscode-text-dim);">Theme</h3>
<div style="margin-bottom: 24px;">
<label style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer;">
<input type="radio" name="theme" value="dark" checked />
<span style="font-size: 12px;">Dark</span>
</label>
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
<input type="radio" name="theme" value="light" />
<span style="font-size: 12px;">Light</span>
</label>
</div>
<h3 style="margin: 0 0 12px 0; font-size: 14px; color: var(--vscode-text-dim);">Language</h3>
<div style="margin-bottom: 24px;">
<select id="pref-language" style="padding: 8px 12px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 4px; font-size: 12px; cursor: pointer;">
<option value="en">English</option>
<option value="es">Español</option>
<option value="fr">Français</option>
<option value="de">Deutsch</option>
<option value="ja">日本語</option>
</select>
</div>
<h3 style="margin: 0 0 12px 0; font-size: 14px; color: var(--vscode-text-dim);">Notifications</h3>
<div style="margin-bottom: 24px;">
<label style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer;">
<input id="pref-notifications" type="checkbox" checked />
<span style="font-size: 12px;">Enable notifications</span>
</label>
<label style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer;">
<input id="pref-email-notifications" type="checkbox" checked />
<span style="font-size: 12px;">Email notifications</span>
</label>
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
<input id="pref-desktop-notifications" type="checkbox" checked />
<span style="font-size: 12px;">Desktop notifications</span>
</label>
</div>
<button id="save-preferences-btn" style="padding: 8px 16px; background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: none; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500;">
Save Preferences
</button>
</div>
</div>
<!-- Integrations Tab -->
<div id="integrations-tab" class="settings-content" style="display: none;">
<div style="max-width: 600px;">
<h2 style="margin: 0 0 16px 0; font-size: 18px;">Integrations</h2>
<!-- Figma Integration -->
<div style="background: var(--vscode-sidebar); border: 1px solid var(--vscode-border); border-radius: 4px; padding: 16px; margin-bottom: 12px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;">
<div>
<h3 style="margin: 0 0 4px 0; font-size: 13px; font-weight: 500;">🎨 Figma</h3>
<p style="margin: 0; font-size: 11px; color: var(--vscode-text-dim);">Connect your Figma account for design token extraction</p>
</div>
<span id="figma-status" class="integration-status" style="font-size: 11px; padding: 4px 8px; background: #4CAF50; color: white; border-radius: 3px; display: none;">Connected</span>
</div>
<div style="display: flex; gap: 8px;">
<input id="figma-api-key" type="password" placeholder="Enter Figma API key" style="flex: 1; padding: 6px 10px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 3px; font-size: 11px;" />
<button class="integration-save-btn" data-service="figma" style="padding: 6px 12px; background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: none; border-radius: 3px; cursor: pointer; font-size: 11px;">Save</button>
</div>
</div>
<!-- GitHub Integration -->
<div style="background: var(--vscode-sidebar); border: 1px solid var(--vscode-border); border-radius: 4px; padding: 16px; margin-bottom: 12px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;">
<div>
<h3 style="margin: 0 0 4px 0; font-size: 13px; font-weight: 500;">🐙 GitHub</h3>
<p style="margin: 0; font-size: 11px; color: var(--vscode-text-dim);">Connect GitHub for component library integration</p>
</div>
<span id="github-status" class="integration-status" style="font-size: 11px; padding: 4px 8px; background: #666; color: white; border-radius: 3px; display: none;">Connected</span>
</div>
<div style="display: flex; gap: 8px;">
<input id="github-api-key" type="password" placeholder="Enter GitHub personal access token" style="flex: 1; padding: 6px 10px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 3px; font-size: 11px;" />
<button class="integration-save-btn" data-service="github" style="padding: 6px 12px; background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: none; border-radius: 3px; cursor: pointer; font-size: 11px;">Save</button>
</div>
</div>
<!-- Jira Integration -->
<div style="background: var(--vscode-sidebar); border: 1px solid var(--vscode-border); border-radius: 4px; padding: 16px; margin-bottom: 12px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;">
<div>
<h3 style="margin: 0 0 4px 0; font-size: 13px; font-weight: 500;">📋 Jira</h3>
<p style="margin: 0; font-size: 11px; color: var(--vscode-text-dim);">Connect Jira for issue tracking integration</p>
</div>
<span id="jira-status" class="integration-status" style="font-size: 11px; padding: 4px 8px; background: #666; color: white; border-radius: 3px; display: none;">Connected</span>
</div>
<div style="display: flex; gap: 8px; margin-bottom: 8px;">
<input id="jira-api-key" type="password" placeholder="Enter Jira API token" style="flex: 1; padding: 6px 10px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 3px; font-size: 11px;" />
<button class="integration-save-btn" data-service="jira" style="padding: 6px 12px; background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: none; border-radius: 3px; cursor: pointer; font-size: 11px;">Save</button>
</div>
<input id="jira-project-key" type="text" placeholder="Jira project key (optional)" style="width: 100%; padding: 6px 10px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 3px; font-size: 11px;" />
</div>
<!-- Slack Integration -->
<div style="background: var(--vscode-sidebar); border: 1px solid var(--vscode-border); border-radius: 4px; padding: 16px; margin-bottom: 12px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;">
<div>
<h3 style="margin: 0 0 4px 0; font-size: 13px; font-weight: 500;">💬 Slack</h3>
<p style="margin: 0; font-size: 11px; color: var(--vscode-text-dim);">Connect Slack for team notifications</p>
</div>
<span id="slack-status" class="integration-status" style="font-size: 11px; padding: 4px 8px; background: #666; color: white; border-radius: 3px; display: none;">Connected</span>
</div>
<div style="display: flex; gap: 8px;">
<input id="slack-webhook" type="password" placeholder="Enter Slack webhook URL" style="flex: 1; padding: 6px 10px; background: var(--vscode-input-background); border: 1px solid var(--vscode-border); color: var(--vscode-text); border-radius: 3px; font-size: 11px;" />
<button class="integration-save-btn" data-service="slack" style="padding: 6px 12px; background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: none; border-radius: 3px; cursor: pointer; font-size: 11px;">Save</button>
</div>
</div>
</div>
</div>
<!-- About Tab -->
<div id="about-tab" class="settings-content" style="display: none;">
<div style="max-width: 600px;">
<h2 style="margin: 0 0 16px 0; font-size: 18px;">About</h2>
<div style="background: var(--vscode-sidebar); border: 1px solid var(--vscode-border); border-radius: 4px; padding: 16px; margin-bottom: 16px;">
<h3 style="margin: 0 0 12px 0; font-size: 14px;">Design System Swarm</h3>
<p style="margin: 0 0 8px 0; font-size: 12px; color: var(--vscode-text-dim);">Version: 3.0.0 (MVP3)</p>
<p style="margin: 0 0 8px 0; font-size: 12px;">Advanced design system management platform with AI assistance, design tokens, and multi-team collaboration.</p>
<p style="margin: 0; font-size: 11px; color: var(--vscode-text-dim);">© 2024 Design System Swarm. All rights reserved.</p>
</div>
<h3 style="margin: 16px 0 8px 0; font-size: 14px;">Features</h3>
<ul style="margin: 0; padding-left: 20px; font-size: 12px;">
<li>Design token management and synchronization</li>
<li>Figma integration with automated token extraction</li>
<li>Multi-team collaboration workspace</li>
<li>AI-powered design system analysis</li>
<li>Storybook integration and component documentation</li>
<li>GitHub and Jira integration</li>
</ul>
<div style="margin-top: 24px;">
<h3 style="margin: 0 0 8px 0; font-size: 14px;">Account Actions</h3>
<button id="logout-btn" style="padding: 8px 16px; background: #F44336; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500;">
🚪 Logout
</button>
</div>
</div>
</div>
</div>
</div>
`;
}
setupEventListeners() {
// Tab switching
this.querySelectorAll('.settings-tab').forEach(btn => {
btn.addEventListener('click', (e) => {
this.switchTab(e.target.closest('button').dataset.tab);
});
});
// Profile tab
const saveProfileBtn = this.querySelector('#save-profile-btn');
if (saveProfileBtn) {
saveProfileBtn.addEventListener('click', () => this.saveProfile());
}
// Preferences tab
const savePreferencesBtn = this.querySelector('#save-preferences-btn');
if (savePreferencesBtn) {
savePreferencesBtn.addEventListener('click', () => this.savePreferences());
}
// Integration save buttons
this.querySelectorAll('.integration-save-btn').forEach(btn => {
btn.addEventListener('click', (e) => {
const service = e.target.dataset.service;
const apiKeyInput = this.querySelector(`#${service}-api-key`) || this.querySelector(`#${service}-webhook`);
const apiKey = apiKeyInput?.value || '';
this.saveIntegration(service, apiKey);
});
});
// Logout button
const logoutBtn = this.querySelector('#logout-btn');
if (logoutBtn) {
logoutBtn.addEventListener('click', () => this.logout());
}
// Change password button
const changePasswordBtn = this.querySelector('#change-password-btn');
if (changePasswordBtn) {
changePasswordBtn.addEventListener('click', () => this.showChangePasswordDialog());
}
}
switchTab(tabName) {
this.activeTab = tabName;
// Hide all tabs
this.querySelectorAll('.settings-content').forEach(tab => {
tab.style.display = 'none';
});
// Show selected tab
const selectedTab = this.querySelector(`#${tabName}-tab`);
if (selectedTab) {
selectedTab.style.display = 'block';
}
// Update tab styling
this.querySelectorAll('.settings-tab').forEach(btn => {
const isActive = btn.dataset.tab === tabName;
btn.style.borderBottomColor = isActive ? 'var(--vscode-accent)' : 'transparent';
btn.style.color = isActive ? 'var(--vscode-text)' : 'var(--vscode-text-dim)';
});
}
async saveProfile() {
const name = this.querySelector('#profile-name')?.value || '';
const email = this.querySelector('#profile-email')?.value || '';
const bio = this.querySelector('#profile-bio')?.value || '';
try {
await this.userStore.updateProfile({ name, email, bio });
this.showNotification('Profile saved successfully', 'success');
} catch (error) {
this.showNotification('Failed to save profile', 'error');
console.error(error);
}
}
savePreferences() {
const theme = this.querySelector('input[name="theme"]:checked')?.value || 'dark';
const language = this.querySelector('#pref-language')?.value || 'en';
const notifications = this.querySelector('#pref-notifications')?.checked || false;
this.userStore.updatePreferences({
theme,
language,
notifications: {
enabled: notifications,
email: this.querySelector('#pref-email-notifications')?.checked || false,
desktop: this.querySelector('#pref-desktop-notifications')?.checked || false
}
});
this.showNotification('Preferences saved', 'success');
}
saveIntegration(service, apiKey) {
if (!apiKey) {
this.userStore.removeIntegration(service);
this.showNotification(`${service} integration removed`, 'success');
} else {
const metadata = {};
if (service === 'jira') {
metadata.projectKey = this.querySelector('#jira-project-key')?.value || '';
}
this.userStore.setIntegration(service, apiKey, metadata);
this.showNotification(`${service} integration saved`, 'success');
}
this.updateIntegrationStatus();
}
updateIntegrationStatus() {
const integrations = this.userStore.getIntegrations();
['figma', 'github', 'jira', 'slack'].forEach(service => {
const status = this.querySelector(`#${service}-status`);
if (status) {
if (integrations[service]?.enabled) {
status.style.display = 'inline-block';
status.style.background = '#4CAF50';
status.textContent = 'Connected';
} else {
status.style.display = 'none';
}
}
});
}
updateUI() {
// Update display when user state changes
const user = this.userStore.getCurrentUser();
const displayName = this.userStore.getDisplayName();
// Re-render component
this.render();
this.setupEventListeners();
}
showChangePasswordDialog() {
// Placeholder for password change dialog
// In a real implementation, this would show a modal dialog
alert('Change password functionality would be implemented here.\n\nIn production, this would show a modal with current password and new password fields.');
}
showNotification(message, type = 'info') {
const notificationEl = document.createElement('div');
notificationEl.style.cssText = `
position: fixed;
bottom: 24px;
right: 24px;
padding: 12px 16px;
background: ${type === 'success' ? '#4CAF50' : type === 'error' ? '#F44336' : '#0066CC'};
color: white;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
z-index: 1000;
animation: slideInUp 0.3s ease-out;
`;
notificationEl.textContent = message;
document.body.appendChild(notificationEl);
setTimeout(() => {
notificationEl.style.animation = 'slideOutDown 0.3s ease-in';
setTimeout(() => notificationEl.remove(), 300);
}, 3000);
}
disconnectedCallback() {
if (this.unsubscribe) {
this.unsubscribe();
}
}
}
customElements.define('ds-user-settings', DSUserSettings);