openvibers/openvibe.live Commits

Home stats link every OpenVibe site's numbers (openvibe.network/stats), under the board and in the chart dialog (#410)

OP OpenVibers committed 17 days ago · 5c6a6dcaa0 · 3 files, +5 −1

Changes

ddiff --git a/public/js/app-home.js b/public/js/app-home.js
iindex 8a45e2d2..51198129 100644
---- a/public/js/app-home.js
++++ b/public/js/app-home.js
@@@ -462,6 +462,7 @@ function _renderHeroStats(stats) {
<span class="hero-stat-kicker"><i class="fa-solid ${g.icon}"></i>${g.kicker}</span>
<div class="hero-stat-row">${g.rows.map(chip).join('')}</div>
</div>`).join('')}
++ <a class="hero-stat-all-sites" href="https://openvibe.network/stats"><i class="fa-solid fa-chart-column" aria-hidden="true"></i><span>Stats for every OpenVibe site</span><i class="fa-solid fa-arrow-right" aria-hidden="true"></i></a>
</div>`;
const btn = wrap.querySelector('#hero-stat-more');
ddiff --git a/public/js/stats-nerds.js b/public/js/stats-nerds.js
iindex c286f3bb..cb393978 100644
---- a/public/js/stats-nerds.js
++++ b/public/js/stats-nerds.js
@@@ -168,7 +168,7 @@
<div class="sn-table" hidden></div>
<div class="sn-tip" role="status" aria-live="polite" hidden></div>
</div>
-- <footer class="sn-foot"><span class="sn-note"></span><span class="sn-swipe-hint">Swipe for more stats</span><button type="button" class="sn-csv"><i class="fa-solid fa-download"></i> CSV</button></footer>
++ <footer class="sn-foot"><span class="sn-note"></span><span class="sn-swipe-hint">Swipe for more stats</span><a class="sn-all" href="https://openvibe.network/stats"><i class="fa-solid fa-chart-column" aria-hidden="true"></i> Every site</a><button type="button" class="sn-csv"><i class="fa-solid fa-download"></i> CSV</button></footer>
</div>`;
document.body.appendChild(ov);
state.overlay = ov;
ddiff --git a/test/home-stat-board.test.js b/test/home-stat-board.test.js
iindex 867f45d4..cd6e8557 100644
---- a/test/home-stat-board.test.js
++++ b/test/home-stat-board.test.js
@@@ -44,6 +44,8 @@ const strip = src.slice(src.indexOf('const HEADLINE = ['), src.indexOf('];', src
const stripMetrics = [...strip.matchAll(/metric: '([a-zA-Z]+)'/g)].map((m) => m[1]);
assert.strictEqual(new Set(stripMetrics).size, stripMetrics.length, 'the strip shows each metric once');
assert.strictEqual(stripMetrics.length, 9, 'nine chips: three rows of three on a phone');
++// Every site's numbers (openvibe.network/stats, Network#359) under the board and in the chart dialog.
++assert.ok(src.includes('<a class="hero-stat-all-sites" href="https://openvibe.network/stats">'), 'the board links every site\'s numbers');
// The chart dialog: daily headcounts have no running total, and an error answer is never redrawn.
const nerds = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'stats-nerds.js'), 'utf8');
@@@ -51,4 +53,5 @@ assert.ok(/const DISTINCT = new Set\(\['active', 'supporters'\]\)/.test(nerds));
assert.ok(nerds.includes("DISTINCT.has(m.metric) ? [['daily', 'Per day']]"), 'a headcount offers only per day');
assert.ok(nerds.includes('if (state.data?.points && !state.table) drawChart();'), 'a resize never redraws an error answer');
assert.ok(nerds.includes('const asked = Number(chip?.dataset?.days);'), 'the 24-hour line opens its own 24 hours');
++assert.ok(nerds.includes('<a class="sn-all" href="https://openvibe.network/stats">'), 'and the dialog links them too');
console.log('home stat board: all checks passed');