gabriel / musehub public
release-list.ts typescript
38 lines 1.3 KB
Raw
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a docs: update Suggested Ownership Split table to reflect ful… Sonnet 5 27 days ago
1 /**
2 * release-list.ts — MuseHub releases list page module.
3 *
4 * Client-side filter tabs (All / Stable / Pre-release / Draft) and search.
5 */
6
7 export function initReleaseList(): void {
8 const filterTabs = document.querySelectorAll<HTMLAnchorElement>('.rl-tab');
9 const searchInput = document.getElementById('rel-search') as HTMLInputElement | null;
10 const list = document.getElementById('release-rows');
11 let activeFilter = 'all';
12
13 function applyFilters(): void {
14 const q = searchInput ? searchInput.value.toLowerCase() : '';
15 const rows = list ? list.querySelectorAll<HTMLElement>('.rl-row') : [];
16 rows.forEach(row => {
17 const status = (row.dataset['status'] || '').toLowerCase();
18 const text = (row.dataset['title'] || '').toLowerCase();
19 const statusMatch = activeFilter === 'all' || status === activeFilter;
20 const searchMatch = !q || text.includes(q);
21 row.style.display = statusMatch && searchMatch ? '' : 'none';
22 });
23 }
24
25 filterTabs.forEach(tab => {
26 tab.addEventListener('click', e => {
27 e.preventDefault();
28 filterTabs.forEach(t => t.classList.remove('rl-tab--active'));
29 tab.classList.add('rl-tab--active');
30 activeFilter = tab.dataset['filter'] || 'all';
31 applyFilters();
32 });
33 });
34
35 if (searchInput) {
36 searchInput.addEventListener('input', applyFilters);
37 }
38 }
File History 3 commits
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a docs: update Suggested Ownership Split table to reflect ful… Sonnet 5 27 days ago
sha256:8ea2f75226d5834770ccaddbaa6efda1cc337446fd481bb385de8bec4555ae79 docs: Section 9 CI pipeline — confirm job queue is idempote… Sonnet 5 28 days ago
sha256:80e1a60a39562f6e616aaafbb27487f03abbec7d8ffc6164302b7a0c0bfc63ee docs: check off Section 0 items verified in inventory doc, … Sonnet 5 28 days ago