diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 6ff3f56feb..c9a1236bda 100644 --- a/.github/scripts/integration-governance.cjs +++ b/.github/scripts/integration-governance.cjs @@ -9,7 +9,7 @@ const MAX_COMMITS = 1000; const MAX_AUTHOR_BATCH = 50; // This literal is inside the enrolled .github closure. A caller-supplied // preparedBy.sourceSHA must never choose a new executable verifier tree. -const TRUSTED_SCRIPTS_TREE = '279fb551572a2ce471e3495dd406f1f1a3de109d'; +const TRUSTED_SCRIPTS_TREE = '9204e9706f4019d5be4010ae939812f00133a146'; const SOURCE = 'https://github.com/kubernetes-sigs/kubebuilder-release-tools/tree/012269a88fa4c034a0acf1ba84c26b195c0dbab4'; const sha = value => crypto.createHash('sha256').update(value).digest('hex'); const git = (args, cwd = process.cwd()) => diff --git a/changelog.d/added-activity-monitor-phone-filter-bar.md b/changelog.d/added-activity-monitor-phone-filter-bar.md new file mode 100644 index 0000000000..54dbabd9ff --- /dev/null +++ b/changelog.d/added-activity-monitor-phone-filter-bar.md @@ -0,0 +1 @@ +- The Hive activity monitor on a phone replaces its 13-control toolbar and label chips with a sticky compact filter bar (All / PRs / Issues, Needs attention, Waiting on you, β‹― Filters) that opens the full toolbar in a modal sheet, so the first row is visible without scrolling; desktop is unchanged (#17159, part of #17158). diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index f523c0109b..b0cd8515cf 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -123,6 +123,8 @@ Filters run on the cached browser payload and persist across reloads, except the **+N more** opens *All labels*, with every label and count, type-to-filter, toggles and **Clear**. Selected labels are promoted into the visible row. **Clear filters** appears whenever the view is narrowed. +**On a phone** (the `.modal-sheet` tier: ≀640px wide, or a coarse pointer up to 820px) the toolbar and label chips are not drawn above the list. The sticky bar carries a compact filter row instead β€” *All / PRs / Issues*, *⚠ Needs attention*, *πŸ‘€ Waiting on you* (with its count) and **β‹― Filters** β€” beside the Merged pill, so the first row starts within about 100px of the section header. **β‹― Filters** opens a full-screen sheet holding the complete toolbar (Repo, search, Since, Author, Decisions, Sort, Group, Per page, sound) and the label chips; its badge counts the filters set in the sheet. Filters apply as you change them and stay applied when the sheet closes (**Done**, βœ•, Esc or the backdrop). Desktop layout is unchanged. + Default sort is furthest along first; covered issues rank by their furthest-along PR. Within each column, attention rows precede plain rows, then held/draft rows and PRs standing for closed issues. Within a tier, longest waiting comes first, then repository and number. The same ordering applies to nested PRs and the server payload, so chat `/prs` and the hub agree. `deferred_modifiers` never promote a row. **Sort** also offers longest waiting (tier, then wait), newest and number (no tiers). The arrow reverses column/age/repo/number keys, never attention tiers: β€œAttention-first within each column; arrow flips age order.” Pages offer **25 / 50 / 100** rows (default 50) and **Prev / Next**, with counts above and below. diff --git a/src/pkg/dashboard/static-src/css/responsive.css b/src/pkg/dashboard/static-src/css/responsive.css index 57c78127a8..843619c00f 100644 --- a/src/pkg/dashboard/static-src/css/responsive.css +++ b/src/pkg/dashboard/static-src/css/responsive.css @@ -17,6 +17,30 @@ .hive-dialog.modal-sheet > .hive-dialog-buttons { flex: 0 0 auto; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); } .hive-dialog.modal-sheet > .hive-dialog-buttons .hv-btn { min-height: var(--modal-sheet-close-size); } .hive-dialog.modal-sheet .modal-sheet-close { display: inline-flex; } + /* Activity monitor on a phone (#17159): the 13-control toolbar and + the label chips hide; the sticky bar carries the compact chips + (kind / needs attention / waiting on you / β‹― Filters) beside the + Merged pill, and the meta line keeps only "showing N of M". The + sticky bar grows to tap height, so the column header below it + follows through --ham-sticky-bar-h. Lines naming .ham-sticky must + stay free of literal colours (stage_tracker_actor_icon_test.go). */ + #activity-monitor-section { --ham-sticky-bar-h: calc(var(--tap-target) + 2 * var(--sp-1)); } + #activity-monitor-section .section-body > .ham-toolbar, #activity-monitor-section .section-body > .ham-labels { display: none; } + #activity-monitor-meta > :not(.ham-count) { display: none; } + /* The card body's overflow:hidden makes it the sticky containing + scroller; with only the meta line above the bar, sticky top would + push the bar down over the first row. overflow:clip clips without + creating a scroller, so the bar sticks to the viewport instead. */ + #activity-monitor-section .dash-card-body { overflow: clip; } + .ham-sticky { justify-content: flex-start; gap: var(--sp-2); padding-left: max(var(--sp-2), var(--safe-area-left)); padding-right: max(var(--sp-2), var(--safe-area-right)); } + .ham-sticky .ham-merged-sub { display: none; } + .ham-sticky .ham-merged-count, .ham-sticky .ham-queue-chip { flex: 0 0 auto; min-height: var(--tap-target); } + .ham-compact { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: var(--sp-2); } + .ham-compact-scroll { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; } + .ham-compact-scroll::-webkit-scrollbar { display: none; } + .ham-compact .ham-chips { display: inline-flex; flex: 0 0 auto; } + .ham-compact .ham-chip { flex: 0 0 auto; min-height: var(--tap-target); font-size: var(--fs-sm); white-space: nowrap; } + .ham-compact-more[data-ham-active] { background: var(--panel-strong); color: var(--text); border-color: var(--line-strong); } } @media (max-width: 768px) { body { diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index b2c5427b55..728f9fdb90 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -52,6 +52,23 @@ .ham-sound-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; } .ham-sound-help { font-size: var(--fs-xs); margin: var(--sp-0); } .ham-sound-volume-value { color: var(--text); font-variant-numeric: tabular-nums; } + /* Phone compact filter bar + Filters sheet (#17159). .ham-compact lives + on the sticky bar and is shown only in responsive.css's phone tier; + the sheet receives the toolbar and label chips as-is (same ids and + hamFilter actions), one control per line at tap height. Desktop + never shows either. */ + .ham-compact { display: none; } + .ham-filter-sheet-body { white-space: normal; } + .ham-filter-sheet .ham-toolbar { flex-direction: column; align-items: stretch; gap: var(--sp-3); margin: 0; } + .ham-filter-sheet .ham-toolbar .ham-chips { display: flex; } + .ham-filter-sheet .ham-toolbar .ham-chips .ham-chip { flex: 1 1 0; } + .ham-filter-sheet .ham-chip { min-height: var(--tap-target); font-size: var(--fs-sm); } + .ham-filter-sheet .ham-repo-filter { display: flex; justify-content: space-between; gap: var(--sp-3); min-height: var(--tap-target); white-space: nowrap; } + .ham-filter-sheet .ham-select { flex: 1 1 auto; max-width: none; min-height: var(--tap-target); font-size: var(--fs-touch); } + .ham-filter-sheet .ham-input { flex: none; width: 100%; box-sizing: border-box; min-height: var(--tap-target); font-size: var(--fs-touch); } + .ham-filter-sheet .ham-dir { min-width: var(--tap-target); } + .ham-filter-sheet .ham-sound { margin-left: 0; } + .ham-filter-sheet .ham-labels { margin: var(--sp-3) 0 0; gap: var(--sp-2); } .ham-labels { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-bottom: var(--sp-3); } .ham-labels:empty { display: none; } .ham-label-chip { font-family: var(--font-mono); } diff --git a/src/pkg/dashboard/static-src/html/tracker.html b/src/pkg/dashboard/static-src/html/tracker.html index 2e8a126309..545f19411d 100644 --- a/src/pkg/dashboard/static-src/html/tracker.html +++ b/src/pkg/dashboard/static-src/html/tracker.html @@ -37,6 +37,22 @@

