diff --git a/public/assets/my.js b/public/assets/my.js index 8669556..c2a0eb1 100644 --- a/public/assets/my.js +++ b/public/assets/my.js @@ -292,8 +292,18 @@ const el = $('trainingList'); if (!el) return; const items = r.items || []; if (!items.length) { el.innerHTML = '
Training materials are being added. Check back soon.
'; return; } + // section pills at the top: one per group, plus All; the active pill filters the list + const groups = [...new Set(items.map(it => it.group).filter(Boolean))]; + const pills = $('trainingPills'); + const want = loadTraining.filter || 'all'; + if (pills) { + pills.hidden = groups.length < 2; + pills.innerHTML = ['all', ...groups].map(g => '').join(''); + pills.querySelectorAll('[data-tg]').forEach(b => b.addEventListener('click', () => { loadTraining.filter = b.dataset.tg; loadTraining(); })); + } + const shown = want === 'all' ? items : items.filter(it => it.group === want); let lastGroup = null; - el.innerHTML = items.map(it => { + el.innerHTML = shown.map(it => { // optional section header: entries carry a `group`; a header renders when it changes let head = ''; if (it.group && it.group !== lastGroup) { lastGroup = it.group; head = 'Everything to help you get started and grow: walkthrough videos and materials. New lessons land here as they are added.
+ @@ -796,7 +797,7 @@ - +