Skip to content

Commit 2468735

Browse files
thingnoyclaude
andcommitted
feat(report): show diff count badge on Diff button
Red count badge next to the Diff toggle in the topbar whenever the current view has one or more screens with a collected *-actual.png. Visible even when diff mode is off, so regressions are obvious without toggling in first. Badge inverts to white-on-accent when diff mode is active. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 25abd85 commit 2468735

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.7.4 (2026-04-13)
4+
5+
### Added
6+
- **report**: Diff button in the topbar now shows a red badge with the count of changed screens for the current view (e.g. `Diff 3`). Even when diff mode is off, the badge is visible as soon as any `*-actual.png` is present — so you can tell at a glance that the current run has regressions without toggling the mode. Badge swaps to white-on-blue when diff mode is active.
7+
38
## 0.7.3 (2026-04-13)
49

510
### Added

‎src/report-ui/dev-mock.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@ export const mockData: FlowshotData = {
5353
'expected:cart:desktop': colored('Cart D', 30),
5454
'expected:payment:desktop': colored('Payment D', 60),
5555
'expected:success:desktop': colored('Success D', 120),
56-
// one diff to exercise slider + lightbox
56+
// a few diffs to exercise slider, lightbox, and badge count
5757
'actual:login:mobile': colored('Login Actual', 0),
5858
'diff:login:mobile': colored('Diff', 340),
59+
'actual:cart:mobile': colored('Cart Actual', 10),
60+
'diff:cart:mobile': colored('Diff', 350),
61+
'actual:home:desktop': colored('Home D Actual', 200),
62+
'diff:home:desktop': colored('Diff', 20),
5963
'expected:header-component:component': blank,
6064
'expected:footer-component:component': blank,
6165
},

‎src/report-ui/lib/TopBar.svelte‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414
{/each}
1515
<span class="sep">|</span>
1616
<button
17-
class="toggle-btn"
17+
class="toggle-btn diff-btn"
1818
class:active={appState.diffMode}
19+
class:has-changes={appState.diffCounts.changed > 0}
1920
onclick={() => appState.toggleDiff()}
2021
>
2122
Diff
23+
{#if appState.diffCounts.changed > 0}
24+
<span class="diff-count">{appState.diffCounts.changed}</span>
25+
{/if}
2226
</button>
2327
<span class="stats">
2428
{appState.stats.flows} flows / {appState.stats.screens} screens / {appState.stats.view}
@@ -38,6 +42,18 @@
3842
}
3943
.toggle-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
4044
.toggle-btn:hover:not(.active) { border-color: var(--accent); color: var(--accent); }
45+
.diff-btn {
46+
display: inline-flex; align-items: center; gap: 6px;
47+
padding-right: 10px;
48+
}
49+
.diff-btn.has-changes:not(.active) { border-color: #f85149; color: #f85149; }
50+
.diff-count {
51+
display: inline-flex; align-items: center; justify-content: center;
52+
min-width: 18px; height: 18px; padding: 0 6px;
53+
background: #f85149; color: #fff;
54+
border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 1;
55+
}
56+
.diff-btn.active .diff-count { background: #fff; color: var(--accent); }
4157
.theme-btn {
4258
padding: 6px 12px; border: 2px solid var(--border); border-radius: 8px;
4359
background: var(--surface); font-size: 16px; cursor: pointer;

0 commit comments

Comments
 (0)