diff --git a/explore/public/index.html b/explore/public/index.html index d384046..8ef6a39 100644 --- a/explore/public/index.html +++ b/explore/public/index.html @@ -720,7 +720,7 @@ - caps + caps skills beacons stats @@ -811,15 +811,16 @@ } return { view: 'skills' }; } + if (hash === 'caps') return { view: 'caps' }; if (hash === 'stats') return { view: 'stats' }; - return { view: 'caps' }; + return { view: 'stats' }; } function updateNav() { const route = getRoute(); document.querySelectorAll('.sub-nav a').forEach(function(a) { const href = a.getAttribute('href'); - if (route.view === 'caps' || route.view === 'cap') a.classList.toggle('active', href === '#'); + if (route.view === 'caps' || route.view === 'cap') a.classList.toggle('active', href === '#caps'); else if (route.view === 'skills' || route.view === 'skill') a.classList.toggle('active', href === '#skills'); else if (route.view === 'beacons' || route.view === 'beacon') a.classList.toggle('active', href === '#beacons'); else if (route.view === 'stats') a.classList.toggle('active', href === '#stats'); @@ -949,7 +950,7 @@ async function renderCapDetail(el, ref) { var data = await api('cap?ref=' + encodeURIComponent(ref)); if (!data.cap) { - el.innerHTML = '← back to capsCap not found.No cap with ref ' + esc(ref) + ' was found.'; + el.innerHTML = '← back to capsCap not found.No cap with ref ' + esc(ref) + ' was found.'; return; } var cap = data.cap; @@ -973,7 +974,7 @@ var beacon = cap.beacon ? '' + esc(cap.beacon) + '' : ''; var metaParts = [author, beacon, time].filter(Boolean); - var html = '← caps'; + var html = '← caps'; html += ''; html += '' + title + kindBadge + ''; html += '' + metaParts.join(' · ') + ''; @@ -1145,6 +1146,18 @@ capsContainer = document.getElementById('caps-list'); capsContainer.innerHTML = data.caps.map(renderCapItem).join(''); appendLoadMore(el); + + // Fetch skills from this beacon's publishers + const dids = [...new Set(data.caps.map(function(c) { return c.did; }).filter(Boolean))]; + if (dids.length > 0) { + const skillsUrl = 'skills?' + dids.map(function(d) { return 'did=' + encodeURIComponent(d); }).join('&'); + const skillsData = await api(skillsUrl); + if (skillsData.skills && skillsData.skills.length > 0) { + const skillsHtml = 'skills from these publishers' + + '' + skillsData.skills.map(renderSkillItem).join('') + ''; + el.insertAdjacentHTML('beforeend', skillsHtml); + } + } } async function renderBeacons(el) { diff --git a/explore/src/api.js b/explore/src/api.js index f3701b9..6ba3911 100644 --- a/explore/src/api.js +++ b/explore/src/api.js @@ -154,6 +154,12 @@ export async function handleRequest(request, env) { bindings.push(tag); } + const dids = searchParams.getAll('did'); + if (dids.length > 0) { + conditions.push('s.did IN (' + dids.map(function() { return '?'; }).join(', ') + ')'); + bindings.push(...dids); + } + if (cursor) { conditions.push('s.id < ?'); bindings.push(cursor);
Cap not found.
No cap with ref ' + esc(ref) + ' was found.
' + esc(ref) + '