Hive activity moni
+ + diff --git a/src/pkg/dashboard/static-src/js/tracker-filter-state.js b/src/pkg/dashboard/static-src/js/tracker-filter-state.js index bb5526ef96..71f5622b39 100644 --- a/src/pkg/dashboard/static-src/js/tracker-filter-state.js +++ b/src/pkg/dashboard/static-src/js/tracker-filter-state.js @@ -241,6 +241,59 @@ if (dir) { dir.textContent = f.dir === 'asc' ? '↑' : '↓'; dir.setAttribute('title', (f.dir === 'asc' ? 'Ascending β€” click for descending' : 'Descending β€” click for ascending') + STAGE_TRACKER_DIR_TIER_NOTE); } const reset = document.getElementById('activity-monitor-reset'); if (reset) reset.hidden = !stageTrackerFilterActive(f); + stageTrackerSyncCompact(f); + } + // The phone compact bar (#17159) mirrors the kind / attention / + // waiting chips and counts the filters the sheet holds on β‹― Filters. + function stageTrackerSyncCompact(f) { + const bar = document.getElementById('activity-monitor-compact'); + if (!bar) return; + bar.querySelectorAll('.ham-chip[data-arg0="kind"]').forEach(b => b.setAttribute('aria-pressed', b.dataset.arg1 === f.kind ? 'true' : 'false')); + const att = document.getElementById('activity-monitor-compact-attention'); + if (att) att.setAttribute('aria-pressed', f.attention ? 'true' : 'false'); + const wait = document.getElementById('activity-monitor-compact-waiting'); + if (wait) wait.setAttribute('aria-pressed', f.waitingOnYou ? 'true' : 'false'); + const more = document.getElementById('activity-monitor-filters'); + const n = more && more.querySelector('.ham-chip-n'); + if (n) { const count = stageTrackerSheetFilterCount(f); n.textContent = String(count); n.hidden = !count; more.toggleAttribute('data-ham-active', count > 0); } + } + // β‹― Filters: the toolbar and the label chips move, as they are, into a + // .hive-dialog.modal-sheet (same ids, same hamFilter actions, so every + // render keeps syncing them) and move back home when the sheet closes + // (Esc / βœ• / backdrop / Done via hiveWireDialog). + var _stageTrackerFilterSheetReturnFocus = null; + function openStageTrackerFilterSheet() { + if (document.getElementById('activity-monitor-filters-overlay')) return; + const toolbar = document.getElementById('activity-monitor-toolbar'); + const labels = document.getElementById('activity-monitor-labels'); + if (!toolbar) return; + _stageTrackerFilterSheetReturnFocus = document.activeElement; + const overlay = document.createElement('div'); + overlay.id = 'activity-monitor-filters-overlay'; + overlay.className = 'hive-dialog-overlay'; + hiveRememberModalOpen(overlay); + overlay.innerHTML = ``; + const body = overlay.querySelector('.ham-filter-sheet-body'); + const homes = [toolbar, labels].filter(Boolean).map(node => { + const home = document.createComment('ham-filter-sheet-home'); + node.parentNode.insertBefore(home, node); + body.appendChild(node); + return { node, home }; + }); + document.body.appendChild(overlay); + const more = document.getElementById('activity-monitor-filters'); + if (more) more.setAttribute('aria-expanded', 'true'); + hiveWireDialog(overlay, () => { + homes.forEach(({ node, home }) => { if (home.parentNode) { home.parentNode.insertBefore(node, home); home.remove(); } }); + if (more) more.setAttribute('aria-expanded', 'false'); + const ret = _stageTrackerFilterSheetReturnFocus; + _stageTrackerFilterSheetReturnFocus = null; + if (ret && ret.focus && document.contains(ret)) setTimeout(() => ret.focus({ preventScroll: true }), 0); + }, undefined, '.primary', null, close => close()); } function stageTrackerLabelChipHtml(c) { diff --git a/src/pkg/dashboard/static-src/js/tracker-filter.js b/src/pkg/dashboard/static-src/js/tracker-filter.js index a896055370..93e90dcced 100644 --- a/src/pkg/dashboard/static-src/js/tracker-filter.js +++ b/src/pkg/dashboard/static-src/js/tracker-filter.js @@ -164,6 +164,14 @@ return f.kind !== 'all' || !!f.repo || !!f.q || f.labels.length > 0 || f.needsHuman || f.onHold || f.waitingOnYou || f.age !== 'any' || f.author !== 'any' || f.attention || f.acted !== 'any'; } + // How many narrowing filters the phone Filters sheet holds are set: + // everything stageTrackerFilterActive counts except the kind / + // attention / waiting-on-you chips, which sit on the compact bar. + function stageTrackerSheetFilterCount(f) { + f = stageTrackerNormalizeFilter(f); + return (f.repo ? 1 : 0) + (f.q ? 1 : 0) + (f.age !== 'any' ? 1 : 0) + (f.author !== 'any' ? 1 : 0) + (f.acted !== 'any' ? 1 : 0) + f.labels.length + (f.needsHuman ? 1 : 0) + (f.onHold ? 1 : 0); + } + // Does one item pass the narrowing filters? ctx.nowMs anchors the age // test; ctx.stages supplies the dwell for the "stale" age. function stageTrackerMatches(item, f, ctx) { diff --git a/src/pkg/dashboard/static-src/js/tracker-waiting.js b/src/pkg/dashboard/static-src/js/tracker-waiting.js index 69352c6709..8a385f83a7 100644 --- a/src/pkg/dashboard/static-src/js/tracker-waiting.js +++ b/src/pkg/dashboard/static-src/js/tracker-waiting.js @@ -77,6 +77,9 @@ } const chip = document.getElementById('activity-monitor-waiting'); if (chip) chip.textContent = w.count ? 'Waiting on you (' + w.count + ')' : 'Waiting on you'; + const compact = document.getElementById('activity-monitor-compact-waiting'); + const compactN = compact && compact.querySelector('.ham-chip-n'); + if (compactN) { compactN.textContent = String(w.count); compactN.hidden = !w.count; } stageTrackerWaitingToast(w, nowMs); } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 0605ab4634..15d86d6c04 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1392,6 +1392,23 @@ .ham-sound-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; } .ham-sound-help { font-size: var(--fs-xs); margin: var(--sp-0); } .ham-sound-volume-value { color: var(--text); font-variant-numeric: tabular-nums; } + /* Phone compact filter bar + Filters sheet (#17159). .ham-compact lives + on the sticky bar and is shown only in responsive.css's phone tier; + the sheet receives the toolbar and label chips as-is (same ids and + hamFilter actions), one control per line at tap height. Desktop + never shows either. */ + .ham-compact { display: none; } + .ham-filter-sheet-body { white-space: normal; } + .ham-filter-sheet .ham-toolbar { flex-direction: column; align-items: stretch; gap: var(--sp-3); margin: 0; } + .ham-filter-sheet .ham-toolbar .ham-chips { display: flex; } + .ham-filter-sheet .ham-toolbar .ham-chips .ham-chip { flex: 1 1 0; } + .ham-filter-sheet .ham-chip { min-height: var(--tap-target); font-size: var(--fs-sm); } + .ham-filter-sheet .ham-repo-filter { display: flex; justify-content: space-between; gap: var(--sp-3); min-height: var(--tap-target); white-space: nowrap; } + .ham-filter-sheet .ham-select { flex: 1 1 auto; max-width: none; min-height: var(--tap-target); font-size: var(--fs-touch); } + .ham-filter-sheet .ham-input { flex: none; width: 100%; box-sizing: border-box; min-height: var(--tap-target); font-size: var(--fs-touch); } + .ham-filter-sheet .ham-dir { min-width: var(--tap-target); } + .ham-filter-sheet .ham-sound { margin-left: 0; } + .ham-filter-sheet .ham-labels { margin: var(--sp-3) 0 0; gap: var(--sp-2); } .ham-labels { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-bottom: var(--sp-3); } .ham-labels:empty { display: none; } .ham-label-chip { font-family: var(--font-mono); } @@ -5835,6 +5852,30 @@ .hive-dialog.modal-sheet > .hive-dialog-buttons { flex: 0 0 auto; margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); } .hive-dialog.modal-sheet > .hive-dialog-buttons .hv-btn { min-height: var(--modal-sheet-close-size); } .hive-dialog.modal-sheet .modal-sheet-close { display: inline-flex; } + /* Activity monitor on a phone (#17159): the 13-control toolbar and + the label chips hide; the sticky bar carries the compact chips + (kind / needs attention / waiting on you / β‹― Filters) beside the + Merged pill, and the meta line keeps only "showing N of M". The + sticky bar grows to tap height, so the column header below it + follows through --ham-sticky-bar-h. Lines naming .ham-sticky must + stay free of literal colours (stage_tracker_actor_icon_test.go). */ + #activity-monitor-section { --ham-sticky-bar-h: calc(var(--tap-target) + 2 * var(--sp-1)); } + #activity-monitor-section .section-body > .ham-toolbar, #activity-monitor-section .section-body > .ham-labels { display: none; } + #activity-monitor-meta > :not(.ham-count) { display: none; } + /* The card body's overflow:hidden makes it the sticky containing + scroller; with only the meta line above the bar, sticky top would + push the bar down over the first row. overflow:clip clips without + creating a scroller, so the bar sticks to the viewport instead. */ + #activity-monitor-section .dash-card-body { overflow: clip; } + .ham-sticky { justify-content: flex-start; gap: var(--sp-2); padding-left: max(var(--sp-2), var(--safe-area-left)); padding-right: max(var(--sp-2), var(--safe-area-right)); } + .ham-sticky .ham-merged-sub { display: none; } + .ham-sticky .ham-merged-count, .ham-sticky .ham-queue-chip { flex: 0 0 auto; min-height: var(--tap-target); } + .ham-compact { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: var(--sp-2); } + .ham-compact-scroll { display: flex; flex: 1 1 auto; min-width: 0; align-items: center; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; } + .ham-compact-scroll::-webkit-scrollbar { display: none; } + .ham-compact .ham-chips { display: inline-flex; flex: 0 0 auto; } + .ham-compact .ham-chip { flex: 0 0 auto; min-height: var(--tap-target); font-size: var(--fs-sm); white-space: nowrap; } + .ham-compact-more[data-ham-active] { background: var(--panel-strong); color: var(--text); border-color: var(--line-strong); } } @media (max-width: 768px) { body { @@ -8453,6 +8494,22 @@

