From 0818d1a5e72162ddc0453373c38289ab7770b41f 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 09:42:06 +0200 Subject: [PATCH] Add files via upload --- kontakt/index.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kontakt/index.html b/kontakt/index.html index 2e2895c..51718eb 100644 --- a/kontakt/index.html +++ b/kontakt/index.html @@ -230,10 +230,16 @@ function filterContacts() { const query = document.getElementById('searchInput').value.toLowerCase().trim(); - const activeTab = document.querySelector('.switcher-btn.active').dataset.type; + const activeBtn = document.querySelector('.switcher-btn.active'); - // Get contacts based on active tab + if (!activeBtn) { + // Default to main contacts if no active button found + return displayContacts(allContacts.filter(c => !c.internal), query); + } + + const activeTab = activeBtn.dataset.type; let contacts = []; + if (activeTab === 'main') { contacts = [...allContacts.filter(c => !c.internal)]; } else if (activeTab === 'internal') { @@ -255,8 +261,7 @@ ); } - filteredContacts = contacts; - displayContacts(filteredContacts, query); + displayContacts(contacts, query); } function highlightText(text, query) {