From b5bc8e78d2a5a309400068c6aaaf4344cdeb3b52 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 7 Nov 2026 20:41:04 -0700 Subject: [PATCH 1/2] dashboard: card-per-row Activity monitor layout on phones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phone tier only (hivecommons/hive#17161): row tools move into the card header, the head is one inline run clamped to two lines (three with an issue title plus PR ref), chips and the lead action render inline, the "no linked issue" placeholder is dropped and the current-stage caption keeps its lead clause on one line. The pill sheet carries the full title and needs-human note. New tracker-phone-card probe asserts median .ham-row ≤ 96px and ≥ 6 rows per viewport with the density fixture at 390x844. 1280 markup and geometry unchanged. Signed-off-by: Andrew Anderson --- .github/scripts/integration-governance.cjs | 2 +- .../changed-activity-phone-card-rows.md | 1 + .../dashboard-sections/activity-monitor.md | 2 + .../dashboard/stage_tracker_activity.test.js | 28 ++++++- src/pkg/dashboard/static-src/css/tracker.css | 44 +++++++++- .../static-src/js/tracker-row-strip.js | 6 +- src/pkg/dashboard/static/index.html | 50 +++++++++++- .../webstatic/testdata/tracker-phone-card.js | 80 +++++++++++++++++++ .../testdata/tracker-phone-ergonomics.js | 22 +++-- src/scripts/dashboard-mobile-shots.mjs | 9 ++- 10 files changed, 230 insertions(+), 14 deletions(-) create mode 100644 changelog.d/changed-activity-phone-card-rows.md create mode 100644 src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js diff --git a/.github/scripts/integration-governance.cjs b/.github/scripts/integration-governance.cjs index 2210a5684e..0113cdfd17 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 = '6067449abe5556e11068e2901a222a45c03fe1d2'; +const TRUSTED_SCRIPTS_TREE = '066d4e1e6d183026098cafe5a312633e517b2031'; 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/changed-activity-phone-card-rows.md b/changelog.d/changed-activity-phone-card-rows.md new file mode 100644 index 0000000000..20722ac377 --- /dev/null +++ b/changelog.d/changed-activity-phone-card-rows.md @@ -0,0 +1 @@ +- Dashboard: on phones each Activity monitor row is a ~90px card — ☐/⋯ in the top-right corner, a clamped head (repo chip, #ref, two-line title, PR line, chips), the progress pill, one line of caption, no "no linked issue" placeholder — the pill sheet carries the full title and note, and the phone ergonomics probe counts the padded hit areas the pill and inline chips grow to 44px with; the 1280 layout is unchanged (hivecommons/hive#17161). diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index 97f7ac05c1..4d36e78800 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -159,6 +159,8 @@ Reduced-motion preferences disable animation; needs-human remains steadily red. **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)). +Phone rows are laid out as **cards** of about 90px: ☐ and ⋯ sit in the card's top-right corner instead of the left gutter; the head wraps its parts — kind icon, repo chip, `#ref` and a title clamped to two lines, then the covering PR on one line when an issue row names one (a PR-only row's PR text hangs beside its icon and chip), then any chips or lead action on a line of their own, which shortens the title to one line; the pill follows, stopping short of the tools column; the current-stage caption keeps its lead clause on one line. The muted *no linked issue* placeholder is not drawn. The pill sheet carries the full title, the full needs-human note and the full caption, so nothing a card clips is lost. The density acceptance fixture at 390×844 must keep the median row at or under 96px with at least six rows per screen ([#17161](https://github.com/hivecommons/hive/issues/17161)). + ### 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 d4207d8799..40c036fe0a 100644 --- a/src/pkg/dashboard/stage_tracker_activity.test.js +++ b/src/pkg/dashboard/stage_tracker_activity.test.js @@ -657,10 +657,36 @@ test('known and original chevrons keep full long text inside a shared one-line c 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\(--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::before \{ content: ""; position: absolute; inset: calc\(\(var\(--control-compact-min-h\) - var\(--tap-target\)\) \/ 2 - var\(--sp-1\)\) 0; \}/); assert.match(css, /\.ham-pill\[data-motion="needs-human"\] \{ background: color-mix\(in srgb, var\(--amber\) 45%, var\(--red\)\);/); }); +test('phone card per row: clamped head boxes, badge line, one-line caption, full title in the sheet (#17161)', () => { + const css = fs.readFileSync(path.join(__dirname, 'static-src/css/tracker.css'), 'utf8'); + const start = css.indexOf('Phone card per row (hivecommons/hive#17161)'); + const open = css.indexOf('@media', start); + const card = css.slice(open, css.indexOf('\n }\n', open) + 7); + // Scoped to the phone tier only; the desktop lane grid is untouched. + assert.match(card, /^\s*@media \(max-width: 640px\), \(\(pointer: coarse\) and \(max-width: 820px\)\) \{/m); + // The head drops the tap target's min-height (#17163) and wraps the issue slot, PR reference and badges as flex items. + assert.match(card, /#activity-monitor-section \.ham-row > \.ham-row-head\.ham-row-head, #activity-monitor-section \.ham-sub > \.ham-row-head\.ham-row-head \{ display: flex; flex-wrap: wrap;[^}]*min-height: 0;/); + assert.match(card, /\.ham-head-cols, \.ham-head-cols > \.ham-strip, \.ham-head-cols \.ham-seg\.ham-head-lead, \.ham-head-cols \.ham-seg\.ham-head-pr, \.ham-head-cols \.ham-pr-line \{ display: contents; \}/); + assert.match(card, /\.ham-row-head \.ham-head-main, #activity-monitor-section \.ham-row-head \.ham-pr-ref \{ display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;/); + assert.match(card, /\.ham-row-head:has\(\.ham-head-main > \.ham-title:not\(\.ham-no-issue-t\)\) \.ham-pr-ref \{ -webkit-line-clamp: 1; flex-basis: 100%; \}/); + assert.match(card, /\.ham-row-head:has\(\.ham-badges:not\(:empty\)\) :is\(\.ham-head-main, \.ham-pr-ref\) \{ -webkit-line-clamp: 1; \}/); + assert.match(card, /\.ham-row-head \.ham-no-issue-t, \.ham-row-head \.ham-linked-ico \{ display: none; \}/); + assert.match(card, /\.ham-row > \.ham-current-stage, \.ham-sub > \.ham-current-stage \{ margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; \}/); + // Inline chips keep the line height; their hit areas pad out to --tap-target. The pill stops short of the tools column. + assert.match(card, /\.ham-row-head \.ham-repo-chip::after, \.ham-row-head \.ham-lead-act::before \{ content: ""; position: absolute; inset: calc\(-1 \* var\(--sp-6\)\) 0; \}/); + assert.match(card, /\.ham-row > \.ham-strip-row > \.ham-pill, \.ham-sub > \.ham-strip-row > \.ham-pill \{ max-width: calc\(100% - 2 \* var\(--tap-target\) - var\(--sp-2\) - var\(--sp-3\)\); \}/); + assert.doesNotMatch(card.slice(card.indexOf('{')), /#[0-9a-fA-F]{3,8}\b|\d+px/, 'card tier uses tokens only'); + // The sheet exposes what the card clamps: the full title and the needs-human note. + const sheet = fn(strip, 'stageTrackerPillSheet'); + assert.match(sheet, /\.ham-title:not\(\.ham-no-issue-t\), :scope > \.ham-row-head \.ham-pr-title/); + assert.match(sheet, /

\$\{esc\(fullTitle\)\}<\/p>/); + assert.match(sheet, /

\$\{esc\(note\.textContent\.trim\(\)\)\}<\/p>/); +}); + 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 + ` diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 6992cbddf4..80aa4cd510 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -951,7 +951,7 @@ .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::before { content: ""; position: absolute; inset: calc((var(--control-compact-min-h) - var(--tap-target)) / 2 - var(--sp-1)) 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; } @@ -971,9 +971,51 @@ .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-title { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; } + .ham-pill-sheet .ham-pill-sheet-note { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--amber); } .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; } } + /* Phone card per row (hivecommons/hive#17161). Same markup as 1280; the + phone tier re-flows it. ☐ and ⋯ already sit tap-sized in the card's + top right (#17163); the head drops the tap target's height so they + overhang the card's top padding and the pill starts where they end. + The head is a wrapping flex line: the issue slot (kind icon · repo + chip · #ref · title) and the PR reference are each a box clamped to + two lines — on a PR-only row the slot is just icon + chip and the PR + text hangs beside it; on an issue row that also names its PR the PR + gets one line below — while badges and the lead action wrap onto a + line of their own, never clipped by the clamp. "no linked issue" is + dropped and the caption keeps its lead clause on one line. The pill + sheet carries the full title and the needs-human note. */ + @media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) { + #activity-monitor-section .ham-row > .ham-row-head.ham-row-head, #activity-monitor-section .ham-sub > .ham-row-head.ham-row-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-2); row-gap: var(--sp-1); min-height: 0; line-height: var(--lh-control); } + .ham-head-cols, .ham-head-cols > .ham-strip, .ham-head-cols .ham-seg.ham-head-lead, .ham-head-cols .ham-seg.ham-head-pr, .ham-head-cols .ham-pr-line { display: contents; } + #activity-monitor-section .ham-row-head .ham-head-main, #activity-monitor-section .ham-row-head .ham-pr-ref { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; max-width: 100%; gap: 0; } + #activity-monitor-section .ham-row-head .ham-head-main:has(> .ham-no-issue-t) { flex: 0 0 auto; } + #activity-monitor-section .ham-row-head .ham-pr-ref { flex-basis: 10em; font-size: inherit; } + #activity-monitor-section .ham-row-head:has(.ham-head-main > .ham-title:not(.ham-no-issue-t)) .ham-pr-ref { -webkit-line-clamp: 1; flex-basis: 100%; } + /* A row carrying a lead action or badge gives the title's second line + to that badge line so the card keeps its height. */ + #activity-monitor-section .ham-row-head:has(.ham-badges:not(:empty)) :is(.ham-head-main, .ham-pr-ref) { -webkit-line-clamp: 1; } + .ham-row-head .ham-kind-ico, .ham-row-head .ham-active-ico { display: inline-block; vertical-align: calc(-1 * var(--sp-1)); } + /* Chips and the lead action render inline so no line box grows past + the head's line height; borders paint on the inline box and the + ::before / ::after hit areas pad the tap target back out. */ + #activity-monitor-section .ham-row-head :is(.ham-repo-chip, .ham-base-pill, .ham-badge, .ham-lead-act) { position: relative; display: inline; min-height: 0; min-width: 0; height: auto; padding-block: 0; line-height: inherit; vertical-align: baseline; white-space: nowrap; } + .ham-row-head .ham-repo-chip::after, .ham-row-head .ham-lead-act::before { content: ""; position: absolute; inset: calc(-1 * var(--sp-6)) 0; } + .ham-row-head .ham-ref, .ham-row-head .ham-title, .ham-row-head .ham-pr-ref > *, .ham-row-head .ham-lineage, .ham-row-head .ham-adopted-from { display: inline; white-space: normal; overflow: visible; max-width: none; } + .ham-row-head .ham-ref, .ham-row-head .ham-pr-num, .ham-row-head .ham-repo-chip { margin-right: var(--sp-2); } + .ham-row-head .ham-title { color: var(--text); } + .ham-row-head .ham-no-issue-t, .ham-row-head .ham-linked-ico { display: none; } + .ham-row-head .ham-badges { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); flex: 0 1 auto; max-width: 100%; } + .ham-row-head .ham-badges:empty { display: none; } + .ham-row-head .ham-badges > .ham-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top; } + /* The pill starts on the tools' bottom edge, so it stops short of + their column; its label ellipsises and the sheet has the rest. */ + .ham-row > .ham-strip-row > .ham-pill, .ham-sub > .ham-strip-row > .ham-pill { max-width: calc(100% - 2 * var(--tap-target) - var(--sp-2) - var(--sp-3)); } + .ham-row > .ham-current-stage, .ham-sub > .ham-current-stage { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + } /* 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 diff --git a/src/pkg/dashboard/static-src/js/tracker-row-strip.js b/src/pkg/dashboard/static-src/js/tracker-row-strip.js index 8611059134..33b8878656 100644 --- a/src/pkg/dashboard/static-src/js/tracker-row-strip.js +++ b/src/pkg/dashboard/static-src/js/tracker-row-strip.js @@ -665,9 +665,13 @@ 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'); + // The phone card clamps the head to two lines and the needs-human note + // to one (hivecommons/hive#17161); the sheet carries them in full. + const fullTitle = [...row.querySelectorAll(':scope > .ham-row-head .ham-title:not(.ham-no-issue-t), :scope > .ham-row-head .ham-pr-title')].map(n => n.textContent.trim()).filter(Boolean).join(' · '); + const note = row.querySelector(':scope > .ham-human-context .cue-event-text') || row.querySelector(':scope > .ham-human-context > span'); const overlay = document.createElement('div'); overlay.className = 'hive-dialog-overlay'; - overlay.innerHTML = `

