1c203eba8a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
1.1 KiB
JavaScript
15 lines
1.1 KiB
JavaScript
// Organic board page: shows the rotation, counts views after 5 s on screen (one-time server token).
|
|
(async function () {
|
|
await BL.renderNav('/board'); BL.renderFooter();
|
|
const $ = BL.$;
|
|
const [b, s] = await Promise.all([BL.getJSON('/api/board'), BL.getJSON('/api/stats')]);
|
|
const box = $('lots');
|
|
for (const t of b.tiles || []) box.appendChild(BL.tile(t, { meta: true }));
|
|
const spots = (b.tiles || []).filter(t => t.t === 'spot').length;
|
|
$('boardNote').textContent = spots ? spots + ' member spot' + (spots === 1 ? '' : 's') + ' on this view. Reload to see the rotation.' : 'No member spots are delivering right now. Network sites fill the open slots.';
|
|
if (b.token) setTimeout(() => { if (document.visibilityState === 'visible') BL.post('/api/board/seen', { token: b.token }); }, 5500);
|
|
const t = (s && s.totals) || {};
|
|
$('stats').innerHTML = [['Spots in the line', t.spots || 0], ['Members', t.members || 0], ['POL paid in', BL.fmtPol(t.paidInWei || 0)], ['POL paid out to members and fees', BL.fmtPol(t.paidOutWei || 0)]]
|
|
.map(x => '<div class="stat"><b>' + BL.esc(x[1]) + '</b><span>' + BL.esc(x[0]) + '</span></div>').join('');
|
|
})();
|