openvibers/openvibe.mediahub Commits

On a phone, a wide table shows each row as a labelled card (#235)

OP OpenVibers committed 12 days ago · d368ff222a · 5 files, +22 −6

* On a phone, a wide table shows each row as a labelled card

* Tests read a table cell with its column label

* Budget: 2026-11-01: phone table cards

* Budget: 2026-11-01: phone table cards

Changes

ddiff --git a/public/css/app.css b/public/css/app.css
iindex 27a8798..e95e7c4 100644
---- a/public/css/app.css
++++ b/public/css/app.css
@@@ -69,3 +69,18 @@ button.sc-btn.sc-primary { border: 0; }
.faq summary { cursor: pointer; padding: 12px 16px; font-weight: 700; }
.faq details[open] summary { border-bottom: 1px solid var(--border, #1f2d47); }
.faq p { margin: 0; padding: 12px 16px 14px; color: var(--text-secondary, #96a7c2); line-height: 1.6; }
++
++/* Tables on a phone (phone sweep, 2026-11-01): a table of three columns or more shows each row as a card, the first
++ cell its title and every other cell named by its column (html.js gives each cell its data-label). Narrower tables
++ stay tables. Nothing is left out and nothing scrolls sideways. */
++@media (max-width: 640px) {
++ .table-wrap:has(> table thead th:nth-child(3)) { overflow: visible; }
++ .table-wrap > table:has(thead th:nth-child(3)) { display: block; }
++ .table-wrap > table:has(thead th:nth-child(3)) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
++ .table-wrap > table:has(thead th:nth-child(3)) tbody { display: grid; gap: 10px; }
++ .table-wrap > table:has(thead th:nth-child(3)) tr { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border, #1f2d47); border-radius: 14px; background: var(--bg-card, var(--bg-secondary, #101828)); }
++ .table-wrap > table:has(thead th:nth-child(3)) td { display: block; min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
++ .table-wrap > table:has(thead th:nth-child(3)) td:first-child { font-weight: 700; color: var(--text-primary, #e6edf7); }
++ .table-wrap > table:has(thead th:nth-child(3)) td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted, #7386a3); }
++ .table-wrap > table:has(thead th:nth-child(3)) td:empty { display: none; }
++}
ddiff --git a/server/render/html.js b/server/render/html.js
iindex c0f69d9..1dfe9ed 100644
---- a/server/render/html.js
++++ b/server/render/html.js
@@@ -24,10 +24,11 @@ function render(v) {
const code = (s) => html`<code>${s}</code>`;
const time = (iso) => (iso ? html`<time datetime="${iso}">${String(iso).replace('T', ' ').replace(/\.\d+Z$/, ' UTC').replace(/Z$/, ' UTC')}</time>` : '—');
--/** A <table> from headers and rows of cells (cells are already html or plain values). */
++/** A <table> from headers and rows of cells (cells are already html or plain values). Each cell names its column
++ * (data-label), so on a phone a wide table can show each row as a card (the site's stylesheet). */
function table(headers, rows, { cls = '', empty = 'Nothing here yet.' } = {}) {
if (!rows.length) return html`<p class="muted">${empty}</p>`;
-- return html`<div class="table-wrap"><table class="${cls}"><thead><tr>${headers.map((h) => html`<th scope="col">${h}</th>`)}</tr></thead><tbody>${rows.map((r) => html`<tr>${r.map((c) => html`<td>${c}</td>`)}</tr>`)}</tbody></table></div>`;
++ return html`<div class="table-wrap"><table class="${cls}"><thead><tr>${headers.map((h) => html`<th scope="col">${h}</th>`)}</tr></thead><tbody>${rows.map((r) => html`<tr>${r.map((c, i) => (typeof headers[i] === 'string' && headers[i] ? html`<td data-label="${headers[i]}">${c}</td>` : html`<td>${c}</td>`))}</tr>`)}</tbody></table></div>`;
}
/** A problem as returned by Network, Events or Media — shown as it came, never softened. */
ddiff --git a/test/drops.test.js b/test/drops.test.js
iindex 5cf1e0f..9705e13 100644
---- a/test/drops.test.js
++++ b/test/drops.test.js
@@@ -70,7 +70,7 @@ async function drop(t, data, { name = 'notes.bin', token: tokenOverride = null }
assert.strictEqual(dl.status, 200);
assert.strictEqual(sha256(dl.buffer), sha256(data), 'the bytes round-trip');
assert.match(String(dl.headers.get('content-disposition')), /attachment/);
-- assert.ok((await t.get(`/d/${first}`)).text.includes('<td>1</td>'), 'downloads are counted');
++ assert.ok(/<td[^>]*>1<\/td>/.test((await t.get(`/d/${first}`)).text), 'downloads are counted');
});
await check('the per-address caps and the size cap hold', async () => {
ddiff --git a/test/perf-budget.test.js b/test/perf-budget.test.js
iindex b712e4c..23ed1c5 100644
---- a/test/perf-budget.test.js
++++ b/test/perf-budget.test.js
@@@ -21,8 +21,8 @@ const BUDGETS = {
jsRawKB: 401, // 400.5 with openvibe-shared 4.80.0: 33 more solid glyphs in ov-glyphs.js (2026-11-01); 393.9 with openvibe-shared 4.77.0: the navbar loads the glyphs when a page first shows an icon (2026-11-01); 393: 393: /shared/ov-glyphs.js in place of Font Awesome (2026-11-01, plan L54 K4; Font Awesome's CSS and font were external, uncounted, and heavier); 328.2 openvibe-shared 4.70.0 (2026-11-01: the app bar, busy(), skeletons, view transitions); 324.8 with openvibe-shared 4.66.0: the mark with depth and motion, ov-fx loaded on request (2026-10-31); 323.2 with openvibe-shared 4.59.0: the Pair mark beside the name, set in the brand face (2026-10-31); 321.1 with openvibe-shared 4.53.0: the footer's columns fold on phones (2026-10-30); 318.1 with openvibe-shared 4.52.0: the Dock's loader and its Chats tab (2026-10-30); 315.6 with openvibe-shared 4.48.0 (the site switcher on the mark, the menu's Start tab and quick tools; Kit's touch hit areas and the phone navbar fix, 4.44-4.47.3); 307.8 with openvibe-shared 4.43.0 (room.css carries the kit tokens, 4.39.1; the kit's 4.39.0 rules); 300.5 openvibe-shared 4.25.0: the menu's orb beside the brand, both balances on phones, messages, the account sheet on phones and the bar stepping away on phones; 293 openvibe-shared 4.22.0: the navbar's magnifier search button and More dropdown (search.js and loading.js load only when used); 287.2 Shared 4.17.0: OpenCoins and Vibes chips (wallet: true) in the navbar; 273.2 with Shared 4.15.0 (2026-10-27: the compact footer opens into the whole one, the pulse line); 264.3 with Shared 4.13.0; 239.8
jsBrotliKB: 98, // 97.6 with openvibe-shared 4.80.0 (2026-11-01); 96.1 with openvibe-shared 4.77.0 (2026-11-01); 96: 96: /shared/ov-glyphs.js in place of Font Awesome (2026-11-01, plan L54 K4); 80.2 openvibe-shared 4.70.0 (2026-11-01: the app bar, busy(), skeletons, view transitions); 79.5 with openvibe-shared 4.59.0: the Pair mark beside the name, set in the brand face (2026-10-31); 78.2 with openvibe-shared 4.52.0: the Dock's loader and its Chats tab (2026-10-30); 77.6 with openvibe-shared 4.48.0 (the site switcher on the mark, the menu's Start tab and quick tools; Kit's touch hit areas and the phone navbar fix, 4.44-4.47.3); 76.1 with openvibe-shared 4.43.0 (room.css carries the kit tokens, 4.39.1; the kit's 4.39.0 rules); 74.2 openvibe-shared 4.25.0: the menu's orb beside the brand, both balances on phones, messages, the account sheet on phones and the bar stepping away on phones; 70.5 Shared 4.17.0: OpenCoins and Vibes chips (wallet: true) in the navbar; 67.9 Shared 4.15.0; 65.3 Shared 4.12.0: the light/dark switch, the seasonal mark and the theme pairs; 56.5
cssFiles: 2, // 2 (app.css + the cached /shared/showcase.css)
-- cssRawKB: 34, // 33.5 with openvibe-shared 4.48.0 (the site switcher on the mark, the menu's Start tab and quick tools; Kit's touch hit areas and the phone navbar fix, 4.44-4.47.3); 29 openvibe-shared 4.26.1 (hero visual); 23.6 with Shared 4.13.0 (2026-10-26: account links); measured 16.6 (shared 4.1.8: four steps two by two); was 16.5 at 15.0
-- cssBrotliKB: 7.4, // 7.2 with openvibe-shared 4.48.0 (the site switcher on the mark, the menu's Start tab and quick tools; Kit's touch hit areas and the phone navbar fix, 4.44-4.47.3); 5.4 with Shared 4.13.0 (2026-10-26: account links); 3.7; 4.2 with the drive previews (10-15)
++ cssRawKB: 36, // 34.9 with 2026-11-01: phone table cards (2026-11-01); 33.5 with openvibe-shared 4.48.0 (the site switcher on the mark, the menu's Start tab and quick tools; Kit's touch hit areas and the phone navbar fix, 4.44-4.47.3); 29 openvibe-shared 4.26.1 (hero visual); 23.6 with Shared 4.13.0 (2026-10-26: account links); measured 16.6 (shared 4.1.8: four steps two by two); was 16.5 at 15.0
++ cssBrotliKB: 8, // 7.5 with 2026-11-01: phone table cards (2026-11-01); 7.2 with openvibe-shared 4.48.0 (the site switcher on the mark, the menu's Start tab and quick tools; Kit's touch hit areas and the phone navbar fix, 4.44-4.47.3); 5.4 with Shared 4.13.0 (2026-10-26: account links); 3.7; 4.2 with the drive previews (10-15)
externalFiles: 0, // 0
};
ddiff --git a/test/pics.test.js b/test/pics.test.js
iindex 49afc14..ad691dd 100644
---- a/test/pics.test.js
++++ b/test/pics.test.js
@@@ -82,7 +82,7 @@ function multipart(fields, file) {
assert.match(home, /<title>OpenVibe\.Pics: share and embed pictures with a link<\/title>/);
const sections = ['How it works', 'The links a picture gets', 'Upload from your own app', 'What a free account gets', 'Questions', 'More on OpenVibe'];
assert.deepStrictEqual(sections.filter((h) => !home.includes(`>${h}</h2>`)), [], 'every section is there');
-- assert.ok(home.includes('<td>20 MB</td>') && home.includes('<td>200</td>') && home.includes('<td>5 GB</td>'), 'the limits are the configured ones');
++ assert.ok(/<td[^>]*>20 MB<\/td>/.test(home) && /<td[^>]*>200<\/td>/.test(home) && /<td[^>]*>5 GB<\/td>/.test(home), 'the limits are the configured ones');
assert.ok(home.includes('/api/v1/images \\\n -H "Authorization: Bearer $OPENVIBE_TOKEN" \\\n'), 'the curl sample keeps its line breaks');
const ld = [...home.matchAll(/<script type="application\/ld\+json">([\s\S]*?)<\/script>/g)].flatMap((m) => [].concat(JSON.parse(m[1])));
const faq = ld.find((x) => x['@type'] === 'FAQPage');