Hive activity moni
+ + @@ -20957,6 +21014,14 @@

Where to get help

return f.kind !== 'all' || !!f.repo || !!f.q || f.labels.length > 0 || f.needsHuman || f.onHold || f.waitingOnYou || f.age !== 'any' || f.author !== 'any' || f.attention || f.acted !== 'any'; } + // How many narrowing filters the phone Filters sheet holds are set: + // everything stageTrackerFilterActive counts except the kind / + // attention / waiting-on-you chips, which sit on the compact bar. + function stageTrackerSheetFilterCount(f) { + f = stageTrackerNormalizeFilter(f); + return (f.repo ? 1 : 0) + (f.q ? 1 : 0) + (f.age !== 'any' ? 1 : 0) + (f.author !== 'any' ? 1 : 0) + (f.acted !== 'any' ? 1 : 0) + f.labels.length + (f.needsHuman ? 1 : 0) + (f.onHold ? 1 : 0); + } + // Does one item pass the narrowing filters? ctx.nowMs anchors the age // test; ctx.stages supplies the dwell for the "stale" age. function stageTrackerMatches(item, f, ctx) { @@ -21441,6 +21506,59 @@

Where to get help

if (dir) { dir.textContent = f.dir === 'asc' ? '↑' : '↓'; dir.setAttribute('title', (f.dir === 'asc' ? 'Ascending β€” click for descending' : 'Descending β€” click for ascending') + STAGE_TRACKER_DIR_TIER_NOTE); } const reset = document.getElementById('activity-monitor-reset'); if (reset) reset.hidden = !stageTrackerFilterActive(f); + stageTrackerSyncCompact(f); + } + // The phone compact bar (#17159) mirrors the kind / attention / + // waiting chips and counts the filters the sheet holds on β‹― Filters. + function stageTrackerSyncCompact(f) { + const bar = document.getElementById('activity-monitor-compact'); + if (!bar) return; + bar.querySelectorAll('.ham-chip[data-arg0="kind"]').forEach(b => b.setAttribute('aria-pressed', b.dataset.arg1 === f.kind ? 'true' : 'false')); + const att = document.getElementById('activity-monitor-compact-attention'); + if (att) att.setAttribute('aria-pressed', f.attention ? 'true' : 'false'); + const wait = document.getElementById('activity-monitor-compact-waiting'); + if (wait) wait.setAttribute('aria-pressed', f.waitingOnYou ? 'true' : 'false'); + const more = document.getElementById('activity-monitor-filters'); + const n = more && more.querySelector('.ham-chip-n'); + if (n) { const count = stageTrackerSheetFilterCount(f); n.textContent = String(count); n.hidden = !count; more.toggleAttribute('data-ham-active', count > 0); } + } + // β‹― Filters: the toolbar and the label chips move, as they are, into a + // .hive-dialog.modal-sheet (same ids, same hamFilter actions, so every + // render keeps syncing them) and move back home when the sheet closes + // (Esc / βœ• / backdrop / Done via hiveWireDialog). + var _stageTrackerFilterSheetReturnFocus = null; + function openStageTrackerFilterSheet() { + if (document.getElementById('activity-monitor-filters-overlay')) return; + const toolbar = document.getElementById('activity-monitor-toolbar'); + const labels = document.getElementById('activity-monitor-labels'); + if (!toolbar) return; + _stageTrackerFilterSheetReturnFocus = document.activeElement; + const overlay = document.createElement('div'); + overlay.id = 'activity-monitor-filters-overlay'; + overlay.className = 'hive-dialog-overlay'; + hiveRememberModalOpen(overlay); + overlay.innerHTML = ``; + const body = overlay.querySelector('.ham-filter-sheet-body'); + const homes = [toolbar, labels].filter(Boolean).map(node => { + const home = document.createComment('ham-filter-sheet-home'); + node.parentNode.insertBefore(home, node); + body.appendChild(node); + return { node, home }; + }); + document.body.appendChild(overlay); + const more = document.getElementById('activity-monitor-filters'); + if (more) more.setAttribute('aria-expanded', 'true'); + hiveWireDialog(overlay, () => { + homes.forEach(({ node, home }) => { if (home.parentNode) { home.parentNode.insertBefore(node, home); home.remove(); } }); + if (more) more.setAttribute('aria-expanded', 'false'); + const ret = _stageTrackerFilterSheetReturnFocus; + _stageTrackerFilterSheetReturnFocus = null; + if (ret && ret.focus && document.contains(ret)) setTimeout(() => ret.focus({ preventScroll: true }), 0); + }, undefined, '.primary', null, close => close()); } function stageTrackerLabelChipHtml(c) { @@ -27444,6 +27562,9 @@

