gabriel / musehub public
sessions.ts typescript
36 lines 1.3 KB
Raw
sha256:c2e5cf2d754ed2fe9a94e879d41ad12ff221d2ac4ac7b45247fcb981c76858bf docs: Section 8 database/migrations/backups — verified live… Sonnet 5 25 days ago
1 /**
2 * sessions.ts — MuseHub sessions page module.
3 */
4
5 export function initSessions(): void {
6 const filterTabs = document.querySelectorAll<HTMLAnchorElement>('.sess-filter-tab');
7 const searchInput = document.getElementById('sess-search') as HTMLInputElement | null;
8 const list = document.getElementById('session-rows');
9 let activeFilter = 'all';
10
11 function applyFilters(): void {
12 const q = searchInput ? searchInput.value.toLowerCase() : '';
13 const cards = list ? list.querySelectorAll<HTMLElement>('.sess-card') : [];
14 cards.forEach(card => {
15 const status = (card.dataset.status || '').toLowerCase();
16 const text = (card.dataset.intent || '').toLowerCase() + ' ' + (card.dataset.location || '').toLowerCase();
17 const statusMatch = activeFilter === 'all' || status === activeFilter;
18 const searchMatch = !q || text.includes(q);
19 card.style.display = statusMatch && searchMatch ? '' : 'none';
20 });
21 }
22
23 filterTabs.forEach(tab => {
24 tab.addEventListener('click', e => {
25 e.preventDefault();
26 filterTabs.forEach(t => t.classList.remove('active'));
27 tab.classList.add('active');
28 activeFilter = tab.dataset.filter || 'all';
29 applyFilters();
30 });
31 });
32
33 if (searchInput) {
34 searchInput.addEventListener('input', applyFilters);
35 }
36 }
File History 2 commits
sha256:c2e5cf2d754ed2fe9a94e879d41ad12ff221d2ac4ac7b45247fcb981c76858bf docs: Section 8 database/migrations/backups — verified live… Sonnet 5 25 days ago
sha256:80e1a60a39562f6e616aaafbb27487f03abbec7d8ffc6164302b7a0c0bfc63ee docs: check off Section 0 items verified in inventory doc, … Sonnet 5 25 days ago