class BottomPanel extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
`;
this.taskbar = this.shadowRoot.getElementById('taskbar');
}
addWindowToTaskbar(windowId, title, icon) {
const button = document.createElement('button');
button.className = 'taskbar-item';
button.dataset.windowId = windowId;
button.innerHTML = `
${title}
`;
button.addEventListener('click', () => {
const window = document.getElementById(windowId);
if (window) {
if (window.style.display === 'none') {
restoreWindow(windowId);
} else {
minimizeWindow(windowId);
}
}
});
button.addEventListener('contextmenu', (e) => {
e.preventDefault();
// Could add context menu here
});
this.taskbar.appendChild(button);
// Re-render feather icons
setTimeout(() => feather.replace(), 0);
}
removeWindowFromTaskbar(windowId) {
const button = this.taskbar.querySelector(`[data-window-id="${windowId}"]`);
if (button) {
button.remove();
}
}
}
customElements.define('bottom-panel', BottomPanel);