From 0d9af74356f45c9671c3e0f29a005a924df735ae Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 7 Nov 2026 19:30:01 -0700 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20dashboard:=20progress=20pill=20?= =?UTF-8?q?replaces=20the=20chevron=20strip=20on=20phones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On phones (≤640px, or coarse pointer ≤820px) every Activity monitor row renders a single stage-coloured "Step 7/8 · Merge queue · 2h" pill in place of the eight-chevron strip, which did not fit a 390px row and left the lit chevron hundreds of pixels off-screen. Tapping the pill opens the full strip, since age, caption and hover text in a .hive-dialog.modal-sheet. The sticky column header is hidden with the strip. Row moves flash the pill once instead of drawing the overlay against a hidden strip. Outside the phone tier the pill has no box: the desktop strip and the .ham-anim-layer geometry at 1280 are unchanged. Mobile shots gate: tracker-header-geometry grows a phone branch (pill inside the row, ≥ tap target, ≥ 12px, no sideways scroll, needs-human distinct), a tracker-phone-pill probe taps the pill and plays a move, and 390x844 must exercise the pill. Strip-only probes are skipped on phones. Fixes hivecommons/hive#17160 Part of hivecommons/hive#17158 Signed-off-by: Andrew Anderson --- .../added-activity-phone-progress-pill.md | 1 + .../dashboard-sections/activity-monitor.md | 2 + .../dashboard/stage_tracker_activity.test.js | 35 ++++- src/pkg/dashboard/static-src/css/tracker.css | 39 +++++- .../dashboard/static-src/js/tracker-motion.js | 13 ++ .../static-src/js/tracker-row-layout.js | 2 +- .../static-src/js/tracker-row-render.js | 2 +- .../static-src/js/tracker-row-strip.js | 65 +++++++++ src/pkg/dashboard/static/index.html | 123 +++++++++++++++++- .../testdata/tracker-header-geometry.js | 41 ++++++ .../webstatic/testdata/tracker-phone-pill.js | 70 ++++++++++ src/scripts/dashboard-mobile-shots.mjs | 25 +++- 12 files changed, 400 insertions(+), 18 deletions(-) create mode 100644 changelog.d/added-activity-phone-progress-pill.md create mode 100644 src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js diff --git a/changelog.d/added-activity-phone-progress-pill.md b/changelog.d/added-activity-phone-progress-pill.md new file mode 100644 index 0000000000..6ea0a1fe94 --- /dev/null +++ b/changelog.d/added-activity-phone-progress-pill.md @@ -0,0 +1 @@ +- Dashboard: on phones the Activity monitor row shows a stage-coloured "Step 7/8 · Merge queue · 2h" progress pill in place of the chevron strip; tapping it opens the full strip in a sheet, and the sticky column header is hidden with the strip (hivecommons/hive#17160). diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index 79dd05318f..a08b634aa8 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -157,6 +157,8 @@ The reason, actor, nudges, repository, flags and recent stage hops live on the ` Reduced-motion preferences disable animation; needs-human remains steadily red. Icons do not rotate. Movement animation and the newer working cues have their own settings/reference below. +**On a phone** (≤640px, or a touch screen up to 820px) the eight chevrons do not fit a row, so each row shows a single **progress pill** in their place — `Step 7/8 · Merge queue · 2h`: the lit chevron's position counted as drawn (CI and Review are two steps; a nested PR row counts only its own PR columns), its word and the time on step. The pill takes the strip's colour: amber for a steady or working stage, green once merged, the amber→red needs-human tint when a person must move. The sticky column header is hidden with the strip. Tapping the pill opens the full chevron strip, the `since` age, the current-stage caption and the lit chevron's hover text in a full-screen sheet (✕, Esc or *Close*); the strip scrolls sideways inside the sheet if it has to. When a row moves between refreshes the pill flashes once instead of the chevron-to-chevron movement animation. At 1280 and in phone landscape wider than 820px the strip is drawn exactly as before ([#17160](https://github.com/hivecommons/hive/issues/17160)). + ### Payload freshness and stage-engine reference The view is fed by `GET /api/stage-tracker`. Without a stage or journal entry an item is in the Open column; a not-yet-placed item can read **New** as described [below](#new-row-000-new-the-pre-stage-state). Scanner buckets can place unlabeled claimed→020, in-progress→030 and covered→040 work. diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index 3aa547d240..a860894f98 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -650,8 +650,39 @@ test('known and original chevrons keep full long text inside a shared one-line c assert.doesNotMatch(css, /\.ham-(?:seg-t|detour)\.ham-has-holder[^}]*white-space: nowrap/); assert.match(css, /padding: var\(--sp-1\) calc\(var\(--ham-notch\) \+ var\(--sp-2\)\)/); assert.match(css, /\.config-tooltip\.ham-chevron-tip \{[^}]*pointer-events: auto/); - assert.match(css, /#activity-monitor-panel \{ --ham-compact-min-width: 60em; \}/); - assert.match(css, /\.ham-row > \.ham-strip-row, \.ham-sub > \.ham-strip-row, \.ham-cols > \.ham-strip-row \{ overflow-x: auto; \}/); + // Phone tier (hivecommons/hive#17160): the strip no longer scrolls + // sideways; it is hidden behind the progress pill, which opens it in a + // sheet. Outside the tier the pill has no box, so 1280 is untouched. + assert.doesNotMatch(css, /--ham-compact-min-width/); + assert.match(css, /^\s*\.ham-pill \{ display: none; \}/m); + assert.match(css, /@media \(max-width: 640px\), \(\(pointer: coarse\) and \(max-width: 820px\)\) \{\s*\.ham-cols \{ display: none; \}\s*\.ham-row > \.ham-strip-row > \.ham-strip, \.ham-sub > \.ham-strip-row > \.ham-strip,/); + assert.match(css, /\.ham-pill \{ display: inline-flex;[^}]*min-height: var\(--tap-target\);[^}]*font-size: var\(--fs-sm\);/); + assert.match(css, /\.ham-pill\[data-motion="needs-human"\] \{ background: color-mix\(in srgb, var\(--amber\) 45%, var\(--red\)\);/); +}); + +test('phone progress pill names the step, stage and age and opens the strip sheet (#17160)', () => { + const layout = fs.readFileSync(path.join(root, 'tracker-row-layout.js'), 'utf8'); + const pillHtml = new Function('esc', 'stageTrackerSegments', 'stageTrackerShortAgo', globals + ` +const STAGE_TRACKER_MOTION_STATIC = 'static', STAGE_TRACKER_MOTION_HUMAN = 'needs-human'; +function stageTrackerMotion(item) { return (item.modifiers || []).includes('needs-human') ? STAGE_TRACKER_MOTION_HUMAN : STAGE_TRACKER_MOTION_STATIC; } +function stageTrackerItemKey(it) { return it.repo + '/' + it.kind + '#' + it.number; } +function stageTrackerOpenSince() { return { ms: 0 }; } +` + fn(strip, 'stageTrackerWaitingOnPerson') + fn(strip, 'stageTrackerTrackRunning') + fn(layout, 'stageTrackerSinceHtml') + fn(strip, 'stageTrackerPillHtml') + ';return stageTrackerPillHtml;')(esc, segments, ms => Math.round(ms / 3600000) + 'h'); + const pillStages = [{ number: 80, short: 'Merge queue' }, { number: 30, short: 'PR in progress' }, { number: 85, short: 'Needs human decision', branch_from: 80 }].concat(stages.filter(st => st.number !== 85)); + const since = new Date(now - 2 * 3600 * 1000).toISOString(); + const pill = pillHtml(livePR({ repo: 'org/repo', number: 7, stage: 85, display_column: 80, stage_since: since, modifiers: ['needs-human'] }), pillStages, null, now, {}); + assert.match(pill, /^`; + } + + // Tap on the phone pill: the row's full chevron strip, its "since" age + // and the current-stage caption in a bottom sheet (.hive-dialog + // .modal-sheet, decorated by hiveWireDialog). The strip is cloned from + // the row so the sheet shows exactly what the desktop row shows, + // scrolling sideways when eight chevrons outgrow the sheet. + function stageTrackerPillSheet(key) { + const panel = document.getElementById('activity-monitor-panel'); + const row = panel && [...panel.querySelectorAll('.ham-row, .ham-sub')].find(r => (r.dataset.hamKey || r.dataset.hamSubKey || '') === String(key) || !!r.querySelector(`:scope > .ham-strip-row > .ham-pill[data-arg0="${CSS.escape(String(key))}"]`)); + if (!row) return; + const stripRow = row.querySelector(':scope > .ham-strip-row'); + const pill = stripRow && stripRow.querySelector(':scope > .ham-pill'); + const caption = row.querySelector(':scope > .ham-current-stage'); + const head = row.querySelector(':scope > .ham-row-head .ham-ref, :scope > .ham-row-head .ham-pr-ref .ham-pr-num'); + const active = stripRow && stripRow.querySelector('.ham-seg.active'); + const title = (head ? head.textContent.trim() + ' · ' : '') + (pill ? pill.querySelector('.ham-pill-label').textContent : 'Pipeline progress'); + const overlay = document.createElement('div'); + overlay.className = 'hive-dialog-overlay'; + overlay.innerHTML = ``; + const slot = overlay.querySelector('.ham-pill-sheet-strip'); + if (stripRow) { + const copy = stripRow.cloneNode(true); + copy.querySelectorAll('.ham-pill, .ham-anim-layer').forEach(n => n.remove()); + copy.querySelectorAll('[data-ham-prev-col]').forEach(n => n.removeAttribute('data-ham-prev-col')); + copy.querySelectorAll('[tabindex]').forEach(n => n.removeAttribute('tabindex')); + slot.appendChild(copy); + } + document.body.appendChild(overlay); + if (typeof hiveRememberModalOpen === 'function') hiveRememberModalOpen(overlay); + const done = () => { if (overlay.parentNode) overlay.remove(); if (pill && typeof pill.focus === 'function') pill.focus(); }; + if (typeof hiveWireDialog === 'function') hiveWireDialog(overlay, done, undefined, '.primary', null, close => close()); + else overlay.querySelector('.primary').addEventListener('click', done); + } + // "040 Covered by PR" — the stage code plus the strip word the payload // names for it (the code alone when the stage table is not loaded yet). function stageTrackerStageWord(n) { diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 3d5bea1c5c..532082f390 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2263,11 +2263,42 @@ .ham-cols .ham-seg { padding: 0 var(--sp-2) 0 var(--sp-3); } .ham-cols .ham-seg.cap { flex-basis: 2em; } } - @media (max-width: 640px) { - #activity-monitor-panel { --ham-compact-min-width: 60em; } - .ham-row > .ham-strip-row, .ham-sub > .ham-strip-row, .ham-cols > .ham-strip-row { overflow-x: auto; } - .ham-row > .ham-strip-row > .ham-strip, .ham-sub > .ham-strip-row > .ham-strip, .ham-cols > .ham-strip-row > .ham-strip { min-width: var(--ham-compact-min-width); } - } + /* Phone progress pill (hivecommons/hive#17160). Outside the phone tier + the pill does not exist for layout: the strip, its anim layer and the + sticky column header are exactly what they are at 1280. Inside it the + chevron strip, the since-age and .ham-cols are hidden and the pill + ("Step 7/9 · Merge queue · 2h", stage-coloured, ≥ --tap-target tall) + stands in; tapping it opens the full strip in a modal sheet. */ + .ham-pill { display: none; } + @media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) { + .ham-cols { display: none; } + .ham-row > .ham-strip-row > .ham-strip, .ham-sub > .ham-strip-row > .ham-strip, + .ham-row > .ham-strip-row > .ham-since, .ham-sub > .ham-strip-row > .ham-since, + .ham-row > .ham-strip-row > .ham-anim-layer, .ham-sub > .ham-strip-row > .ham-anim-layer { display: none; } + .ham-row > .ham-strip-row, .ham-sub > .ham-strip-row { overflow: hidden; min-width: 0; } + .ham-pill { display: inline-flex; align-items: center; gap: var(--sp-2); max-width: 100%; min-height: var(--tap-target); padding: var(--sp-1) var(--sp-3); border: 0; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.2; text-align: left; cursor: pointer; background: var(--amber); color: var(--surface-0); -webkit-tap-highlight-color: transparent; } + .ham-pill > span { min-width: 0; white-space: nowrap; } + .ham-pill .ham-pill-step { flex: 0 0 auto; opacity: .85; font-variant-numeric: tabular-nums; } + .ham-pill .ham-pill-label { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; } + .ham-pill .ham-pill-since { flex: 0 0 auto; opacity: .85; font-variant-numeric: tabular-nums; } + .ham-pill .ham-pill-label::before, .ham-pill .ham-pill-since::before { content: "· "; opacity: .7; } + .ham-pill[data-motion="static"] { background: color-mix(in srgb, var(--amber) 70%, var(--panel)); } + .ham-pill[data-motion="needs-human"] { background: color-mix(in srgb, var(--amber) 45%, var(--red)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--red) 55%, transparent); } + .ham-pill[data-motion="merged"] { background: var(--green); } + .ham-pill:focus-visible { outline: 2px solid var(--focus-ring, var(--accent)); outline-offset: 2px; } + .ham-pill.ham-pill-moved { animation: ham-pill-moved .45s ease-out 1; } + } + @keyframes ham-pill-moved { 0% { transform: scale(.94); filter: brightness(1.6); } 100% { transform: none; filter: none; } } + /* The sheet opened from the pill carries a copy of the row's strip; the + phone rules above hide a strip that sits in a row, so this one is put + back and scrolls sideways when eight chevrons outgrow the sheet. */ + .ham-pill-sheet .ham-pill-sheet-strip { overflow-x: auto; padding-bottom: var(--sp-2); } + .ham-pill-sheet .ham-strip-row { display: flex; align-items: center; gap: var(--sp-2); min-width: 32em; overflow: visible; } + .ham-pill-sheet .ham-strip-row > .ham-strip, .ham-pill-sheet .ham-strip-row > .ham-since { display: flex; } + .ham-pill-sheet .ham-strip-row > .ham-strip { display: grid; } + .ham-pill-sheet .ham-pill-sheet-caption { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--text); } + .ham-pill-sheet .ham-pill-sheet-tip { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--text-muted); white-space: pre-line; } + @media (prefers-reduced-motion: reduce) { .ham-pill.ham-pill-moved { animation: none; } } /* Movement animation: when an item's lit chevron changes column between two refreshes, the chosen effect (settings gear → Movement animation) plays once on that row. Overlays live in .ham-anim-layer, an absolute @@ -18687,6 +18718,71 @@

