diff --git a/index.html b/index.html index a43eee2..55bf31c 100644 --- a/index.html +++ b/index.html @@ -224,14 +224,21 @@ -
+
+
+
+ + +
+
+
- +
@@ -664,26 +671,44 @@ } }); - // ===== EXPERT FILTERS ===== + // ===== EXPERT SEARCH ===== + let currentFilter = 'all'; + + function searchExperts(query) { + const q = query.toLowerCase().trim(); + let filtered = allExperts; + + // Apply current filter + if (currentFilter === 'certified') { + filtered = filtered.filter(ex => ex.certified === 'yes' || ex.certified === true); + } + + // Apply search query + if (q.length > 0) { + filtered = filtered.filter(ex => { + const name = (ex.name || '').toLowerCase(); + const skills = (ex.skills || '').toLowerCase(); + const modules = (ex.modules || '').toLowerCase(); + const extra = (ex.extra || '').toLowerCase(); + const summary = (ex.summary || '').toLowerCase(); + const languages = (ex.languages || '').toLowerCase(); + return name.includes(q) || skills.includes(q) || modules.includes(q) || + extra.includes(q) || summary.includes(q) || languages.includes(q) || + (ex.certified === 'yes' && 'certificado'.includes(q)); + }); + } + + renderExperts(filtered); + } + + // Update filterExperts to store current filter and search together function filterExperts(filter) { + currentFilter = filter; document.querySelectorAll('.filter-chip').forEach(chip => { chip.classList.toggle('active', chip.dataset.filter === filter); }); - if (filter === 'all') { - renderExperts(allExperts); - } else if (filter === 'certified') { - renderExperts(allExperts.filter(ex => ex.certified === 'yes' || ex.certified === true)); - } else { - // Filter by skills/modules containing the filter term - renderExperts(allExperts.filter(ex => { - const skills = (ex.skills || '').toLowerCase(); - const modules = (ex.modules || '').toLowerCase(); - const combined = skills + ' ' + modules; - // No way to programmatically determine funcional vs developer from API data - // Show all for now - return true; - })); - } + const searchInput = document.getElementById('expertSearch'); + if (searchInput) searchExperts(searchInput.value); } // Load experts on page load @@ -755,23 +780,6 @@ setTimeout(() => toast.classList.remove('show'), 4000); } - // ===== EXPERT FILTERS ===== - function filterExperts(filter) { - document.querySelectorAll('.filter-chip').forEach(chip => { - chip.classList.toggle('active', chip.dataset.filter === filter); - }); - - document.querySelectorAll('#expertGrid .expert-card').forEach(card => { - const role = card.dataset.role; - const certified = card.dataset.certified === 'true'; - let show = true; - if (filter === 'certified') show = certified; - if (filter === 'funcional') show = role === 'funcional'; - if (filter === 'developer') show = role === 'developer'; - card.style.display = show ? '' : 'none'; - }); - } - // ===== SCROLL ANIMATIONS ===== const observer = new IntersectionObserver((entries) => { entries.forEach(entry => {