From e64ce4b2f0c7e7da144d9f1e16669d00d4e9ebf2 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:10:40 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20dashboard:=20add=20=3Fkiosk=3D1=20u?= =?UTF-8?q?nattended=20display=20mode=20for=20the=20Activity=20Monitor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/added-dashboard-kiosk-mode.md | 1 + src/docs/dashboard-sections.md | 2 ++ src/pkg/dashboard/kiosk_mode_test.go | 38 ++++++++++++++++++++++ src/pkg/dashboard/static-src/css/kiosk.css | 14 ++++++++ src/pkg/dashboard/static-src/js/boot.js | 10 ++++++ src/pkg/dashboard/static-src/js/nps.js | 1 + src/pkg/dashboard/static-src/js/welcome.js | 1 + src/pkg/dashboard/static-src/manifest.txt | 1 + src/pkg/dashboard/static/index.html | 26 +++++++++++++++ 9 files changed, 94 insertions(+) create mode 100644 changelog.d/added-dashboard-kiosk-mode.md create mode 100644 src/pkg/dashboard/kiosk_mode_test.go create mode 100644 src/pkg/dashboard/static-src/css/kiosk.css diff --git a/changelog.d/added-dashboard-kiosk-mode.md b/changelog.d/added-dashboard-kiosk-mode.md new file mode 100644 index 0000000000..6ab0c1e026 --- /dev/null +++ b/changelog.d/added-dashboard-kiosk-mode.md @@ -0,0 +1 @@ +- The dashboard accepts `?kiosk=1` for an unattended display mode ([#15596](https://github.com/hivecommons/hive/issues/15596), part of [#15594](https://github.com/hivecommons/hive/issues/15594)): only the Hive activity monitor renders, full viewport, with the sidebar, topbar, notices and every other section hidden and no Welcome or feedback dialog opening on its own, so a headless browser can stream it. Without the parameter the dashboard is unchanged. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 3f07bed9ed..2899cb88c5 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -742,6 +742,8 @@ More about the line: A progress strip per open issue and pull request showing which step of the pipeline it is on and who must act next. +**Kiosk mode.** Open the dashboard with `?kiosk=1` to show only this section, full screen, for an unattended display such as a headless browser stream. The sidebar, top bar, notices and every other section are hidden, and no Welcome or feedback dialog opens by itself. Without the parameter nothing changes. + ### First use: find the next action 1. Find an item by repository, number or title. Every open issue and PR in the watched repositories is represented, including held, draft, filtered, exempt and reporter-triage work. Being visible does not make it actionable. diff --git a/src/pkg/dashboard/kiosk_mode_test.go b/src/pkg/dashboard/kiosk_mode_test.go new file mode 100644 index 0000000000..d93ab94dc9 --- /dev/null +++ b/src/pkg/dashboard/kiosk_mode_test.go @@ -0,0 +1,38 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// TestKioskModeWiring pins the ?kiosk=1 unattended display mode: boot flags +// , the kiosk stylesheet hides the chrome with enough specificity to +// beat the !important topbar rules in /api/theme.css, and the auto-opened +// dialogs bail out. +func TestKioskModeWiring(t *testing.T) { + html := indexHTML(t) + for _, want := range []string{ + `new URLSearchParams(window.location.search).get('kiosk') === '1'`, + `document.documentElement.classList.add('kiosk');`, + `html.kiosk body #oc-topbar.oc-topbar,`, + `html.kiosk body #oc-sidebar,`, + `html.kiosk body #dash-notices,`, + `html.kiosk body #nps-survey-card,`, + `html.kiosk body [data-dashboard-section]:not(#activity-monitor-section) { display: none !important; }`, + `html.kiosk body #activity-monitor-section {`, + } { + if !strings.Contains(html, want) { + t.Errorf("index.html missing kiosk wiring %q", want) + } + } + guard := `if (document.documentElement.classList.contains('kiosk')) return;` + for _, fn := range []string{"async function initWelcomeDialog() {", "async function initNPSSurvey() {"} { + i := strings.Index(html, fn) + if i < 0 { + t.Fatalf("index.html missing %q", fn) + } + if !strings.HasPrefix(strings.TrimLeft(html[i+len(fn):], " \n"), guard) { + t.Errorf("%s must return early in kiosk mode", fn) + } + } +} diff --git a/src/pkg/dashboard/static-src/css/kiosk.css b/src/pkg/dashboard/static-src/css/kiosk.css new file mode 100644 index 0000000000..2b35451cbc --- /dev/null +++ b/src/pkg/dashboard/static-src/css/kiosk.css @@ -0,0 +1,14 @@ + /* ══ Kiosk mode (?kiosk=1) ══ + boot.js sets html.kiosk before first paint. Only the Hive activity + monitor renders, full viewport, with no chrome or dialogs. Selectors + lead with `html.kiosk body` so they out-rank the !important topbar + rules served by /api/theme.css. */ + html.kiosk body #oc-topbar.oc-topbar, + html.kiosk body #oc-sidebar, + html.kiosk body .oc-sidebar-resize, + html.kiosk body #dash-notices, + html.kiosk body #nps-survey-card, + html.kiosk body .config-overlay, + html.kiosk body [data-dashboard-section]:not(#activity-monitor-section) { display: none !important; } + html.kiosk body { padding: var(--sp-5) !important; margin: 0 !important; } + html.kiosk body #activity-monitor-section { margin: 0 !important; width: 100%; min-height: calc(100vh - 2 * var(--sp-5)); } diff --git a/src/pkg/dashboard/static-src/js/boot.js b/src/pkg/dashboard/static-src/js/boot.js index 0d04fae2d4..5fb7665060 100644 --- a/src/pkg/dashboard/static-src/js/boot.js +++ b/src/pkg/dashboard/static-src/js/boot.js @@ -1,3 +1,13 @@ +// Kiosk mode (?kiosk=1): flag before first paint so css/kiosk.css can +// hide the chrome; welcome.js and nps.js check the same class. +(function(){ + try { + if (new URLSearchParams(window.location.search).get('kiosk') === '1') { + document.documentElement.classList.add('kiosk'); + document.body.classList.add('kiosk'); + } + } catch (e) { /* no URLSearchParams — normal dashboard */ } +})(); // Apply layout immediately and hide content until first data render. // NOTE: only body classes are set here — the .layout-toggle buttons do NOT // exist in the DOM yet at this point, so any label write here is a no-op. diff --git a/src/pkg/dashboard/static-src/js/nps.js b/src/pkg/dashboard/static-src/js/nps.js index 4af5691f57..b9c7aca20f 100644 --- a/src/pkg/dashboard/static-src/js/nps.js +++ b/src/pkg/dashboard/static-src/js/nps.js @@ -179,6 +179,7 @@ // initNPSSurvey decides whether this page load may show the prompt and, // if so, waits for enough engaged time. At most once per page load. async function initNPSSurvey() { + if (document.documentElement.classList.contains('kiosk')) return; const t = npsTiming(); const sessionCount = npsBumpSessionCount(); if (sessionCount < t.MIN_SESSIONS_BEFORE_NPS) return; diff --git a/src/pkg/dashboard/static-src/js/welcome.js b/src/pkg/dashboard/static-src/js/welcome.js index cf7a5d1854..1d8f0504a9 100644 --- a/src/pkg/dashboard/static-src/js/welcome.js +++ b/src/pkg/dashboard/static-src/js/welcome.js @@ -30,6 +30,7 @@ let _welcomeWriteAccess = false; async function initWelcomeDialog() { + if (document.documentElement.classList.contains('kiosk')) return; // Write-access gating: read-only previews never see the checklist or // its entry points. On fetch failure (e.g. static snapshot) stay hidden. let role = HIVE_ROLE_READ; diff --git a/src/pkg/dashboard/static-src/manifest.txt b/src/pkg/dashboard/static-src/manifest.txt index 343b88f9e1..bf69df686a 100644 --- a/src/pkg/dashboard/static-src/manifest.txt +++ b/src/pkg/dashboard/static-src/manifest.txt @@ -30,6 +30,7 @@ css/responsive.css css/recipes-utilities.css css/welcome.css css/review-campaigns.css +css/kiosk.css css/variables.css glue/style-close-body-open.html js/boot.js diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index ff89d8c512..0476d405dc 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -6652,6 +6652,20 @@ .review-priority { display: inline-block; padding: var(--sp-1) var(--sp-4); border-radius: var(--r-sm); font-size: var(--fs-2xs); color: var(--muted); border: 1px solid var(--blue); } .review-priority-high { border-color: var(--red); } .review-priority-low { border-color: var(--muted); } + /* ══ Kiosk mode (?kiosk=1) ══ + boot.js sets html.kiosk before first paint. Only the Hive activity + monitor renders, full viewport, with no chrome or dialogs. Selectors + lead with `html.kiosk body` so they out-rank the !important topbar + rules served by /api/theme.css. */ + html.kiosk body #oc-topbar.oc-topbar, + html.kiosk body #oc-sidebar, + html.kiosk body .oc-sidebar-resize, + html.kiosk body #dash-notices, + html.kiosk body #nps-survey-card, + html.kiosk body .config-overlay, + html.kiosk body [data-dashboard-section]:not(#activity-monitor-section) { display: none !important; } + html.kiosk body { padding: var(--sp-5) !important; margin: 0 !important; } + html.kiosk body #activity-monitor-section { margin: 0 !important; width: 100%; min-height: calc(100vh - 2 * var(--sp-5)); } .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)} @@ -6669,6 +6683,16 @@