branches.ts
typescript
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a
docs: update Suggested Ownership Split table to reflect ful…
Sonnet 5
29 days ago
| 1 | /** |
| 2 | * branches.ts — MuseHub branches page module. |
| 3 | * |
| 4 | * Handles client-side filtering (by type tab) and search across branch rows. |
| 5 | */ |
| 6 | |
| 7 | export function initBranches(): void { |
| 8 | const searchInput = document.getElementById('branch-search') as HTMLInputElement | null; |
| 9 | const branchList = document.getElementById('branch-list'); |
| 10 | const typeTabs = document.querySelectorAll<HTMLAnchorElement>('.br-tab'); |
| 11 | let activeFilter = 'all'; |
| 12 | |
| 13 | function applyFilters(): void { |
| 14 | const q = searchInput ? searchInput.value.toLowerCase() : ''; |
| 15 | const rows = branchList ? branchList.querySelectorAll<HTMLElement>('.br-row') : []; |
| 16 | rows.forEach(row => { |
| 17 | const name = (row.dataset['branchName'] || '').toLowerCase(); |
| 18 | const type = (row.dataset['branchType'] || '').toLowerCase(); |
| 19 | const nameMatch = !q || name.includes(q); |
| 20 | const typeMatch = activeFilter === 'all' || type === activeFilter; |
| 21 | row.style.display = nameMatch && typeMatch ? '' : 'none'; |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | if (searchInput) { |
| 26 | searchInput.addEventListener('input', applyFilters); |
| 27 | } |
| 28 | |
| 29 | typeTabs.forEach(tab => { |
| 30 | tab.addEventListener('click', e => { |
| 31 | e.preventDefault(); |
| 32 | typeTabs.forEach(t => t.classList.remove('br-tab--active')); |
| 33 | tab.classList.add('br-tab--active'); |
| 34 | activeFilter = tab.dataset['filter'] || 'all'; |
| 35 | applyFilters(); |
| 36 | }); |
| 37 | }); |
| 38 | } |
File History
3 commits
sha256:20b27796ed512236119feef48b4577a8fd9ded05a15267dd4e6da23604ad1f1a
docs: update Suggested Ownership Split table to reflect ful…
Sonnet 5
29 days ago
sha256:8ea2f75226d5834770ccaddbaa6efda1cc337446fd481bb385de8bec4555ae79
docs: Section 9 CI pipeline — confirm job queue is idempote…
Sonnet 5
29 days ago
sha256:80e1a60a39562f6e616aaafbb27487f03abbec7d8ffc6164302b7a0c0bfc63ee
docs: check off Section 0 items verified in inventory doc, …
Sonnet 5
29 days ago