MCPcopy Index your code
hub / github.com/jackvale/rectg / renderSection

Function renderSection

web/src/scripts/main.js:333–359  ·  view source on GitHub ↗
(id, options = {})

Source from the content-addressed store, hash-verified

331}
332
333function 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
361function getMatches(item, query) {
362 const title = item.title || '';

Callers 4

renderSearchFunction · 0.85
initSidebarFunction · 0.85
clearSearchFunction · 0.85
initSearchFunction · 0.85

Calls 6

setActiveNavFunction · 0.85
setSectionHeaderFunction · 0.85
getSectionDescriptionFunction · 0.85
renderCardsFunction · 0.85
setResultStatusFunction · 0.85
updateUrlFunction · 0.85

Tested by

no test coverage detected