diff --git a/changelog.d/added-activity-monitor-landscape-phone.md b/changelog.d/added-activity-monitor-landscape-phone.md new file mode 100644 index 0000000000..7f62ac197c --- /dev/null +++ b/changelog.d/added-activity-monitor-landscape-phone.md @@ -0,0 +1 @@ +- The Hive activity monitor on a landscape phone (β€500px tall, coarse pointer) uses the compact filter bar, hides the column header so the sticky stack is a single bar, and shows at most one merge banner, so rows are visible instead of chrome; portrait and desktop are unchanged (#17166, part of #17158). diff --git a/src/docs/dashboard-sections/activity-monitor.md b/src/docs/dashboard-sections/activity-monitor.md index 79dd05318f..b2acc1c2c3 100644 --- a/src/docs/dashboard-sections/activity-monitor.md +++ b/src/docs/dashboard-sections/activity-monitor.md @@ -123,7 +123,7 @@ 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. +**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). **On a landscape phone** (coarse pointer, β€1024px wide and β€500px tall) the same compact bar is used, the column header is hidden so the sticky stack is the bar alone, and merge banners are capped to one with a *+N more* pill. 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. diff --git a/src/pkg/dashboard/stage_tracker_cues_test.go b/src/pkg/dashboard/stage_tracker_cues_test.go index b0fd6c99b2..025fc98159 100644 --- a/src/pkg/dashboard/stage_tracker_cues_test.go +++ b/src/pkg/dashboard/stage_tracker_cues_test.go @@ -323,6 +323,8 @@ func stageTrackerCelebrateJS(t *testing.T, html string) string { jsConstLine(t, html, "STAGE_TRACKER_MERGE_BANNER_MAX"), jsConstLine(t, html, "STAGE_TRACKER_MERGE_BANNER_PHONE_MAX"), jsConstLine(t, html, "STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY"), + jsConstLine(t, html, "STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_MAX"), + jsConstLine(t, html, "STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY"), jsConstLine(t, html, "STAGE_TRACKER_SOUND_MAX_PLAYS"), jsFunc(t, html, "stageTrackerCelebrateSetting"), jsFunc(t, html, "stageTrackerSetCelebrate"), @@ -378,7 +380,9 @@ func stageTrackerCelebrateJS(t *testing.T, html string) string { jsFunc(t, html, "toastCountdownCancel"), jsFunc(t, html, "stageTrackerMergeBanner"), jsFunc(t, html, "stageTrackerMergeBannerList"), + jsFunc(t, html, "stageTrackerMergeBannerMatches"), jsFunc(t, html, "stageTrackerMergeBannerIsPhone"), + jsFunc(t, html, "stageTrackerMergeBannerCap"), jsFunc(t, html, "stageTrackerMergeBannerLayout"), jsFunc(t, html, "stageTrackerMergeBannerDismiss"), jsFunc(t, html, "hamBannerOpenLink"), @@ -727,6 +731,10 @@ stageTrackerMergeBannerDismiss(phone[4]); tick(180 * 1.5 + 1); assert.strictEqual(shown().length, STAGE_TRACKER_MERGE_BANNER_PHONE_MAX, 'a dismissal reveals the next oldest'); assert.strictEqual(banners.querySelector('.merge-banner-more').textContent, '+1 more'); stageTrackerMergeBannerDismiss(phone[3]); tick(180 * 1.5 + 1); assert.strictEqual(hid().length, 0); assert.strictEqual(banners.querySelector('.merge-banner-more'), null, 'no pill once everything fits'); +// Landscape phone: one banner at a time, the rest behind the pill. +window.matchMedia = q => ({ matches: q === STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY }); +stageTrackerMergeBannerLayout(banners); +assert.strictEqual(shown().length, STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_MAX, 'a landscape phone shows one banner'); assert.strictEqual(banners.querySelector('.merge-banner-more').textContent, '+2 more'); delete window.matchMedia; stageTrackerMergeBannerLayout(banners); assert.strictEqual(hid().length, 0, 'a desktop hides nothing'); console.log('ok'); diff --git a/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js b/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js index 1764060427..4d353b1350 100644 --- a/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js +++ b/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js @@ -67,6 +67,8 @@ const src = [ pick(/const STAGE_TRACKER_MERGE_BANNER_MAX = [^\n]*\n/, 'STAGE_TRACKER_MERGE_BANNER_MAX'), pick(/const STAGE_TRACKER_MERGE_BANNER_PHONE_MAX = [^\n]*\n/, 'STAGE_TRACKER_MERGE_BANNER_PHONE_MAX'), pick(/const STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY = [^\n]*\n/, 'STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY'), + pick(/const STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_MAX = [^\n]*\n/, 'STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_MAX'), + pick(/const STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY = [^\n]*\n/, 'STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY'), pick(/function toastCountdownBar\(el, ms, onExpire\) \{[\s\S]*?\n \}\n/, 'toastCountdownBar'), pick(/function toastCountdownCancel\(el\) \{[\s\S]*?\n \}\n/, 'toastCountdownCancel'), pick(/function stageTrackerMergeBannerNumber\(b\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerNumber'), @@ -82,6 +84,8 @@ const src = [ pick(/function stageTrackerMergeBannerText\(b, nowMs\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerText'), pick(/function stageTrackerMergeBanner\(b\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBanner'), pick(/function stageTrackerMergeBannerList\(box\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerList'), + pick(/function stageTrackerMergeBannerMatches\(query\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerMatches'), + pick(/function stageTrackerMergeBannerCap\(\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerCap'), pick(/function stageTrackerMergeBannerIsPhone\(\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerIsPhone'), pick(/function stageTrackerMergeBannerLayout\(box\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerLayout'), pick(/function stageTrackerMergeBannerDismiss\(el\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerDismiss'), diff --git a/src/pkg/dashboard/static-src/css/responsive.css b/src/pkg/dashboard/static-src/css/responsive.css index 843619c00f..a295a1fb0b 100644 --- a/src/pkg/dashboard/static-src/css/responsive.css +++ b/src/pkg/dashboard/static-src/css/responsive.css @@ -758,6 +758,27 @@ textarea { font-size: var(--fs-touch) !important; } + /* Activity monitor on a landscape phone (#17166): ~390px of height. + The toolbar and label chips collapse into the compact filter bar + exactly as on a portrait phone (#17159), the column header hides + so the sticky stack is the bar alone (β€100px); the notch is + already honoured by this tier's body padding. 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; } + #activity-monitor-section .dash-card-body { overflow: clip; } + #activity-monitor-panel .ham-cols { display: none; } + .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); } } /* Touch phones use one full-screen chat layout in either orientation. Desktop docking/resizing controls do not apply to this layout. */ diff --git a/src/pkg/dashboard/static-src/js/tracker-merged.js b/src/pkg/dashboard/static-src/js/tracker-merged.js index 55a3b498bb..22490ef178 100644 --- a/src/pkg/dashboard/static-src/js/tracker-merged.js +++ b/src/pkg/dashboard/static-src/js/tracker-merged.js @@ -392,6 +392,10 @@ // are visible at once; the older ones wait behind a "+N more" pill. const STAGE_TRACKER_MERGE_BANNER_PHONE_MAX = 3; const STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY = '(max-width: 480px)'; + // A landscape phone (responsive.css's landscape tier) has ~390px of + // height; one banner at a time, the rest behind the pill (#17166). + const STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_MAX = 1; + const STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY = '(max-width: 1024px) and (max-height: 500px) and (orientation: landscape) and (pointer: coarse)'; function stageTrackerCelebrateSetting() { try { return localStorage.getItem(STAGE_TRACKER_CELEBRATE_KEY) !== '0'; } catch { return true; } } @@ -1231,14 +1235,25 @@ function stageTrackerMergeBannerList(box) { return Array.prototype.filter.call(box.children, c => c.classList && c.classList.contains('merge-banner')); } + function stageTrackerMergeBannerMatches(query) { + return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && !!window.matchMedia(query).matches; + } function stageTrackerMergeBannerIsPhone() { - return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && !!window.matchMedia(STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY).matches; + return stageTrackerMergeBannerMatches(STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY); + } + // Pure: how many banners may show at once for the current viewport. + function stageTrackerMergeBannerCap() { + if (stageTrackerMergeBannerMatches(STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY)) return STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_MAX; + if (stageTrackerMergeBannerIsPhone()) return STAGE_TRACKER_MERGE_BANNER_PHONE_MAX; + return Infinity; } - // Crossing the phone breakpoint (a rotation, a resized window) re-lays - // the stack so hidden banners come back or the pill appears. + // Crossing the phone or landscape breakpoint (a rotation, a resized + // window) re-lays the stack so hidden banners come back or the pill appears. if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') { - const mq = window.matchMedia(STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY); - if (mq && typeof mq.addEventListener === 'function') mq.addEventListener('change', () => stageTrackerMergeBannerLayout(document.getElementById('merge-banners'))); + for (const query of [STAGE_TRACKER_MERGE_BANNER_PHONE_QUERY, STAGE_TRACKER_MERGE_BANNER_LANDSCAPE_QUERY]) { + const mq = window.matchMedia(query); + if (mq && typeof mq.addEventListener === 'function') mq.addEventListener('change', () => stageTrackerMergeBannerLayout(document.getElementById('merge-banners'))); + } } // Pure-ish: on a phone keep the newest PHONE_MAX banners visible and hide // the older ones behind a "+N more" pill (which opens the Merged list); @@ -1247,7 +1262,7 @@ function stageTrackerMergeBannerLayout(box) { if (!box) return; const banners = stageTrackerMergeBannerList(box); - const cap = stageTrackerMergeBannerIsPhone() ? STAGE_TRACKER_MERGE_BANNER_PHONE_MAX : Infinity; + const cap = stageTrackerMergeBannerCap(); const hiddenCount = Math.max(0, banners.length - cap); banners.forEach((el, i) => { if (i < hiddenCount) el.setAttribute('hidden', ''); else el.removeAttribute('hidden'); }); let more = box.querySelector('.merge-banner-more'); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 3d5bea1c5c..235d9e903a 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -6593,6 +6593,27 @@ textarea { font-size: var(--fs-touch) !important; } + /* Activity monitor on a landscape phone (#17166): ~390px of height. + The toolbar and label chips collapse into the compact filter bar + exactly as on a portrait phone (#17159), the column header hides + so the sticky stack is the bar alone (β€100px); the notch is + already honoured by this tier's body padding. 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; } + #activity-monitor-section .dash-card-body { overflow: clip; } + #activity-monitor-panel .ham-cols { display: none; } + .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); } } /* Touch phones use one full-screen chat layout in either orientation. Desktop docking/resizing controls do not apply to this layout. */ @@ -25656,6 +25677,10 @@