class CustomSidebar extends HTMLElement { static get observedAttributes() { return ['contacts']; } attributeChangedCallback(name, oldValue, newValue) { if (name === 'contacts') { this.renderContacts(JSON.parse(newValue)); } } renderContacts(contacts) { const contactsContainer = this.shadowRoot.querySelector('.contacts-container'); if (contactsContainer) { contactsContainer.innerHTML = contacts.map(contact => `
${contact.lastMessage}