(id, options = {})
| 331 | } |
| 332 | |
| 333 | function renderSection(id, options = {}) { |
| 334 | const section = sections.find((candidate) => candidate.id === id) || sections[0]; |
| 335 | if (!section) return; |
| 336 | |
| 337 | currentSectionId = section.id; |
| 338 | if (activeSection) activeSection.dataset.currentId = section.id; |
| 339 | setActiveNav(section.id); |
| 340 | setSectionHeader( |
| 341 | section.fullName || section.name, |
| 342 | section.items?.length || 0, |
| 343 | '', |
| 344 | getSectionDescription(section), |
| 345 | ); |
| 346 | renderCards(section.items || []); |
| 347 | setResultStatus('', false); |
| 348 | if (emptyState) emptyState.style.display = 'none'; |
| 349 | if (activeSection) activeSection.style.display = ''; |
| 350 | if (searchInput && options.clearSearch) searchInput.value = ''; |
| 351 | clearSearchBtn?.classList.toggle('visible', Boolean(searchInput?.value?.trim())); |
| 352 | if (options.updateUrl) updateUrl({ sectionId: section.id }); |
| 353 | if (options.scroll) { |
| 354 | const top = activeSection |
| 355 | ? activeSection.getBoundingClientRect().top + window.pageYOffset - 80 |
| 356 | : 0; |
| 357 | window.scrollTo({ top, behavior: 'smooth' }); |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | function getMatches(item, query) { |
| 362 | const title = item.title || ''; |
no test coverage detected