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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fixed-merge-bee-odometer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Dashboard: the merge celebration bee is drawn at `--fs-3xl` (β‰ˆ32 px, was β‰ˆ17 px) with a theme-aware halo so it reads on dark and light panels, and the Activity Monitor's Merged counter now rolls visibly like an odometer β€” the rightmost wheel (and any wheel right of the changed digit) spins a full turn on every increase, the day/week counts roll with the same mechanism, the day/week line no longer disappears mid-roll on the dark theme, and a reload rolls up from the values the tab showed before.
65 changes: 55 additions & 10 deletions src/pkg/dashboard/stage_tracker_cues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ func TestStageTrackerCuesWiring(t *testing.T) {
`@media (prefers-reduced-motion: reduce) { .cue-working .ham-seg.active .ham-active-ico, .cue-spin, .cue-acting .ham-seg.active, .cue-event { animation: none; } }`,
`@media (prefers-reduced-motion: reduce) { .cue-flight { animation-name: cue-flight-fade; }`,
`id="activity-monitor-merged"`, `class="ham-merged-n"`, `class="ham-merged-sub"`,
// The merge glyph is sized and haloed through tokens, not a literal
// (hivecommons/hive#15398: at --fs-lg the operator could not tell
// what the bee was).
`:root { --cue-flight-size: var(--fs-3xl); --cue-flight-halo: drop-shadow(`,
`.cue-flight { position: fixed; z-index: var(--z-cue-flight); font-size: var(--cue-flight-size); line-height: 1; color: var(--amber); font-weight: var(--fw-semibold); filter: var(--cue-flight-halo);`,
`.ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums;`,
// The chip and the column header strip stick under the navbar
// while the list scrolls (hivecommons/hive#15096: the chip sat
// 2,300 px above the operator's viewport when the merge played).
Expand Down Expand Up @@ -254,6 +260,10 @@ func stageTrackerCelebrateJS(t *testing.T, html string) string {
jsConstLine(t, html, "STAGE_TRACKER_CELEBRATE_STAGGER_MS"),
jsConstLine(t, html, "STAGE_TRACKER_CELEBRATE_FLY_MS"),
jsConstLine(t, html, "STAGE_TRACKER_ODOMETER_MS"),
jsConstLine(t, html, "STAGE_TRACKER_ODOMETER_SUB_MS"),
jsConstLine(t, html, "STAGE_TRACKER_ODOMETER_TURN"),
jsConstLine(t, html, "STAGE_TRACKER_CELEBRATE_GLYPH_HALF"),
jsConstLine(t, html, "STAGE_TRACKER_MERGED_LAST_KEY"),
jsConstLine(t, html, "STAGE_TRACKER_CELEBRATE_MAX_FLIGHTS"),
jsConstLine(t, html, "STAGE_TRACKER_CELEBRATE_EXIT_PAD"),
jsConstLine(t, html, "STAGE_TRACKER_MERGE_BANNER_MS"),
Expand All @@ -276,6 +286,10 @@ func stageTrackerCelebrateJS(t *testing.T, html string) string {
jsFunc(t, html, "stageTrackerMergedHoldback"),
jsFunc(t, html, "stageTrackerOdometerPlan"),
jsFunc(t, html, "stageTrackerOdometerSet"),
jsFunc(t, html, "stageTrackerOdometerSeed"),
jsFunc(t, html, "stageTrackerMergedLastParse"),
jsFunc(t, html, "stageTrackerMergedLastLoad"),
jsFunc(t, html, "stageTrackerMergedLastSave"),
jsFunc(t, html, "stageTrackerMergedCountDraw"),
jsFunc(t, html, "stageTrackerMergedPopDraw"),
jsFunc(t, html, "hamMergedToggle"),
Expand Down Expand Up @@ -355,6 +369,7 @@ const pop = el('div', { id: 'activity-monitor-merged-pop' }); pop.hidden = true;
const byId = { 'activity-monitor-panel': panel, 'activity-monitor-merged': chip, 'activity-monitor-merged-pop': pop, 'merge-banners': banners, 'activity-monitor-merged-live': live };
global.document = { body, hidden: false, getElementById(id) { return byId[id] || null; }, createElement(tag) { if (tag === 'template') { const tpl = el('template'); Object.defineProperty(tpl, 'innerHTML', { set(v) { const c = el('p'); c.classList.add('cue-event'); c.attrs['data-cue-key'] = (v.match(/data-cue-key="([^"]*)"/) || [])[1]; c.textContent = v.replace(/<[^>]+>/g, ''); const age = el('span'); age.classList.add('cue-event-age'); age.attrs['data-at'] = (v.match(/data-at="(\d+)"/) || [])[1]; c.appendChild(age); tpl.content = { firstElementChild: c }; } }); return tpl; } return el(tag); } };
const store = {}; global.localStorage = { getItem: k => (k in store ? store[k] : null), setItem(k, v) { store[k] = String(v); } };
const session = {}; global.sessionStorage = { getItem: k => (k in session ? session[k] : null), setItem(k, v) { session[k] = String(v); } };
let reduced = false; function stageTrackerReducedMotion() { return reduced; }
let soundOn = true; function stageTrackerSoundGate() { return soundOn; }
const zaps = []; function stageTrackerPlayZap(c) { zaps.push(c); }
Expand Down Expand Up @@ -611,12 +626,18 @@ console.log('ok');
func TestStageTrackerOdometerNode(t *testing.T) {
html := indexHTML(t)
runStageTrackerRowActionsScript(t, stageTrackerCelebrateJS(t, html)+stageTrackerCelebrateFixture+`
// The plan: only the digits that rose roll, carries wrap past 9, a new
// leading digit comes in from a blank, falls and foreign text sit still.
assert.deepStrictEqual(stageTrackerOdometerPlan('9127', '9128'), [{ text: '9' }, { text: '1' }, { text: '2' }, { steps: ['7', '8'] }]);
assert.deepStrictEqual(stageTrackerOdometerPlan('199', '200'), [{ steps: ['1', '2'] }, { steps: ['9', '0'] }, { steps: ['9', '0'] }], 'a carry wraps');
assert.deepStrictEqual(stageTrackerOdometerPlan('7', '12'), [{ steps: [' ', '1'] }, { steps: ['7', '8', '9', '0', '1', '2'] }], 'a grown number rolls its new column in from a blank');
assert.deepStrictEqual(stageTrackerOdometerPlan('201 today Β· 730 this week', '0 today Β· 731 this week'), [{ text: '0' }, { text: ' today Β· ' }, { text: '7' }, { text: '3' }, { steps: ['0', '1'] }, { text: ' this week' }], 'the day rollover sets today and rolls the week');
// The plan: only the digits that rose roll; the first changed wheel rolls
// its own distance, every wheel right of it β€” and the rightmost wheel
// always β€” spins a full turn first (hivecommons/hive#15398: a one-cell
// nudge was invisible); carries wrap past 9, a new leading digit comes in
// from a blank, falls and foreign text sit still.
const turn = (from, to) => { const out = [from]; let d = Number(from); do { d = (d + 1) % 10; out.push(String(d)); } while (d !== Number(to) || out.length <= STAGE_TRACKER_ODOMETER_TURN); return out; };
assert.deepStrictEqual(turn('7', '8'), ['7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8'], 'a +1 on the last wheel is a full turn and one');
assert.deepStrictEqual(stageTrackerOdometerPlan('9127', '9128'), [{ text: '9' }, { text: '1' }, { text: '2' }, { steps: turn('7', '8') }]);
assert.deepStrictEqual(stageTrackerOdometerPlan('199', '200'), [{ steps: ['1', '2'] }, { steps: turn('9', '0') }, { steps: turn('9', '0') }], 'a carry: the first wheel steps once, the zeros whirr past');
assert.deepStrictEqual(stageTrackerOdometerPlan('9471', '9481'), [{ text: '9' }, { text: '4' }, { steps: ['7', '8'] }, { steps: turn('1', '1') }], 'an unchanged wheel right of the change still spins round once');
assert.deepStrictEqual(stageTrackerOdometerPlan('7', '12'), [{ steps: [' ', '1'] }, { steps: turn('7', '2') }], 'a grown number rolls its new column in from a blank');
assert.deepStrictEqual(stageTrackerOdometerPlan('201 today Β· 730 this week', '0 today Β· 731 this week'), [{ text: '0' }, { text: ' today Β· ' }, { text: '7' }, { text: '3' }, { steps: turn('0', '1') }, { text: ' this week' }], 'the day rollover sets today and rolls the week');
assert.strictEqual(stageTrackerOdometerPlan('5', '5'), null, 'no change, no roll');
assert.strictEqual(stageTrackerOdometerPlan('5', '4'), null, 'a fall never rolls');
assert.strictEqual(stageTrackerOdometerPlan('1 today', '2 this week'), null, 'different words: no roll');
Expand All @@ -634,20 +655,35 @@ assert.strictEqual(odo.children.length, 1); const wrap = odo.children[0];
assert.strictEqual(wrap.className, 'ham-odo ham-odo-run'); assert.strictEqual(wrap.getAttribute('aria-hidden'), 'true');
assert.deepStrictEqual(wrap.children.map(c => c.className), ['ham-odo-static', 'ham-odo-static', 'ham-odo-static', 'ham-odo-col']);
const strip = wrap.children[3].children[0];
assert.deepStrictEqual(strip.children.map(c => c.textContent), ['7', '8']); assert.strictEqual(strip.style.props['--odo-shift'], '-50.000%');
assert.deepStrictEqual(strip.children.map(c => c.textContent), turn('7', '8')); assert.strictEqual(strip.style.props['--odo-shift'], (-(turn('7', '8').length - 1) * 100 / turn('7', '8').length).toFixed(3) + '%');
assert.strictEqual(wrap.style.props['--odo-ms'], STAGE_TRACKER_ODOMETER_MS + 'ms');
assert.strictEqual(odo.children.length, 1, 'the element itself is kept: only an overlay was added');
tick(STAGE_TRACKER_ODOMETER_MS + 100);
assert.strictEqual(odo.children.length, 0, 'the overlay is gone'); assert.ok(!odo.classList.contains('ham-odo-rolling')); assert.strictEqual(odo.textContent, '9128');
// A second rise mid-roll restarts from the last value written.
stageTrackerOdometerSet(odo, 9129); assert.strictEqual(odo.children.length, 1);
stageTrackerOdometerSet(odo, 9131); assert.strictEqual(odo.children.length, 1, 'one overlay at a time');
assert.deepStrictEqual(odo.children[0].children[2].children[0].children.map(c => c.textContent), ['2', '3'], 'tens: 2 β†’ 3');
assert.deepStrictEqual(odo.children[0].children[3].children[0].children.map(c => c.textContent), ['9', '0', '1'], 'units: from the 9 last written');
assert.deepStrictEqual(odo.children[0].children[3].children[0].children.map(c => c.textContent), turn('9', '1'), 'units: from the 9 last written');
tick(STAGE_TRACKER_ODOMETER_MS + 100); assert.strictEqual(odo.children.length, 0);
assert.strictEqual(stageTrackerOdometerSet(odo, 3), false, 'a fall just sets'); assert.strictEqual(odo.textContent, '3'); assert.strictEqual(odo.children.length, 0);
reduced = true;
assert.strictEqual(stageTrackerOdometerSet(odo, 4), false, 'reduced motion: no roll'); assert.strictEqual(odo.textContent, '4'); assert.strictEqual(odo.children.length, 0);
reduced = false;
// A shorter roll for the day/week line: the duration is the caller's.
const odo2 = el('span'); stageTrackerOdometerSet(odo2, '1 today'); stageTrackerOdometerSet(odo2, '2 today', STAGE_TRACKER_ODOMETER_SUB_MS);
assert.strictEqual(odo2.children[0].style.props['--odo-ms'], STAGE_TRACKER_ODOMETER_SUB_MS + 'ms'); tick(STAGE_TRACKER_ODOMETER_SUB_MS + 100); assert.strictEqual(odo2.children.length, 0);
// The session seed: an unwritten element takes the value it showed last
// time only when the new value would roll from it.
const odo3 = el('span');
assert.strictEqual(stageTrackerOdometerSeed(odo3, '9471', 9472), true); assert.strictEqual(odo3.getAttribute('data-odo-value'), '9471');
assert.strictEqual(stageTrackerOdometerSet(odo3, 9472), true, 'the first real write rolls up from the seed');
assert.strictEqual(stageTrackerOdometerSeed(odo3, '1', 2), false, 'a written element is never re-seeded');
const odo4 = el('span');
assert.strictEqual(stageTrackerOdometerSeed(odo4, '9480', 9472), false, 'a seed ahead of the value is dropped'); assert.strictEqual(odo4.getAttribute('data-odo-value'), null);
assert.strictEqual(stageTrackerOdometerSeed(odo4, null, 9472), false, 'no seed');
assert.deepStrictEqual(stageTrackerMergedLastParse('{"n":"9471","sub":"73 today Β· 886 this week"}'), { n: '9471', sub: '73 today Β· 886 this week' });
assert.strictEqual(stageTrackerMergedLastParse('{"n":"x"}'), null); assert.strictEqual(stageTrackerMergedLastParse('nope'), null); assert.strictEqual(stageTrackerMergedLastParse(''), null);
// Through the chip: the landing rolls both numbers; a redraw with the same
// values does not restart the roll.
panel.appendChild(row('o/r/pr#1'));
Expand All @@ -660,6 +696,15 @@ stageTrackerMergedCountDraw(false);
assert.strictEqual(n.children.length, 1, 'a redraw mid-roll keeps the overlay');
tick(STAGE_TRACKER_ODOMETER_MS + 100);
assert.strictEqual(n.children.length, 0); assert.strictEqual(sub.children.length, 0);
assert.deepStrictEqual(stageTrackerMergedLastParse(session[STAGE_TRACKER_MERGED_LAST_KEY]), { n: '1', sub: '1 today Β· 1 this week' }, 'the values shown are remembered for the next load');
// A fresh page (new chip, remembered values behind the server's) rolls up
// from them on its first draw instead of just appearing.
session[STAGE_TRACKER_MERGED_LAST_KEY] = JSON.stringify({ n: '0', sub: '0 today Β· 0 this week' });
const chip2 = el('button', { id: 'activity-monitor-merged' }); const n2 = el('span'); n2.classList.add('ham-merged-n'); const sub2 = el('span'); sub2.classList.add('ham-merged-sub'); chip2.appendChild(n2); chip2.appendChild(sub2);
chip.remove(); body.appendChild(chip2); byId['activity-monitor-merged'] = chip2; stageTrackerMergedChip.node = null;
stageTrackerMergedCountDraw(false);
assert.strictEqual(n2.textContent, '1'); assert.strictEqual(n2.children.length, 1, 'first draw rolls up from the remembered value'); assert.strictEqual(sub2.children.length, 1);
tick(STAGE_TRACKER_ODOMETER_MS + 100); assert.strictEqual(n2.children.length, 0);
`)
}

Expand Down Expand Up @@ -693,7 +738,7 @@ tick(0);
assert.strictEqual(flights().length, 1); const g = flights()[0];
assert.strictEqual(g.textContent, '+1', 'the chosen glyph');
assert.strictEqual(g.style.props['--cue-dx'], '0px'); assert.strictEqual(g.style.props['--cue-dy'], -(410 + STAGE_TRACKER_CELEBRATE_EXIT_PAD) + 'px'); assert.strictEqual(g.style.props['--cue-end-opacity'], '1');
assert.strictEqual(g.style.props['left'], '300px'); assert.strictEqual(g.style.props['top'], '400px', 'spawned at the βœ“ cell');
assert.strictEqual(g.style.props['left'], (310 - STAGE_TRACKER_CELEBRATE_GLYPH_HALF) + 'px'); assert.strictEqual(g.style.props['top'], (410 - STAGE_TRACKER_CELEBRATE_GLYPH_HALF) + 'px', 'spawned centred on the βœ“ cell');
assert.strictEqual(g.attrs['aria-hidden'], 'true');
tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1);
assert.strictEqual(n.textContent, '1', 'the count bumps although the glyph left the screen');
Expand All @@ -708,7 +753,7 @@ const r = stageTrackerTestCelebration();
assert.strictEqual(settingsClosed, 1, 'the dialog closes first');
assert.deepStrictEqual(r, { flew: true, lands: true, faded: false }, JSON.stringify(toasts));
assert.ok(inView.classList.contains('cue-merged') && !above.classList.contains('cue-merged'), 'the row in view is the one that glows');
assert.strictEqual(flights().length, 1); assert.strictEqual(flights()[0].style.props['top'], (410 - 10) + 'px', 'from the visible row\'s βœ“ cell');
assert.strictEqual(flights().length, 1); assert.strictEqual(flights()[0].style.props['top'], (410 - STAGE_TRACKER_CELEBRATE_GLYPH_HALF) + 'px', 'from the visible row\'s βœ“ cell');
assert.strictEqual(banners.children.length, 1); assert.ok(banners.children[0].innerHTML.includes('(test)'), banners.children[0].innerHTML);
tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1);
assert.strictEqual(n.textContent, '1', 'the test does not count'); assert.ok(chip.classList.contains('cue-tick'), 'but pops'); assert.deepStrictEqual(zaps, [1], 'and zaps');
Expand Down
20 changes: 16 additions & 4 deletions src/pkg/dashboard/static-src/css/tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
stack fell back to z-index:auto and the chat FAB (9000) covered the
lowest toast's close Γ— and text. Above the FAB and the modal chrome. */
:root { --z-cue-flight: 10000; --z-merge-banner: 10001; }
/* The merge glyph's size (hivecommons/hive#15398: at --fs-lg the bee
was "so small i can't see what it is") and the halo that lifts an
emoji off either theme's panel: a soft shadow in the text colour, so
it is a light glow on dark and a dark shadow on light. */
:root { --cue-flight-size: var(--fs-3xl); --cue-flight-halo: drop-shadow(0 0 2px color-mix(in srgb, var(--text) 45%, transparent)) drop-shadow(0 1px 2px color-mix(in srgb, var(--surface-0) 40%, transparent)); }
.ham-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); margin-bottom: var(--sp-5); font-size: var(--fs-sm); color: var(--muted); }
.ham-toolbar label { display: inline-flex; align-items: center; gap: var(--sp-2); }
.ham-repo-filter { position: static; flex: 0 1 auto; gap: 0; min-width: 0; white-space: nowrap; }
Expand Down Expand Up @@ -377,24 +382,31 @@
the overlay goes and the plain text shows. Static characters and
digits that fell (the day rollover) just sit. The text underneath is
the real width (tabular-nums), so the pill never jiggles; reduced
motion or the first draw sets the text outright. */
motion or the first draw sets the text outright.
Owner (2026-10-29, issue 15398): the glyph is drawn at
--cue-flight-size with --cue-flight-halo (see the tokens above), and
the rightmost wheel spins a full turn (a longer strip, same
transition) so a +1 reads as a roll, not a nudge. */
.cue-merged .ham-seg.cap { color: var(--amber); animation: cue-cap-glow 1.6s ease-out both; }
.cue-merged { background: color-mix(in srgb, var(--amber) 8%, transparent); transition: background 300ms ease; }
.cue-flight { position: fixed; z-index: var(--z-cue-flight); font-size: var(--fs-lg); line-height: 1; color: var(--amber); font-weight: var(--fw-semibold); pointer-events: none; user-select: none; animation: cue-flight var(--cue-fly-ms, 2000ms) cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.cue-flight { position: fixed; z-index: var(--z-cue-flight); font-size: var(--cue-flight-size); line-height: 1; color: var(--amber); font-weight: var(--fw-semibold); filter: var(--cue-flight-halo); pointer-events: none; user-select: none; animation: cue-flight var(--cue-fly-ms, 2000ms) cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.cue-flight.cue-flight-fade { animation: cue-flight-fade var(--cue-fly-ms, 2000ms) ease-out both; }
.ham-sticky { position: sticky; top: var(--navbar-sticky-height); z-index: calc(var(--z-sticky) + 1); display: flex; justify-content: flex-end; align-items: center; min-height: var(--ham-sticky-bar-h); box-sizing: border-box; padding: var(--sp-1) var(--sp-2); background: var(--panel); }
.ham-sticky-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ham-merged-count { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); cursor: pointer; }
.ham-merged-count:hover { border-color: var(--line-strong); }
.ham-merged-count .ham-merged-ico { width: 12px; height: 12px; color: var(--amber); }
.ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.ham-merged-count .ham-merged-sub { color: var(--text-faint); font-variant-numeric: tabular-nums; padding-left: var(--sp-2); border-left: var(--line-width) solid var(--line-subtle); }
.ham-merged-count .ham-merged-sub { color: var(--text-faint, var(--muted)); font-variant-numeric: tabular-nums; padding-left: var(--sp-2); border-left: var(--line-width) solid var(--line-subtle); }
.ham-merged-count.cue-tick { animation: cue-count-pop 320ms ease-out; }
.ham-merged-count .ham-merged-n, .ham-merged-count .ham-merged-sub { position: relative; }
.ham-merged-count .ham-odo-rolling { color: transparent; }
.ham-odo { position: absolute; inset: 0; display: flex; align-items: center; overflow: hidden; white-space: pre; pointer-events: none; }
.ham-merged-count .ham-merged-n .ham-odo { color: var(--text); }
.ham-merged-count .ham-merged-sub .ham-odo { left: var(--sp-2); color: var(--text-faint); }
/* The dark theme's token sheet has no --text-faint (only body.light-mode
sets it), so without a fallback the overlay inherited the rolling
line's transparent colour and the day/week counts vanished mid-roll. */
.ham-merged-count .ham-merged-sub .ham-odo { left: var(--sp-2); color: var(--text-faint, var(--muted)); }
.ham-odo-static, .ham-odo-col, .ham-odo-d { display: block; height: 1.25em; line-height: 1.25; }
.ham-odo-col { overflow: hidden; }
.ham-odo-strip { display: block; transform: translateY(0); transition: transform var(--odo-ms, 900ms) cubic-bezier(0.22, 0.61, 0.36, 1); }
Expand Down
Loading
Loading