class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
🚀 Bienvenue dans Rosalinda
`;
// Observe attribute changes
const observer = new MutationObserver(() => this.updateTitle());
observer.observe(this, { attributes: true });
}
static get observedAttributes() {
return ['current-view'];
}
attributeChangedCallback(name, oldValue, newValue) {
if (name === 'current-view') {
this.updateTitle();
}
}
updateTitle() {
const view = this.getAttribute('current-view') || 'home';
const titleMap = {
'home': '🚀 Bienvenue dans Rosalinda',
'chat': '💬 Chat avec Rosalinda',
'projects': '📁 Mes Projets',
'code': '💻 Code Généré',
'library': '📚 Bibliothèque'
};
const title = this.shadowRoot.getElementById('view-title');
if (title) title.textContent = titleMap[view];
const buttons = this.shadowRoot.getElementById('action-buttons');
if (buttons) {
buttons.innerHTML = '';
if (view === 'code') {
buttons.innerHTML = `
`;
feather.replace();
}
}
}
}
customElements.define('custom-navbar', CustomNavbar);