Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-dashboard-kiosk-mode.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions src/docs/dashboard-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
38 changes: 38 additions & 0 deletions src/pkg/dashboard/kiosk_mode_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package dashboard

import (
"strings"
"testing"
)

// TestKioskModeWiring pins the ?kiosk=1 unattended display mode: boot flags
// <html>, 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)
}
}
}
14 changes: 14 additions & 0 deletions src/pkg/dashboard/static-src/css/kiosk.css
Original file line number Diff line number Diff line change
@@ -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)); }
10 changes: 10 additions & 0 deletions src/pkg/dashboard/static-src/js/boot.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Kiosk mode (?kiosk=1): flag <html> 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.
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/js/nps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/js/welcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions src/pkg/dashboard/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand All @@ -6669,6 +6683,16 @@
</head>
<body>
<script>
// Kiosk mode (?kiosk=1): flag <html> 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.
Expand Down Expand Up @@ -61547,6 +61571,7 @@ <h3 class="features-section-title">${esc(s.title)}</h3>
// 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;
Expand Down Expand Up @@ -61735,6 +61760,7 @@ <h3 class="features-section-title">${esc(s.title)}</h3>
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;
Expand Down
Loading