`; + overlay.innerHTML = ``; const slot = overlay.querySelector('.ham-pill-sheet-strip'); if (stripRow) { const copy = stripRow.cloneNode(true); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index cd3792e025..f7de6f8899 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -2294,7 +2294,7 @@ .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::before { content: ""; position: absolute; inset: calc((var(--control-compact-min-h) - var(--tap-target)) / 2 - var(--sp-1)) 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; } @@ -2314,9 +2314,51 @@ .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-title { margin: 0 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text); overflow-wrap: anywhere; } + .ham-pill-sheet .ham-pill-sheet-note { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--amber); } .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; } } + /* Phone card per row (hivecommons/hive#17161). Same markup as 1280; the + phone tier re-flows it. ☐ and ⋯ already sit tap-sized in the card's + top right (#17163); the head drops the tap target's height so they + overhang the card's top padding and the pill starts where they end. + The head is a wrapping flex line: the issue slot (kind icon · repo + chip · #ref · title) and the PR reference are each a box clamped to + two lines — on a PR-only row the slot is just icon + chip and the PR + text hangs beside it; on an issue row that also names its PR the PR + gets one line below — while badges and the lead action wrap onto a + line of their own, never clipped by the clamp. "no linked issue" is + dropped and the caption keeps its lead clause on one line. The pill + sheet carries the full title and the needs-human note. */ + @media (max-width: 640px), ((pointer: coarse) and (max-width: 820px)) { + #activity-monitor-section .ham-row > .ham-row-head.ham-row-head, #activity-monitor-section .ham-sub > .ham-row-head.ham-row-head { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--sp-2); row-gap: var(--sp-1); min-height: 0; line-height: var(--lh-control); } + .ham-head-cols, .ham-head-cols > .ham-strip, .ham-head-cols .ham-seg.ham-head-lead, .ham-head-cols .ham-seg.ham-head-pr, .ham-head-cols .ham-pr-line { display: contents; } + #activity-monitor-section .ham-row-head .ham-head-main, #activity-monitor-section .ham-row-head .ham-pr-ref { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; flex: 1 1 auto; min-width: 0; max-width: 100%; gap: 0; } + #activity-monitor-section .ham-row-head .ham-head-main:has(> .ham-no-issue-t) { flex: 0 0 auto; } + #activity-monitor-section .ham-row-head .ham-pr-ref { flex-basis: 10em; font-size: inherit; } + #activity-monitor-section .ham-row-head:has(.ham-head-main > .ham-title:not(.ham-no-issue-t)) .ham-pr-ref { -webkit-line-clamp: 1; flex-basis: 100%; } + /* A row carrying a lead action or badge gives the title's second line + to that badge line so the card keeps its height. */ + #activity-monitor-section .ham-row-head:has(.ham-badges:not(:empty)) :is(.ham-head-main, .ham-pr-ref) { -webkit-line-clamp: 1; } + .ham-row-head .ham-kind-ico, .ham-row-head .ham-active-ico { display: inline-block; vertical-align: calc(-1 * var(--sp-1)); } + /* Chips and the lead action render inline so no line box grows past + the head's line height; borders paint on the inline box and the + ::before / ::after hit areas pad the tap target back out. */ + #activity-monitor-section .ham-row-head :is(.ham-repo-chip, .ham-base-pill, .ham-badge, .ham-lead-act) { position: relative; display: inline; min-height: 0; min-width: 0; height: auto; padding-block: 0; line-height: inherit; vertical-align: baseline; white-space: nowrap; } + .ham-row-head .ham-repo-chip::after, .ham-row-head .ham-lead-act::before { content: ""; position: absolute; inset: calc(-1 * var(--sp-6)) 0; } + .ham-row-head .ham-ref, .ham-row-head .ham-title, .ham-row-head .ham-pr-ref > *, .ham-row-head .ham-lineage, .ham-row-head .ham-adopted-from { display: inline; white-space: normal; overflow: visible; max-width: none; } + .ham-row-head .ham-ref, .ham-row-head .ham-pr-num, .ham-row-head .ham-repo-chip { margin-right: var(--sp-2); } + .ham-row-head .ham-title { color: var(--text); } + .ham-row-head .ham-no-issue-t, .ham-row-head .ham-linked-ico { display: none; } + .ham-row-head .ham-badges { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); flex: 0 1 auto; max-width: 100%; } + .ham-row-head .ham-badges:empty { display: none; } + .ham-row-head .ham-badges > .ham-badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top; } + /* The pill starts on the tools' bottom edge, so it stops short of + their column; its label ellipsises and the sheet has the rest. */ + .ham-row > .ham-strip-row > .ham-pill, .ham-sub > .ham-strip-row > .ham-pill { max-width: calc(100% - 2 * var(--tap-target) - var(--sp-2) - var(--sp-3)); } + .ham-row > .ham-current-stage, .ham-sub > .ham-current-stage { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + } /* 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 @@ -18841,9 +18883,13 @@

Where to get help

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'); + // The phone card clamps the head to two lines and the needs-human note + // to one (hivecommons/hive#17161); the sheet carries them in full. + const fullTitle = [...row.querySelectorAll(':scope > .ham-row-head .ham-title:not(.ham-no-issue-t), :scope > .ham-row-head .ham-pr-title')].map(n => n.textContent.trim()).filter(Boolean).join(' · '); + const note = row.querySelector(':scope > .ham-human-context .cue-event-text') || row.querySelector(':scope > .ham-human-context > span'); const overlay = document.createElement('div'); overlay.className = 'hive-dialog-overlay'; - overlay.innerHTML = ``; + overlay.innerHTML = ``; const slot = overlay.querySelector('.ham-pill-sheet-strip'); if (stripRow) { const copy = stripRow.cloneNode(true); diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js new file mode 100644 index 0000000000..dc243d4d13 --- /dev/null +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js @@ -0,0 +1,80 @@ +// Dedicated preview only: evaluate ()({ dedicatedPreview: true }). +// Phone tier (hivecommons/hive#17161): the Activity monitor renders a card +// per row — ☐/⋯ in the card's top right (#17163), the head clamped to two +// lines (one when a badge line follows it), the progress pill, one line of +// caption. Asserts the acceptance numbers against the activity-density +// fixture: median .ham-row height ≤ 96px, at least six rows inside the +// viewport once scrolled past the header, no title wider than its row, and +// that the pill sheet carries the full title a clamped head cut short. +(async ({ dedicatedPreview = false } = {}) => { + if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); + const tolerance = 1; + const MAX_MEDIAN_ROW_HEIGHT = 96; + const MIN_ROWS_IN_VIEW = 6; + 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: rows keep the desktop lane layout, see tracker-header-geometry', failures }; + const panel = document.getElementById('activity-monitor-panel'); + const host = document.getElementById('activity-density-layout-fixture') || panel; + const rows = [...host.querySelectorAll('.ham-row')].filter(visible); + assert(rows.length > 0, 'phone: fixture renders rows'); + const heights = rows.map(row => row.getBoundingClientRect().height).sort((a, b) => a - b); + const median = heights.length ? heights[Math.floor(heights.length / 2)] : 0; + assert(median <= MAX_MEDIAN_ROW_HEIGHT, 'median .ham-row height ≤ ' + MAX_MEDIAN_ROW_HEIGHT + 'px: ' + Math.round(median) + ' (' + heights.map(Math.round).join(',') + ')'); + // Rows inside one viewport once the list is scrolled past the section + // header: the fixture opens with its nested issue→PR groups, so the count + // is taken for the densest run of consecutive rows (each row's top as the + // scroll position) rather than only the first screen. + const boxes = rows.map(row => row.getBoundingClientRect()); + let inView = 0; + for (let i = 0; i < boxes.length; i++) { + let n = 0; + for (let j = i; j < boxes.length && boxes[j].bottom - boxes[i].top <= innerHeight + tolerance; j++) n++; + inView = Math.max(inView, n); + } + assert(inView >= MIN_ROWS_IN_VIEW, 'at least ' + MIN_ROWS_IN_VIEW + ' rows inside one viewport past the header: ' + inView); + for (const [index, row] of rows.entries()) { + const bounds = row.getBoundingClientRect(); + // Lead actions and badges wrap onto their own line instead of being + // clipped by the clamp (tracker-phone-ergonomics covers the ☐ / ⋯ tools). + for (const badge of row.querySelectorAll(':scope > .ham-row-head .ham-badges > *')) { + if (!visible(badge)) continue; + const bb = badge.getBoundingClientRect(); + assert(bb.right <= bounds.right + tolerance && bb.bottom <= row.querySelector(':scope > .ham-row-head').getBoundingClientRect().bottom + tolerance, 'row ' + index + ' badge "' + badge.textContent.trim().slice(0, 24) + '" is visible inside the head'); + } + for (const title of row.querySelectorAll('.ham-title, .ham-pr-title')) { + if (!visible(title)) continue; + const tb = title.getBoundingClientRect(); + assert(tb.right <= bounds.right + tolerance && tb.left >= bounds.left - tolerance, 'row ' + index + ' title stays inside its row'); + } + assert(![...row.querySelectorAll(':scope > .ham-row-head .ham-no-issue-t')].some(visible), 'row ' + index + ' drops the "no linked issue" placeholder'); + const caption = row.querySelector(':scope > .ham-current-stage'); + if (visible(caption)) { + const lh = parseFloat(getComputedStyle(caption).lineHeight) || parseFloat(getComputedStyle(caption).fontSize) * 1.4; + assert(caption.getBoundingClientRect().height <= lh + tolerance, 'row ' + index + ' caption is one line'); + } + assert(row.scrollWidth <= row.clientWidth + tolerance, 'row ' + index + ' does not scroll sideways'); + } + // A clamped head exposes the full title through the pill sheet. + const clamped = rows.find(row => [...row.querySelectorAll(':scope > .ham-row-head :is(.ham-head-main, .ham-pr-ref)')].some(h => h.scrollHeight > h.clientHeight + tolerance) && row.querySelector(':scope > .ham-strip-row > .ham-pill')); + if (clamped) { + const pill = clamped.querySelector(':scope > .ham-strip-row > .ham-pill'); + const want = [...clamped.querySelectorAll(':scope > .ham-row-head .ham-title:not(.ham-no-issue-t), :scope > .ham-row-head .ham-pr-title')].map(n => n.textContent.trim()).filter(Boolean).join(' · '); + pill.click(); + await frame(); await frame(); + const sheet = document.querySelector('.hive-dialog-overlay .hive-dialog.modal-sheet.ham-pill-sheet'); + assert(!!sheet, 'pill opens the sheet for a clamped row'); + const full = sheet && sheet.querySelector('.ham-pill-sheet-title'); + assert(!!full && full.textContent.trim() === want, 'sheet carries the full title of a clamped head'); + if (sheet) { + (sheet.querySelector('.modal-sheet-close') || sheet.querySelector('.primary')).click(); + await frame(); await frame(); + } + } + const out = { viewport: innerWidth, phone: true, rows: rows.length, median: Math.round(median), inView, clampedChecked: !!clamped, failures }; + if (failures.length) throw new Error(JSON.stringify(out)); + return out; +}) diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js index 9bc1b61129..df78b7cc71 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-ergonomics.js @@ -31,16 +31,24 @@ const controls = [...section.querySelectorAll('button, a[href], input, select, summary, [role="button"], [role="menuitem"], [tabindex]:not([tabindex="-1"]):not(.ham-row):not(.ham-sub)')] .filter(el => visible(el) && !inlineText(el) && !stripCell(el)); // A compact control may extend its hit area with an absolutely positioned - // empty ::before (the progress pill, #17183): negative insets grow the tap - // target past the painted box. Positive insets (the ?/⚙ ring drawn inside - // the --tap-target square) never shrink it. Layout size, not the client - // rect, so a one-shot transform animation (.ham-pill-moved) cannot fail it. + // empty ::before or ::after (the progress pill, #17183; the inline repo + // chip and lead action on phone card rows, #17161): negative insets grow + // the tap target past the painted box. Positive insets (the ?/⚙ ring drawn + // inside the --tap-target square) never shrink it. Layout size, not the + // client rect, so a one-shot transform animation (.ham-pill-moved) cannot + // fail it. const hitRect = el => { const r = { width: el.offsetWidth || el.getBoundingClientRect().width, height: el.offsetHeight || el.getBoundingClientRect().height }; - const b = getComputedStyle(el, '::before'); - if (b.position !== 'absolute' || b.content !== '""' || getComputedStyle(el).position === 'static') return r; + if (getComputedStyle(el).position === 'static') return r; const grow = v => Math.max(0, -(parseFloat(v) || 0)); - return { width: r.width + grow(b.left) + grow(b.right), height: r.height + grow(b.top) + grow(b.bottom) }; + let out = r; + for (const pseudo of ['::before', '::after']) { + const b = getComputedStyle(el, pseudo); + if (b.position !== 'absolute' || b.content !== '""') continue; + const g = { width: r.width + grow(b.left) + grow(b.right), height: r.height + grow(b.top) + grow(b.bottom) }; + if (g.width >= out.width && g.height >= out.height) out = g; + } + return out; }; const small = []; for (const el of controls) { diff --git a/src/scripts/dashboard-mobile-shots.mjs b/src/scripts/dashboard-mobile-shots.mjs index 7abff7b18f..9d15695c68 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', 'tracker-phone-chrome', 'tracker-phone-pill', 'tracker-phone-ergonomics'].map(name => ({ + const probes = ['tracker-header-geometry', 'tracker-decision-interaction', 'tracker-phone-chrome', 'tracker-phone-pill', 'tracker-phone-ergonomics', 'tracker-phone-card'].map(name => ({ name, source: fs.readFileSync(path.join(fixtureRoot, name + '.js'), 'utf8'), })); // Phone tier (hivecommons/hive#17160): the chevron strip is hidden behind @@ -276,6 +276,8 @@ async function main() { 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 CARD_MAX_MEDIAN_ROW_PX = 96; + const CARD_MIN_ROWS_IN_VIEW = 6; 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', @@ -520,6 +522,11 @@ async function main() { 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'); } + // 390×844 acceptance for the card layout (hivecommons/hive#17161): + // median row ≤ 96px and ≥ 6 rows in view with the density fixture. + if (probe.name === 'tracker-phone-card' && vp.name === PILL_REQUIRED_VIEWPORT && !(result.ok && result.result && result.result.phone === true && result.result.median <= CARD_MAX_MEDIAN_ROW_PX && result.result.inView >= CARD_MIN_ROWS_IN_VIEW)) { + activityFailures.push(vp.name + ' ' + theme + ' card rows must have median height ≤ ' + CARD_MAX_MEDIAN_ROW_PX + 'px with ≥ ' + CARD_MIN_ROWS_IN_VIEW + ' rows in view at 390x844'); + } } let native; if (phone) native = { skipped: 'phone tier: decision trigger lives in the pill sheet', failures: [] }; From 6532b1cc3baa5cd70c0d68e34b10bd99cc8678b1 Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Sat, 7 Nov 2026 21:10:32 -0700 Subject: [PATCH 2/2] dashboard: phone card probe scales its rows-in-view floor to landscape heights Signed-off-by: Andrew Anderson --- src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js b/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js index dc243d4d13..f1fc3db854 100644 --- a/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js +++ b/src/pkg/dashboard/webstatic/testdata/tracker-phone-card.js @@ -10,7 +10,10 @@ if (!dedicatedPreview) throw new Error('Use a dedicated published-preview tab, not the user’s live dashboard'); const tolerance = 1; const MAX_MEDIAN_ROW_HEIGHT = 96; - const MIN_ROWS_IN_VIEW = 6; + // #17161 asks for six rows on a 844px-tall portrait phone; landscape phones + // (375 / 360px tall) get the same floor scaled to their height. + const PORTRAIT_HEIGHT = 844; + const MIN_ROWS_IN_VIEW = Math.max(1, Math.floor(6 * Math.min(1, innerHeight / PORTRAIT_HEIGHT))); const failures = []; const assert = (ok, message) => { if (!ok) failures.push(message); }; const frame = () => new Promise(requestAnimationFrame); @@ -35,7 +38,7 @@ for (let j = i; j < boxes.length && boxes[j].bottom - boxes[i].top <= innerHeight + tolerance; j++) n++; inView = Math.max(inView, n); } - assert(inView >= MIN_ROWS_IN_VIEW, 'at least ' + MIN_ROWS_IN_VIEW + ' rows inside one viewport past the header: ' + inView); + assert(inView >= MIN_ROWS_IN_VIEW, 'at least ' + MIN_ROWS_IN_VIEW + ' rows inside one ' + innerHeight + 'px viewport past the header: ' + inView); for (const [index, row] of rows.entries()) { const bounds = row.getBoundingClientRect(); // Lead actions and badges wrap onto their own line instead of being