From ca452ba897c53d7a691816cc7fd716b40ee5e7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Dvo=C5=99=C3=A1k?= <150935816+Dvorinka@users.noreply.github.com> Date: Fri, 23 May 2025 10:12:32 +0200 Subject: [PATCH] Add files via upload --- kontakt/index.html | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/kontakt/index.html b/kontakt/index.html index 6c4a012..b53af38 100644 --- a/kontakt/index.html +++ b/kontakt/index.html @@ -61,13 +61,15 @@ @@ -257,12 +259,10 @@ function displayContacts(contacts = [], searchQuery = '') { const container = document.getElementById('contacts'); - const internalContainer = document.getElementById('internal-contacts'); const noResults = document.getElementById('noResults'); // Clear previous results container.innerHTML = ''; - internalContainer.innerHTML = ''; if (!contacts || !contacts.length) { noResults.classList.remove('hidden'); @@ -278,26 +278,16 @@ // Get active tab const activeTab = document.querySelector('.switcher-btn.active')?.dataset.type || 'main'; - // Show contacts based on active tab - if (activeTab === 'main') { - container.innerHTML = contacts - .filter(contact => !contact.internal) - .map(contact => formatContactCard(contact, searchQuery)) - .join(''); - } else { - internalContainer.innerHTML = contacts - .filter(contact => contact.internal) - .map(contact => formatContactCard(contact, searchQuery)) - .join(''); - } + // Filter by active tab if not searching + const contactsToShow = searchQuery ? contacts : + contacts.filter(contact => + activeTab === 'main' ? !contact.internal : contact.internal + ); - // Show empty state if needed - if (!container.innerHTML && activeTab === 'main') { - container.innerHTML = '
Žádné hlavní kontakty
'; - } - if (!internalContainer.innerHTML && activeTab === 'internal') { - internalContainer.innerHTML = 'Žádné interní kontakty
'; - } + // Display contacts + container.innerHTML = contactsToShow + .map(contact => formatContactCard(contact, searchQuery)) + .join(''); } function formatContactCard(contact, searchQuery) {