diff --git a/changelog.d/fixed-matrix-terminal-hud-cta.md b/changelog.d/fixed-matrix-terminal-hud-cta.md new file mode 100644 index 0000000000..4a7b8bc85b --- /dev/null +++ b/changelog.d/fixed-matrix-terminal-hud-cta.md @@ -0,0 +1 @@ +- Matrix kiosk: the freshness HUD and get-started CTA now stay pinned above the canvas in every effect, including `mx.effect=terminal`, and typed rows stop above the HUD band. diff --git a/src/pkg/dashboard/kiosk_cta.test.js b/src/pkg/dashboard/kiosk_cta.test.js index 7fbcef84f2..4c5ce7cddb 100644 --- a/src/pkg/dashboard/kiosk_cta.test.js +++ b/src/pkg/dashboard/kiosk_cta.test.js @@ -31,5 +31,5 @@ test('badge wiring: placeholder outside the root, hidden without the body class, assert.ok(root > 0 && ph > root, 'placeholder must follow the dashboard root'); assert.ok(html.includes('#kiosk-cta { display: none; }')); assert.ok(html.includes('body.kiosk-cta-on #kiosk-cta {')); - assert.ok(html.includes('body.matrix-mode #kiosk-cta { z-index: 100001; opacity: .85; }')); + assert.ok(html.includes('body.matrix-mode #kiosk-cta { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 100001; opacity: .85; }')); }); diff --git a/src/pkg/dashboard/matrix_ui_test.go b/src/pkg/dashboard/matrix_ui_test.go index 3b2f0413dc..f41213572f 100644 --- a/src/pkg/dashboard/matrix_ui_test.go +++ b/src/pkg/dashboard/matrix_ui_test.go @@ -34,6 +34,12 @@ func TestMatrixUIWiring(t *testing.T) { } } css := read("css/matrix.css") + // Overlays must be viewport-pinned and layered above the canvas in every effect (#16441). + for _, want := range []string{"body.matrix-mode .matrix-canvas { display: block; position: absolute; inset: 0; z-index: 0;", "body.matrix-mode .matrix-labels { position: fixed; bottom: 1rem; left: 1rem;", "body.matrix-mode #kiosk-cta { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 100001;"} { + if !strings.Contains(css, want) { + t.Errorf("matrix.css missing %q", want) + } + } for _, rule := range strings.Split(css, "}") { selector, _, ok := strings.Cut(strings.TrimSpace(rule), "{") if !ok { @@ -123,6 +129,13 @@ async function scenario(query, reduced = false, status = 200) { if (/cascade|ghost|terminal/.test(query)) assert(draws.some(a => a[0] === 'org/repo#2 ยท main.go')); if (query.includes('ghost')) assert(draws.some(a => a[0] === 'main.go')); if (query.includes('terminal')) assert(draws.some(a => a[0] === '+ ')); + // The freshness HUD stays mounted, unhidden and populated in every effect, + // and the typed effects keep their baseline above the HUD band (#16441). + const hud = byClass('matrix-labels'); + assert(!hud.hidden); assert.equal(hud.children.length, 3); + assert(hud.children[0].textContent.includes('lines pushed')); assert(hud.children[1].textContent); + assert.equal(doc.getElementById('hive-matrix').children.indexOf(hud), 3); + if (/ghost|terminal/.test(query)) assert(draws.filter(a => a.length === 3).every(a => a[2] <= win.innerHeight - 100)); } doc.hidden = true; docEvents.visibilitychange.forEach(fn => fn()); assert.equal(raf.size, 0); assert.equal(timers.size, 0); diff --git a/src/pkg/dashboard/static-src/css/matrix.css b/src/pkg/dashboard/static-src/css/matrix.css index b8c35ee708..ec03d32308 100644 --- a/src/pkg/dashboard/static-src/css/matrix.css +++ b/src/pkg/dashboard/static-src/css/matrix.css @@ -7,11 +7,11 @@ body.matrix-mode #hive-matrix { --matrix-muted: #b8ccbb; position: fixed; inset: 0; z-index: 100000; background: var(--matrix-bg); color: var(--matrix-color, var(--matrix-fg)); font: 16px monospace; } -body.matrix-mode .matrix-canvas { width: 100%; height: 100%; } -body.matrix-mode .matrix-labels { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } -body.matrix-mode .matrix-notice { position: absolute; top: 2rem; left: 1rem; right: 1rem; color: var(--matrix-text); } -body.matrix-mode .matrix-list { position: absolute; inset: 4rem 1rem 8rem; overflow: hidden; } +body.matrix-mode .matrix-canvas { display: block; position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; } +body.matrix-mode .matrix-labels { position: fixed; bottom: 1rem; left: 1rem; max-width: min(60vw, 48rem); z-index: 2; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } +body.matrix-mode .matrix-notice { position: fixed; top: 2rem; left: 1rem; right: 1rem; z-index: 2; color: var(--matrix-text); } +body.matrix-mode .matrix-list { position: absolute; inset: 4rem 1rem 8rem; z-index: 1; overflow: hidden; } body.matrix-mode .matrix-list pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 1rem; } body.matrix-mode .matrix-list small { color: var(--matrix-muted); } body.matrix-mode #hive-matrix [hidden] { display: none !important; } -body.matrix-mode #kiosk-cta { z-index: 100001; opacity: .85; } +body.matrix-mode #kiosk-cta { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 100001; opacity: .85; } diff --git a/src/pkg/dashboard/static-src/js/matrix.js b/src/pkg/dashboard/static-src/js/matrix.js index 0b1a0137b7..225ae94881 100644 --- a/src/pkg/dashboard/static-src/js/matrix.js +++ b/src/pkg/dashboard/static-src/js/matrix.js @@ -75,6 +75,10 @@ rs: 'rs', c: 'c', h: 'c', cc: 'c', cpp: 'c', hpp: 'c', java: 'c', cs: 'c'}; Object.keys(languages).forEach(function(k){ languages[k].words = new Set(languages[k].words.split(' ')); }); function paused(){ return manualPause || document.hidden; } + // Height of the bottom band the freshness HUD occupies, so typed rows + // never run under it in any effect (#16441). 100px is the floor used + // before the HUD was measured. + function hudBand(){ return Math.max(100, (labels.offsetHeight || 0) + 32); } function resize(){ width = window.innerWidth; height = window.innerHeight; canvas.width = width; canvas.height = height; @@ -170,7 +174,7 @@ top = 56; } ctx.font = '16px monospace'; - var visible = Math.max(1, Math.floor((height - top - 100) / rowH)); + var visible = Math.max(1, Math.floor((height - top - hudBand()) / rowH)); var current = {n: tab.count + 1, path: typing.line.path, text: typing.chars.slice(0, Math.floor(typing.typed)).join(''), current: true}; tab.rows.slice(-(visible - 1) || tab.rows.length).concat([current]).forEach(function(row, i){ var y = top + (i + 1) * rowH, col = 0; @@ -200,7 +204,7 @@ if (!termRows.length) emitTerminal(); termClock += dt * 4; while (termClock >= 1) { termClock -= 1; emitTerminal(); } - var bottom = height - 100; + var bottom = height - hudBand(); ctx.font = '16px monospace'; termRows.forEach(function(row, i){ var y = bottom - (termRows.length - 1 - i + termClock) * rowH; diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 80065e550f..12732f88eb 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -7035,14 +7035,14 @@ --matrix-muted: #b8ccbb; position: fixed; inset: 0; z-index: 100000; background: var(--matrix-bg); color: var(--matrix-color, var(--matrix-fg)); font: 16px monospace; } -body.matrix-mode .matrix-canvas { width: 100%; height: 100%; } -body.matrix-mode .matrix-labels { position: absolute; bottom: 1rem; left: 1rem; right: 1rem; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } -body.matrix-mode .matrix-notice { position: absolute; top: 2rem; left: 1rem; right: 1rem; color: var(--matrix-text); } -body.matrix-mode .matrix-list { position: absolute; inset: 4rem 1rem 8rem; overflow: hidden; } +body.matrix-mode .matrix-canvas { display: block; position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; } +body.matrix-mode .matrix-labels { position: fixed; bottom: 1rem; left: 1rem; max-width: min(60vw, 48rem); z-index: 2; padding: var(--sp-3); background: var(--matrix-surface); color: var(--matrix-text); font-size: var(--fs-base); overflow-wrap: anywhere; } +body.matrix-mode .matrix-notice { position: fixed; top: 2rem; left: 1rem; right: 1rem; z-index: 2; color: var(--matrix-text); } +body.matrix-mode .matrix-list { position: absolute; inset: 4rem 1rem 8rem; z-index: 1; overflow: hidden; } body.matrix-mode .matrix-list pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: .3rem 0 1rem; } body.matrix-mode .matrix-list small { color: var(--matrix-muted); } body.matrix-mode #hive-matrix [hidden] { display: none !important; } -body.matrix-mode #kiosk-cta { z-index: 100001; opacity: .85; } +body.matrix-mode #kiosk-cta { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: 100001; opacity: .85; } .var-empty{color:var(--muted);font-size:var(--fs-sm);padding:var(--sp-2) var(--sp-0)} .var-section{margin-top:var(--sp-6);border-top:1px solid var(--border);padding-top:var(--sp-5)} .var-heading{font-weight:600;font-size:var(--fs-sm);margin-bottom:var(--sp-4)} @@ -7137,6 +7137,10 @@ rs: 'rs', c: 'c', h: 'c', cc: 'c', cpp: 'c', hpp: 'c', java: 'c', cs: 'c'}; Object.keys(languages).forEach(function(k){ languages[k].words = new Set(languages[k].words.split(' ')); }); function paused(){ return manualPause || document.hidden; } + // Height of the bottom band the freshness HUD occupies, so typed rows + // never run under it in any effect (#16441). 100px is the floor used + // before the HUD was measured. + function hudBand(){ return Math.max(100, (labels.offsetHeight || 0) + 32); } function resize(){ width = window.innerWidth; height = window.innerHeight; canvas.width = width; canvas.height = height; @@ -7232,7 +7236,7 @@ top = 56; } ctx.font = '16px monospace'; - var visible = Math.max(1, Math.floor((height - top - 100) / rowH)); + var visible = Math.max(1, Math.floor((height - top - hudBand()) / rowH)); var current = {n: tab.count + 1, path: typing.line.path, text: typing.chars.slice(0, Math.floor(typing.typed)).join(''), current: true}; tab.rows.slice(-(visible - 1) || tab.rows.length).concat([current]).forEach(function(row, i){ var y = top + (i + 1) * rowH, col = 0; @@ -7262,7 +7266,7 @@ if (!termRows.length) emitTerminal(); termClock += dt * 4; while (termClock >= 1) { termClock -= 1; emitTerminal(); } - var bottom = height - 100; + var bottom = height - hudBand(); ctx.font = '16px monospace'; termRows.forEach(function(row, i){ var y = bottom - (termRows.length - 1 - i + termClock) * rowH;