All labels

} const chip = document.getElementById('activity-monitor-waiting'); if (chip) chip.textContent = w.count ? 'Waiting on you (' + w.count + ')' : 'Waiting on you'; + const compact = document.getElementById('activity-monitor-compact-waiting'); + const compactN = compact && compact.querySelector('.ham-chip-n'); + if (compactN) { compactN.textContent = String(w.count); compactN.hidden = !w.count; } stageTrackerWaitingToast(w, nowMs); } diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-chrome.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-chrome.js new file mode 100644 index 0000000000..210701156d --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-chrome.js @@ -0,0 +1,100 @@ +// Dedicated preview only: evaluate ()({ dedicatedPreview: true }). +// Phone-only acceptance for the Activity monitor chrome (#17158): on a +// portrait phone the compact filter bar replaces the toolbar, the chrome +// between the section header and the first row stays short enough that a +// row is visible without scrolling, and the β‹― Filters sheet carries the +// full toolbar and returns it on close. Desktop and landscape return a +// skip marker; they are covered elsewhere. Restores scroll positions. +(async ({ dedicatedPreview = false } = {}) => { + if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); + const phoneMaxWidth = 640; + const maxChromePx = 160; + const failures = []; + const assert = (ok, label) => { if (!ok) failures.push(label); }; + const rect = el => el.getBoundingClientRect(); + const visible = el => !!(el && el.getClientRects().length && getComputedStyle(el).display !== 'none'); + const frames = async (n) => { for (let i = 0; i < n; i++) await new Promise(requestAnimationFrame); }; + if (innerWidth > phoneMaxWidth) return { skipped: 'not a phone-width viewport', viewport: innerWidth }; + if (innerWidth > innerHeight) return { skipped: 'landscape phone is covered by its own tier probe', viewport: innerWidth }; + + const section = document.getElementById('activity-monitor-section'); + const header = section && section.querySelector('.dash-card-header'); + const panel = document.getElementById('activity-monitor-panel'); + if (!section || !header || !panel) throw new Error(JSON.stringify({ failures: ['Activity monitor section, header or panel is missing'] })); + const navbar = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--navbar-sticky-height')) || 0; + const savedScroll = { x: scrollX, y: scrollY }; + const measurements = {}; + try { + header.scrollIntoView({ block: 'start', behavior: 'instant' }); + await frames(3); + const compact = document.getElementById('activity-monitor-compact'); + const toolbar = document.getElementById('activity-monitor-toolbar'); + const labels = document.getElementById('activity-monitor-labels'); + const more = document.getElementById('activity-monitor-filters'); + assert(visible(compact), 'compact filter bar is shown on a portrait phone'); + assert(toolbar && !visible(toolbar), 'full toolbar is hidden behind the Filters sheet on a portrait phone'); + assert(labels && !visible(labels), 'label chips are hidden behind the Filters sheet on a portrait phone'); + assert(visible(more), 'β‹― Filters button is shown on a portrait phone'); + const chips = compact ? [...compact.querySelectorAll('.ham-chip')] : []; + assert(chips.length >= 5, 'compact bar carries kind, needs-attention and waiting-on-you chips'); + for (const chip of chips) { + const box = rect(chip); + assert(box.height >= 40 - 1, 'compact chip reaches tap height: ' + chip.textContent.trim()); + } + const rows = [...panel.querySelectorAll('.ham-row')]; + assert(rows.length > 0, 'fixture rendered at least one row'); + if (rows.length) { + const first = rows[0]; + // The acceptance fixture prefixes its rows with a provenance note that + // real renders do not have; measure the chrome without it. + const note = panel.querySelector('#activity-density-layout-fixture > p'); + const noteStyle = note && getComputedStyle(note); + measurements.fixtureNote = note ? Math.round(rect(note).height + parseFloat(noteStyle.marginTop) + parseFloat(noteStyle.marginBottom)) : 0; + measurements.chrome = Math.round(rect(first).top - rect(header).bottom - measurements.fixtureNote); + assert(measurements.chrome <= maxChromePx, 'chrome between the section header and the first row is ' + measurements.chrome + 'px (max ' + maxChromePx + ')'); + measurements.rowsFullyVisible = rows.filter(row => { const box = rect(row); return box.top >= navbar - 1 && box.bottom <= innerHeight + 1; }).length; + assert(measurements.rowsFullyVisible >= 1, 'at least one row is fully visible with the section header at the top of the viewport'); + } + const sticky = document.getElementById('activity-monitor-sticky'); + if (sticky) { + measurements.stickyHeight = Math.round(rect(sticky).height); + const cols = panel.querySelector('.ham-cols'); + measurements.colsHeight = cols ? Math.round(rect(cols).height) : 0; + assert(measurements.stickyHeight + measurements.colsHeight <= 100, 'sticky bar plus column header stays within 100px'); + } + + assert(typeof openStageTrackerFilterSheet === 'function', 'openStageTrackerFilterSheet is wired'); + if (typeof openStageTrackerFilterSheet === 'function' && toolbar) { + openStageTrackerFilterSheet(); + await frames(2); + const overlay = document.getElementById('activity-monitor-filters-overlay'); + const sheet = overlay && overlay.querySelector('.hive-dialog.modal-sheet.ham-filter-sheet'); + assert(!!sheet, 'Filters opens a .hive-dialog.modal-sheet'); + if (sheet) { + assert(sheet.contains(toolbar) && sheet.contains(labels), 'sheet carries the toolbar and label chips'); + assert(more.getAttribute('aria-expanded') === 'true', 'β‹― Filters reports aria-expanded while the sheet is open'); + const controls = [...sheet.querySelectorAll('select, input, button, .ham-chip')].filter(visible); + measurements.sheetControls = controls.length; + for (const control of controls) { + const box = rect(control); + assert(box.right <= innerWidth + 1 && box.left >= -1, 'sheet control stays inside the viewport: ' + (control.id || control.className)); + } + const inputs = controls.filter(el => el.matches('select, input')); + for (const input of inputs) { + assert(parseFloat(getComputedStyle(input).fontSize) >= 16, 'sheet input uses a 16px font so iOS does not zoom: ' + (input.id || input.className)); + } + if (typeof overlay.hiveDialogClose === 'function') overlay.hiveDialogClose(); else overlay.remove(); + await frames(2); + assert(!document.getElementById('activity-monitor-filters-overlay'), 'sheet closes'); + assert(section.contains(toolbar) && !toolbar.closest('.hive-dialog'), 'toolbar returns to the section when the sheet closes'); + assert(section.contains(labels) && !labels.closest('.hive-dialog'), 'label chips return to the section when the sheet closes'); + assert(more.getAttribute('aria-expanded') === 'false', 'β‹― Filters clears aria-expanded when the sheet closes'); + } + } + } finally { + scrollTo({ left: savedScroll.x, top: savedScroll.y, behavior: 'instant' }); + await frames(1); + } + if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, measurements, failures })); + return { viewport: innerWidth, measurements, failures }; +}) diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index 635a342f1e..993549b3e0 100644 --- a/src/scripts/dashboard-mobile-shots.mjs +++ b/src/scripts/dashboard-mobile-shots.mjs @@ -267,7 +267,7 @@ async function main() { const activityFailures = []; const fixtureRoot = path.join(process.cwd(), 'src/pkg/dashboard/webstatic/testdata'); const density = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'tracker-activity-density.json'), 'utf8')); - const probes = ['tracker-header-geometry', 'tracker-decision-interaction'].map(name => ({ + const probes = ['tracker-header-geometry', 'tracker-decision-interaction', 'tracker-phone-chrome'].map(name => ({ name, source: fs.readFileSync(path.join(fixtureRoot, name + '.js'), 'utf8'), })); const event = process.env.GITHUB_EVENT_PATH ? JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')) : {};