Where to get help

return `

${esc(text + (tracks ? ' · ' + tracks : ''))}

`; } + // Phone progress pill (hivecommons/hive#17160): "Step 7/9 · Merge queue · + // 2h" stands in for the chevron strip at phone widths, where eight + // chevrons cannot fit a 390px row. Pure: rendered into every strip-row + // next to the
    , shown by tracker.css only inside the phone media + // tier; tapping opens the full strip in a modal sheet + // (stageTrackerPillSheet). Steps count chevrons as drawn — column 50 is + // two (CI, Review) — within the row's range, so a nested PR row counts + // only its own chevrons. Colour follows the strip: data-motion carries + // the row's motion bucket, "merged" when the cap is lit. + function stageTrackerPillHtml(item, stages, range, nowMs, ctx) { + if (!item || (item.superseded && item.superseded.closer_pr)) return ''; + const from = range && range.from != null ? range.from : -Infinity; + const to = range && range.to != null ? range.to : Infinity; + const segs = stageTrackerSegments(item, stages, nowMs, ctx).filter(sg => sg.number >= from && sg.number <= to); + let step = 0, total = 0, active = null; + segs.forEach(sg => { + const width = sg.number === 50 ? 2 : 1; + if (sg.state === 'active' && !active) { + active = sg; + // Column 50: Review is the second chevron, lit when only it runs. + step = total + (sg.number === 50 && typeof stageTrackerTrackRunning === 'function' && !stageTrackerTrackRunning(item, 'ci') && stageTrackerTrackRunning(item, 'review') ? 2 : 1); + } + total += width; + }); + if (!active) return ''; + const label = active.detour && active.detour.text ? active.detour.text : active.short; + const since = (stageTrackerSinceHtml(item, nowMs).match(/>([^<]*)<\/span>/) || [])[1] || ''; + const motion = active.cap && (active.terminal || item.terminal_merge) ? 'merged' : stageTrackerMotion(item); + const words = `Step ${step}/${total} · ${label}${since ? ' · ' + since : ''}`; + return ``; + } + + // Tap on the phone pill: the row's full chevron strip, its "since" age + // and the current-stage caption in a bottom sheet (.hive-dialog + // .modal-sheet, decorated by hiveWireDialog). The strip is cloned from + // the row so the sheet shows exactly what the desktop row shows, + // scrolling sideways when eight chevrons outgrow the sheet. + function stageTrackerPillSheet(key) { + const panel = document.getElementById('activity-monitor-panel'); + const row = panel && [...panel.querySelectorAll('.ham-row, .ham-sub')].find(r => (r.dataset.hamKey || r.dataset.hamSubKey || '') === String(key) || !!r.querySelector(`:scope > .ham-strip-row > .ham-pill[data-arg0="${CSS.escape(String(key))}"]`)); + if (!row) return; + const stripRow = row.querySelector(':scope > .ham-strip-row'); + const pill = stripRow && stripRow.querySelector(':scope > .ham-pill'); + const caption = row.querySelector(':scope > .ham-current-stage'); + const head = row.querySelector(':scope > .ham-row-head .ham-ref, :scope > .ham-row-head .ham-pr-ref .ham-pr-num'); + const active = stripRow && stripRow.querySelector('.ham-seg.active'); + const title = (head ? head.textContent.trim() + ' · ' : '') + (pill ? pill.querySelector('.ham-pill-label').textContent : 'Pipeline progress'); + const overlay = document.createElement('div'); + overlay.className = 'hive-dialog-overlay'; + overlay.innerHTML = ``; + const slot = overlay.querySelector('.ham-pill-sheet-strip'); + if (stripRow) { + const copy = stripRow.cloneNode(true); + copy.querySelectorAll('.ham-pill, .ham-anim-layer').forEach(n => n.remove()); + copy.querySelectorAll('[data-ham-prev-col]').forEach(n => n.removeAttribute('data-ham-prev-col')); + copy.querySelectorAll('[tabindex]').forEach(n => n.removeAttribute('tabindex')); + slot.appendChild(copy); + } + document.body.appendChild(overlay); + if (typeof hiveRememberModalOpen === 'function') hiveRememberModalOpen(overlay); + const done = () => { if (overlay.parentNode) overlay.remove(); if (pill && typeof pill.focus === 'function') pill.focus(); }; + if (typeof hiveWireDialog === 'function') hiveWireDialog(overlay, done, undefined, '.primary', null, close => close()); + else overlay.querySelector('.primary').addEventListener('click', done); + } + // "040 Covered by PR" — the stage code plus the strip word the payload // names for it (the code alone when the stage table is not loaded yet). function stageTrackerStageWord(n) { @@ -19698,7 +19794,7 @@

    Where to get help

    ${typeof stageTrackerPreparationNodeHtml === 'function' ? stageTrackerPreparationNodeHtml(pr, stages, ctx) : ''}
      ${stageTrackerStripItems(pr, stages, { from: STAGE_TRACKER_PR_COLUMN }, nowMs, ctx)}
    - ${stageTrackerSinceHtml(pr, nowMs)} + ${stageTrackerSinceHtml(pr, nowMs)}${typeof stageTrackerPillHtml === 'function' ? stageTrackerPillHtml(pr, stages, { from: STAGE_TRACKER_PR_COLUMN }, nowMs, ctx) : ''}
    ${humanNote}${stageTrackerCurrentStageHtml(pr, stages, { from: STAGE_TRACKER_PR_COLUMN })}${typeof stageTrackerPreparationCommentHtml === 'function' ? stageTrackerPreparationCommentHtml(pr, noteCtx, subKey) : typeof stageTrackerEventHtml === 'function' ? stageTrackerEventHtml(subKey, noteCtx) : ''}${typeof stageTrackerExecutionHtml === 'function' ? stageTrackerExecutionHtml(pr) : ''} `; @@ -20014,7 +20110,7 @@

    Where to get help

    ${typeof stageTrackerPreparationNodeHtml === 'function' ? stageTrackerPreparationNodeHtml(item, stages, ctx) : ''}
      ${stageTrackerStripItems(shown, stages, range, nowMs, ctx)}
    - ${stageTrackerSinceHtml(shown, nowMs)} + ${stageTrackerSinceHtml(shown, nowMs)}${typeof stageTrackerPillHtml === 'function' ? stageTrackerPillHtml(shown, stages, range, nowMs, ctx) : ''}
    ${humanNote}${stageTrackerCurrentStageHtml(shown, stages, range, nowMs)}${typeof stageTrackerPreparationCommentHtml === 'function' ? stageTrackerPreparationCommentHtml(shown, noteCtx, rowKey) : typeof stageTrackerEventHtml === 'function' ? stageTrackerEventHtml(rowKey, noteCtx) : ''}${typeof stageTrackerExecutionHtml === 'function' ? stageTrackerExecutionHtml(shown) : ''}${typeof stageTrackerReviewNotesHtml === 'function' ? stageTrackerReviewNotesHtml(item, ctx) : ''}${subs} `; } @@ -20708,6 +20804,19 @@

    Where to get help

    if (!fn || !strip || from === to) return false; const dest = strip.children[to], src = strip.children[from]; if (!dest || !src || dest.classList.contains('blank')) return false; + // Phone tier (hivecommons/hive#17160): the strip is display:none and + // the progress pill stands in for it, so the overlay has no geometry + // to play against. One flash on the pill is the whole cue; the + // chevrons already show the new state when the sheet opens. Guarded + // for the test stub strip, which has no getClientRects. + if (typeof strip.getClientRects === 'function' && !strip.getClientRects().length) { + const pill = strip.parentElement && strip.parentElement.querySelector ? strip.parentElement.querySelector(':scope > .ham-pill') : null; + if (pill) { + pill.classList.add('ham-pill-moved'); + stageTrackerAfter(pill, 'animationend', STAGE_TRACKER_MOVE_MS, () => pill.classList.remove('ham-pill-moved')); + } + return true; + } stageTrackerAnimLayer(strip).innerHTML = ''; const plan = stageTrackerMovePlan(effect, stageTrackerAnimScale(strip)); strip.dataset.hamPhase = 'flash'; diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js index 14b2300a93..d9877f2054 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js @@ -61,6 +61,47 @@ } }; const rows = [...document.querySelectorAll('#activity-monitor-section .ham-row, #activity-monitor-section .ham-sub')]; + // Phone tier (hivecommons/hive#17160): the chevron strip is hidden and a + // progress pill stands in for it, so the lane geometry below has nothing + // to measure. The pill contract is asserted instead: every visible row + // owns one pill, fully inside the row, at least the tap target tall, its + // text at least 12px, no strip-row scrolling sideways, no column header, + // needs-human rows coloured apart from the rest. + const phone = matchMedia('(max-width: 640px), ((pointer: coarse) and (max-width: 820px))').matches; + if (phone) { + const tapTarget = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--tap-target')) || 40; + const minFont = 12; + const fills = { human: new Set(), other: new Set() }; + let pills = 0; + const cols = document.querySelector('#activity-monitor-section .ham-cols'); + assert(!visible(cols), 'phone: the sticky chevron column header is hidden (the pill names the stage)'); + for (const [index, row] of rows.entries()) { + const name = 'row ' + index + ' '; + const stripRow = row.querySelector(':scope > .ham-strip-row'); + if (!visible(row) || !visible(stripRow)) continue; + const strip = stripRow.querySelector(':scope > ol[aria-label="Pipeline progress"]'); + const pill = stripRow.querySelector(':scope > .ham-pill'); + assert(!visible(strip), name + 'phone: chevron strip is hidden behind the pill'); + assert(stripRow.scrollWidth <= stripRow.clientWidth + tolerance, name + 'phone: strip row does not scroll sideways'); + if (!strip || !strip.querySelector('.ham-seg.active')) continue; // no active step → no pill (superseded original) + assert(visible(pill), name + 'phone: every row with an active step shows a progress pill'); + if (!visible(pill)) continue; + pills++; + const box = rect(pill), bounds = rect(row); + assert(box.left >= bounds.left - tolerance && box.right <= bounds.right + tolerance, name + 'phone: pill stays inside the row: ' + JSON.stringify({ pill: box.toJSON(), row: bounds.toJSON() })); + assert(box.height >= tapTarget - tolerance, name + 'phone: pill is at least the tap target tall: ' + box.height); + assert(parseFloat(getComputedStyle(pill).fontSize) >= minFont, name + 'phone: pill text is at least 12px'); + assert(/^Step \d+\/\d+ · \S/.test(pill.textContent.replace(/\s+/g, ' ').trim()) || /^Step \d+\/\d+/.test(pill.querySelector('.ham-pill-step')?.textContent || ''), name + 'phone: pill reads "Step N/T · stage"'); + assert(pill.matches('[data-action="stageTrackerPillSheet"][data-arg0]'), name + 'phone: tapping the pill opens the strip sheet'); + (pill.dataset.motion === 'needs-human' ? fills.human : fills.other).add(getComputedStyle(pill).backgroundColor); + if (strip.querySelector('.ham-seg.active[data-motion="needs-human"]')) assert(pill.dataset.motion === 'needs-human', name + 'phone: needs-human row carries a needs-human pill'); + } + assert(pills > 0, 'phone: preview must render progress pills'); + assert(fills.human.size > 0, 'phone: preview must include a needs-human pill'); + for (const fill of fills.human) assert(!fills.other.has(fill), 'phone: needs-human pills are visually distinct from the other pills: ' + fill); + if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, phone: true, pills, failures })); + return { viewport: innerWidth, phone: true, pills, failures }; + } const references = new Map(); for (const [index, row] of rows.entries()) { const header = row.querySelector(':scope > .ham-row-head > .ham-head-cols'); diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js new file mode 100644 index 0000000000..477b4b2524 --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js @@ -0,0 +1,70 @@ +// Dedicated preview only: evaluate ()({ dedicatedPreview: true }). +// Phone tier (hivecommons/hive#17160): the Activity monitor row shows a +// progress pill instead of the chevron strip. Asserts the pill contract at +// the phone viewport and that tapping the pill opens the full strip in a +// .hive-dialog.modal-sheet; then plays one row move and checks the cue +// lands on the pill (no overlay geometry against a hidden strip, no error). +(async ({ dedicatedPreview = false } = {}) => { + if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); + const tolerance = 1; + const failures = []; + const assert = (ok, message) => { if (!ok) failures.push(message); }; + const frame = () => new Promise(requestAnimationFrame); + const visible = el => el && el.getClientRects().length && getComputedStyle(el).display !== 'none'; + const phone = matchMedia('(max-width: 640px), ((pointer: coarse) and (max-width: 820px))').matches; + if (!phone) return { viewport: innerWidth, phone: false, skipped: 'strip tier: the chevron strip is drawn, see tracker-header-geometry', failures }; + const panel = document.getElementById('activity-monitor-panel'); + const rows = [...panel.querySelectorAll('.ham-row, .ham-sub')].filter(visible); + const pills = rows.map(row => row.querySelector(':scope > .ham-strip-row > .ham-pill')).filter(visible); + assert(pills.length > 0, 'phone: rows render progress pills'); + const tapTarget = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--tap-target')) || 40; + for (const [index, pill] of pills.entries()) { + const row = pill.closest('.ham-row, .ham-sub'); + const box = pill.getBoundingClientRect(), bounds = row.getBoundingClientRect(); + assert(box.left >= bounds.left - tolerance && box.right <= bounds.right + tolerance, 'pill ' + index + ' inside its row'); + assert(box.height >= tapTarget - tolerance, 'pill ' + index + ' is at least the tap target tall: ' + box.height); + assert(parseFloat(getComputedStyle(pill).fontSize) >= 12, 'pill ' + index + ' text is at least 12px'); + const stripRow = pill.parentElement; + assert(stripRow.scrollWidth <= stripRow.clientWidth + tolerance, 'pill ' + index + ' strip row does not scroll sideways'); + } + // Tap → sheet with the full strip. + const first = pills[0]; + first.scrollIntoView({ block: 'center', behavior: 'instant' }); + await frame(); + const hit = document.elementFromPoint((first.getBoundingClientRect().left + first.getBoundingClientRect().right) / 2, (first.getBoundingClientRect().top + first.getBoundingClientRect().bottom) / 2); + assert(hit === first || first.contains(hit), 'pill centre hits the pill, not an overlay: ' + (hit?.className || hit?.tagName || null)); + first.click(); + await frame(); await frame(); + const sheet = document.querySelector('.hive-dialog-overlay .hive-dialog.modal-sheet.ham-pill-sheet'); + assert(!!sheet && visible(sheet), 'tapping the pill opens a .hive-dialog.modal-sheet'); + if (sheet) { + const strip = sheet.querySelector('.ham-strip'); + assert(visible(strip), 'sheet shows the chevron strip'); + assert(!!strip && strip.querySelectorAll('.ham-seg').length >= 2 && !!strip.querySelector('.ham-seg.active'), 'sheet strip carries the row’s chevrons with the lit step'); + const sb = sheet.getBoundingClientRect(); + assert(sb.width >= innerWidth - tolerance, 'sheet spans the phone viewport'); + const close = sheet.querySelector('.modal-sheet-close'); + assert(visible(close), 'sheet has the ✕ close'); + (close || sheet.querySelector('.primary')).click(); + await frame(); await frame(); + assert(!document.querySelector('.ham-pill-sheet'), 'sheet closes'); + } + // Row move cue: stamp a move on a strip and play it once. + const strip = first.parentElement.querySelector(':scope > ol[aria-label="Pipeline progress"]'); + const errors = []; + const onError = event => errors.push(String(event.error || event.message)); + addEventListener('error', onError); + let played = 0; + try { + strip.dataset.hamPrevCol = '1'; strip.dataset.hamCol = String(Math.max(2, [...strip.children].findIndex(c => c.classList.contains('active')))); + played = stageTrackerAnimateMoves(panel); + } catch (error) { errors.push(String(error)); } + await frame(); + removeEventListener('error', onError); + assert(errors.length === 0, 'row move on a phone raises no tracker-motion error: ' + errors.join('; ')); + assert(played === 1, 'row move cue fires once per move: ' + played); + assert(first.classList.contains('ham-pill-moved'), 'row move cue lands on the pill'); + assert(!first.parentElement.querySelector(':scope > .ham-anim-layer') || !visible(first.parentElement.querySelector(':scope > .ham-anim-layer')), 'no overlay is drawn against the hidden strip'); + if (failures.length) throw new Error(JSON.stringify({ viewport: innerWidth, phone: true, pills: pills.length, failures })); + return { viewport: innerWidth, phone: true, pills: pills.length, failures }; +}) diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index 993549b3e0..cba2fc569a 100644 --- a/src/scripts/dashboard-mobile-shots.mjs +++ b/src/scripts/dashboard-mobile-shots.mjs @@ -267,9 +267,15 @@ 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', 'tracker-phone-chrome'].map(name => ({ + const probes = ['tracker-header-geometry', 'tracker-decision-interaction', 'tracker-phone-chrome', 'tracker-phone-pill'].map(name => ({ name, source: fs.readFileSync(path.join(fixtureRoot, name + '.js'), 'utf8'), })); + // Phone tier (hivecommons/hive#17160): the chevron strip is hidden behind + // the progress pill, so the decision-trigger probes (they hover a chevron + // in the strip) have nothing to point at; the pill probe runs instead. + const PHONE_MEDIA = '(max-width: 640px), ((pointer: coarse) and (max-width: 820px))'; + const STRIP_PROBES = new Set(['tracker-decision-interaction']); + const PILL_REQUIRED_VIEWPORT = '390x844@3'; const event = process.env.GITHUB_EVENT_PATH ? JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8')) : {}; const provenance = { head: event.pull_request?.head?.sha || process.env.GITHUB_SHA || 'unpublished-local', checkoutSHA: process.env.GITHUB_SHA || 'unpublished-local', @@ -493,7 +499,12 @@ async function main() { const capture = await screenshot(`${vp.name}-${theme}-activity-density-viewport.png`, true); const results = [{ probe: 'viewport-paint', ok: capture.painted, result: capture }]; if (!capture.painted) activityFailures.push(vp.name + ' ' + theme + ' blank viewport capture'); + const phone = await evaluate(`matchMedia(${JSON.stringify(PHONE_MEDIA)}).matches`); for (const probe of probes) { + if (phone && STRIP_PROBES.has(probe.name)) { + results.push({ probe: probe.name, ok: true, result: { skipped: 'phone tier: the chevron strip is in the pill sheet, see tracker-phone-pill' } }); + continue; + } const result = await evaluate(`(async () => { try { return { ok: true, result: await (${probe.source})({ dedicatedPreview: true }) }; } catch (error) { @@ -504,10 +515,18 @@ async function main() { })()`); results.push({ probe: probe.name, ...result }); if (!result.ok) activityFailures.push(vp.name + ' ' + theme + ' ' + probe.name); + // 390×844 is the phone the pill was sized for: it must actually + // exercise the pill there, never pass by falling into the strip tier. + if (probe.name === 'tracker-phone-pill' && vp.name === PILL_REQUIRED_VIEWPORT && !(result.ok && result.result && result.result.phone === true && result.result.pills > 0)) { + activityFailures.push(vp.name + ' ' + theme + ' progress pill must replace the strip at 390x844'); + } } let native; - try { native = await nativeDecisionInput(`${vp.name}-${theme}-activity`); } - catch (error) { native = { failures: [String(error.stack || error)] }; } + if (phone) native = { skipped: 'phone tier: decision trigger lives in the pill sheet', failures: [] }; + else { + try { native = await nativeDecisionInput(`${vp.name}-${theme}-activity`); } + catch (error) { native = { failures: [String(error.stack || error)] }; } + } const nativeOK = native.failures.length === 0; results.push({ probe: 'native-CDP-pointer-keyboard', ok: nativeOK, result: native }); if (!nativeOK) activityFailures.push(vp.name + ' ' + theme + ' native input'); From 4c174fa85d49b1bd38b0d6e2193b8f804e8a0911 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 7 Nov 2026 19:56:50 -0700 Subject: [PATCH 2/3] dashboard: compact pill box with tap-target hit area so nested rows fit 375x667 Signed-off-by: Andrew Anderson --- src/pkg/dashboard/stage_tracker_activity.test.js | 3 ++- src/pkg/dashboard/static-src/css/tracker.css | 5 ++++- src/pkg/dashboard/static/index.html | 5 ++++- .../dashboard/webstatic/testdata/tracker-header-geometry.js | 3 ++- src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/pkg/dashboard/stage_tracker_activity.test.js b/src/pkg/dashboard/stage_tracker_activity.test.js index a860894f98..d4207d8799 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -656,7 +656,8 @@ test('known and original chevrons keep full long text inside a shared one-line c assert.doesNotMatch(css, /--ham-compact-min-width/); assert.match(css, /^\s*\.ham-pill \{ display: none; \}/m); assert.match(css, /@media \(max-width: 640px\), \(\(pointer: coarse\) and \(max-width: 820px\)\) \{\s*\.ham-cols \{ display: none; \}\s*\.ham-row > \.ham-strip-row > \.ham-strip, \.ham-sub > \.ham-strip-row > \.ham-strip,/); - assert.match(css, /\.ham-pill \{ display: inline-flex;[^}]*min-height: var\(--tap-target\);[^}]*font-size: var\(--fs-sm\);/); + assert.match(css, /\.ham-pill \{ display: inline-flex;[^}]*min-height: var\(--control-compact-min-h\);[^}]*font-size: var\(--fs-sm\);/); + assert.match(css, /\.ham-pill::before \{ content: ""; position: absolute; inset: calc\(\(var\(--control-compact-min-h\) - var\(--tap-target\)\) \/ 2\) 0; \}/); assert.match(css, /\.ham-pill\[data-motion="needs-human"\] \{ background: color-mix\(in srgb, var\(--amber\) 45%, var\(--red\)\);/); }); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index b9abe054fc..2262f2922b 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -936,7 +936,10 @@ .ham-row > .ham-strip-row > .ham-since, .ham-sub > .ham-strip-row > .ham-since, .ham-row > .ham-strip-row > .ham-anim-layer, .ham-sub > .ham-strip-row > .ham-anim-layer { display: none; } .ham-row > .ham-strip-row, .ham-sub > .ham-strip-row { overflow: hidden; min-width: 0; } - .ham-pill { display: inline-flex; align-items: center; gap: var(--sp-2); max-width: 100%; min-height: var(--tap-target); padding: var(--sp-1) var(--sp-3); border: 0; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.2; text-align: left; cursor: pointer; background: var(--amber); color: var(--surface-0); -webkit-tap-highlight-color: transparent; } + .ham-pill { display: inline-flex; position: relative; align-items: center; gap: var(--sp-2); max-width: 100%; min-height: var(--control-compact-min-h); padding: var(--sp-1) var(--sp-3); border: 0; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.2; text-align: left; cursor: pointer; background: var(--amber); color: var(--surface-0); -webkit-tap-highlight-color: transparent; } + /* The box stays at the compact control height so a nested-PR row fits a 667px phone; the hit + area is padded out to the tap target. */ + .ham-pill::before { content: ""; position: absolute; inset: calc((var(--control-compact-min-h) - var(--tap-target)) / 2) 0; } .ham-pill > span { min-width: 0; white-space: nowrap; } .ham-pill .ham-pill-step { flex: 0 0 auto; opacity: .85; font-variant-numeric: tabular-nums; } .ham-pill .ham-pill-label { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; } diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 532082f390..2bd02df612 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2276,7 +2276,10 @@ .ham-row > .ham-strip-row > .ham-since, .ham-sub > .ham-strip-row > .ham-since, .ham-row > .ham-strip-row > .ham-anim-layer, .ham-sub > .ham-strip-row > .ham-anim-layer { display: none; } .ham-row > .ham-strip-row, .ham-sub > .ham-strip-row { overflow: hidden; min-width: 0; } - .ham-pill { display: inline-flex; align-items: center; gap: var(--sp-2); max-width: 100%; min-height: var(--tap-target); padding: var(--sp-1) var(--sp-3); border: 0; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.2; text-align: left; cursor: pointer; background: var(--amber); color: var(--surface-0); -webkit-tap-highlight-color: transparent; } + .ham-pill { display: inline-flex; position: relative; align-items: center; gap: var(--sp-2); max-width: 100%; min-height: var(--control-compact-min-h); padding: var(--sp-1) var(--sp-3); border: 0; border-radius: var(--r-pill); font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.2; text-align: left; cursor: pointer; background: var(--amber); color: var(--surface-0); -webkit-tap-highlight-color: transparent; } + /* The box stays at the compact control height so a nested-PR row fits a 667px phone; the hit + area is padded out to the tap target. */ + .ham-pill::before { content: ""; position: absolute; inset: calc((var(--control-compact-min-h) - var(--tap-target)) / 2) 0; } .ham-pill > span { min-width: 0; white-space: nowrap; } .ham-pill .ham-pill-step { flex: 0 0 auto; opacity: .85; font-variant-numeric: tabular-nums; } .ham-pill .ham-pill-label { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; } diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js index d9877f2054..69b80d86cf 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-header-geometry.js @@ -89,7 +89,8 @@ pills++; const box = rect(pill), bounds = rect(row); assert(box.left >= bounds.left - tolerance && box.right <= bounds.right + tolerance, name + 'phone: pill stays inside the row: ' + JSON.stringify({ pill: box.toJSON(), row: bounds.toJSON() })); - assert(box.height >= tapTarget - tolerance, name + 'phone: pill is at least the tap target tall: ' + box.height); + const hitPad = Math.max(0, -parseFloat(getComputedStyle(pill, '::before').top) || 0); + assert(box.height + 2 * hitPad >= tapTarget - tolerance, name + 'phone: pill hit area is at least the tap target tall: ' + (box.height + 2 * hitPad)); assert(parseFloat(getComputedStyle(pill).fontSize) >= minFont, name + 'phone: pill text is at least 12px'); assert(/^Step \d+\/\d+ · \S/.test(pill.textContent.replace(/\s+/g, ' ').trim()) || /^Step \d+\/\d+/.test(pill.querySelector('.ham-pill-step')?.textContent || ''), name + 'phone: pill reads "Step N/T · stage"'); assert(pill.matches('[data-action="stageTrackerPillSheet"][data-arg0]'), name + 'phone: tapping the pill opens the strip sheet'); diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js index 477b4b2524..1a7e5b9448 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-pill.js @@ -22,7 +22,8 @@ const row = pill.closest('.ham-row, .ham-sub'); const box = pill.getBoundingClientRect(), bounds = row.getBoundingClientRect(); assert(box.left >= bounds.left - tolerance && box.right <= bounds.right + tolerance, 'pill ' + index + ' inside its row'); - assert(box.height >= tapTarget - tolerance, 'pill ' + index + ' is at least the tap target tall: ' + box.height); + const hitPad = Math.max(0, -parseFloat(getComputedStyle(pill, '::before').top) || 0); + assert(box.height + 2 * hitPad >= tapTarget - tolerance, 'pill ' + index + ' hit area is at least the tap target tall: ' + (box.height + 2 * hitPad)); assert(parseFloat(getComputedStyle(pill).fontSize) >= 12, 'pill ' + index + ' text is at least 12px'); const stripRow = pill.parentElement; assert(stripRow.scrollWidth <= stripRow.clientWidth + tolerance, 'pill ' + index + ' strip row does not scroll sideways'); From c0236120c93dbe456ae3382fea95dad9596d1bb2 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 7 Nov 2026 20:14:47 -0700 Subject: [PATCH 3/3] dashboard: re-pin TRUSTED_SCRIPTS_TREE after rebase Signed-off-by: Andrew Anderson --- .github/scripts/integration-governance.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index c395622f9f..932e3e362d 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 = '8cf9edcab6cfbe4e8a847b03209cbca0c604889f'; +const TRUSTED_SCRIPTS_TREE = 'c6b5ba0094fcd1304b391315b196b44f4cc77633'; 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()) =>