openvibers/openvibe.bench Commits

Ratings: the columns line up on phones and the votes sit under their header (#35)

OP OpenVibers committed 14 days ago · b1cf250f14 · 2 files, +10 −7

The phone rows each sized their own columns, so the model names and scores
moved from row to row; every row now shares one set of columns. The interval
is its own span: inline on a desktop, a small line under the score on a phone,
so 1014 (878-1144) no longer breaks in the middle. The votes were left-aligned
under a right-aligned header (.br-table td outranked .rt-num).

Changes

ddiff --git a/public/css/bench.css b/public/css/bench.css
iindex 611eee2..79bf0b1 100644
---- a/public/css/bench.css
++++ b/public/css/bench.css
@@@ -332,7 +332,8 @@ html, body { margin: 0; background: var(--bg-primary, #0a0f1c); color: var(--tex
.rt-model { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; overflow-wrap: break-word; }
.rt-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.rt-score-muted { color: var(--text-secondary, #96a7c2); font-weight: 650; }
--.rt-num { text-align: right; font-variant-numeric: tabular-nums; }
++.rt-ci { font-weight: 600; white-space: nowrap; }
++.rt-table td.rt-num { text-align: right; font-variant-numeric: tabular-nums; }
.rt-band { display: inline-block; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--room-accent) 14%, transparent); color: var(--room-strong); font-size: .78rem; font-weight: 750; white-space: nowrap; }
.rt-bar { display: block; width: 100%; height: 8px; margin-top: 6px; }
.rt-bar-track { fill: color-mix(in srgb, var(--text-muted, #7386a3) 24%, transparent); }
@@@ -348,13 +349,14 @@ html, body { margin: 0; background: var(--bg-primary, #0a0f1c); color: var(--tex
@media (max-width: 560px) {
.rt-table, .rt-table tbody { display: block; width: 100%; }
.rt-table thead { display: none; }
-- .rt-table tr { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border, #1f2d47); }
++ .rt-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.5em; gap: 6px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border, #1f2d47); }
.rt-table tbody tr:last-child { border-bottom: 0; }
.rt-table td { display: block; padding: 0; border: 0; min-width: 0; width: auto; }
.rt-col-band { grid-area: 1 / 1 / 2 / 2; }
.rt-col-model { grid-area: 1 / 2 / 2 / 4; }
.rt-col-controlled { grid-area: 2 / 1 / 3 / 2; }
.rt-col-raw { grid-area: 2 / 2 / 3 / 3; }
-- .rt-col-votes { grid-area: 2 / 3 / 3 / 4; text-align: right; }
++ .rt-table td.rt-col-votes { grid-area: 2 / 3 / 3 / 4; text-align: right; }
.rt-bar { height: 6px; margin-top: 4px; }
++ .rt-ci { display: block; font-size: .78rem; color: var(--text-secondary, #96a7c2); }
}
ddiff --git a/server/http/ratings.js b/server/http/ratings.js
iindex cdb0f08..bd0113d 100644
---- a/server/http/ratings.js
++++ b/server/http/ratings.js
@@@ -21,11 +21,12 @@ const { board, boardView } = require('../rating/board');
const num = (v, d = 0) => (v == null || Number.isNaN(Number(v)) ? d : Number(v));
/** The rounded score and its interval, as text. */
--function scoreText(cell) {
++/** The score and its interval as HTML: the interval in its own span, so a phone can set it on a line of its own. */
++function scoreHtml(cell) {
if (!cell) return '—';
const lo = cell.ci_lower == null ? null : Math.round(cell.ci_lower);
const hi = cell.ci_upper == null ? null : Math.round(cell.ci_upper);
-- return Math.round(cell.rating) + (lo == null ? '' : ' (' + lo + '–' + hi + ')');
++ return esc(Math.round(cell.rating)) + (lo == null ? '' : ' <span class="rt-ci">(' + esc(lo) + '–' + esc(hi) + ')</span>');
}
/**
@@@ -87,9 +88,9 @@ function rows(view) {
const body = models.map((m) => '<tr data-model="' + esc(m.model) + '">'
+ '<td class="rt-col-band"><span class="rt-band">' + esc(m.controlled.band || m.raw.band || '') + '</span></td>'
+ '<td class="rt-col-model"><span class="rt-model">' + esc(m.model) + '</span></td>'
-- + '<td class="rt-col-controlled"><span class="rt-score">' + esc(scoreText(m.controlled)) + '</span>'
++ + '<td class="rt-col-controlled"><span class="rt-score">' + scoreHtml(m.controlled) + '</span>'
+ bar(m.controlled, scale) + '</td>'
-- + '<td class="rt-col-raw"><span class="rt-score rt-score-muted">' + esc(scoreText(m.raw)) + '</span>'
++ + '<td class="rt-col-raw"><span class="rt-score rt-score-muted">' + scoreHtml(m.raw) + '</span>'
+ bar(m.raw, scale) + '</td>'
+ '<td class="rt-col-votes rt-num">' + esc(m.votes) + '</td>'
+ '</tr>').join('');