Skip to content

Redesign review-diff UI with toolbar buttons, sticky header, and file filter#1564

Open
sinelaw wants to merge 2 commits intomasterfrom
claude/improve-review-diff-ui-D1TaU
Open

Redesign review-diff UI with toolbar buttons, sticky header, and file filter#1564
sinelaw wants to merge 2 commits intomasterfrom
claude/improve-review-diff-ui-D1TaU

Conversation

@sinelaw
Copy link
Copy Markdown
Owner

@sinelaw sinelaw commented Apr 14, 2026

This PR overhauls the review-diff mode UI with several polished improvements:

Summary

Redesigns the review-diff interface with a bordered button toolbar, enhanced sticky header with [GIT] badge and change counts, full-width inline comment callout bars, multi-line comment cards in the comments panel, and a new / keyboard shortcut for filtering files by substring.

Key Changes

Toolbar Redesign

  • Replaced two-row hint-based toolbar with a three-row bordered design (top border / content / bottom border)
  • Converted hints to clickable button chips styled with half-block edges (▌ key ▐) and contrasting background
  • Added interactive filter field at the right side of the toolbar (▌/▐ filter)
  • Implemented mouse click dispatch for toolbar buttons via state.toolbarButtons hit-region tracking
  • New renderButton() function generates styled button chips with proper overlays and hit regions
  • New buildToolbarBorderRow() function creates rounded-corner border rows

Sticky Header Enhancement

  • Added [GIT] badge in warm accent color (STYLE_BADGE_FG) to identify the pinned file
  • Right-aligned change counts (+A / -R) with green/red foreground colors (STYLE_ADD_COUNT_FG / STYLE_REMOVE_COUNT_FG)
  • Improved layout with proper spacing and truncation handling
  • Adjusted sticky panel width calculation to account for the 75/25 split with comments panel

Comment Display Improvements

  • Inline comments now render as full-width callout bars with warning background and bold text
  • Changed glyph from » to (warning icon) for better visual semantics
  • Comments panel redesigned as multi-line cards: header row (file:line), body row (snippet), spacer row
  • Header row uses STYLE_BADGE_FG accent color for the file reference
  • Improved row-to-comment mapping to handle all three rows of each card

File Filtering

  • Added filter field to ReviewState for substring-based file filtering (case-insensitive)
  • New review_filter() command prompts user for filter text and rebuilds the display
  • Bound to / keyboard shortcut
  • Filters affect file list visibility, section counts, and sticky header simultaneously
  • Shows "No files match filter" message when filter matches nothing

Color and Style Additions

  • New STYLE_ACCENT constant for teal/cyan hunk headers and dividers
  • New STYLE_BADGE_FG constant for warm accent badges and labels
  • New STYLE_ADD_COUNT_FG / STYLE_REMOVE_COUNT_FG for green/red change counts
  • New STYLE_BUTTON_BG / STYLE_BUTTON_FG for toolbar button chips
  • Updated STYLE_TOOLBAR_BG to use editor.current_line_bg for better visual separation

Implementation Details

  • state.toolbarButtons array tracks button hit regions for mouse click dispatch
  • dispatchToolbarCommand() function routes toolbar clicks to their corresponding handlers
  • Filter query applied during buildDiffLines() to compute visible file list
  • Section counts and groupings use filtered list, not full file list
  • Toolbar height increased from 2 to 3 rows in the layout configuration
  • Added comprehensive documentation comments for new UI components

Testing

Added blog_showcase_review_diff_ui() e2e test that exercises the full redesigned UI end-to-end, including toolbar interaction, sticky header display, inline comments, comment cards, and the file filter feature.

https://claude.ai/code/session_01J4SvLK2NMKaUiDDN1g98Qk

claude added 2 commits April 14, 2026 06:36
…ent cards, file filter

Rework the Review Diff panel layout to read like a purpose-built
magit-style code review UI instead of a plain diff view:

- Toolbar: rounded-border 3-row frame around chip-style buttons
  (`▌ n ▐ next`, `▌ s ▐ stage`, …). Reduced clutter from 16 shortcuts
  down to the eight most-used ones — the rest stay bound. Each chip
  is a hit target so the toolbar is now clickable. A `/ filter` chip
  on the right edge doubles as a button.

- Sticky header: switched from the plain "STAGED · README.md +4 / -3"
  line to a three-segment layout — a warm `[GIT]` badge, the filename
  in bright-fg bold, and right-aligned "+A / -R" counts styled in
  add/remove colors. Sticky width is computed from the actual diff
  panel share (75%) so the counts don't drift off-panel.

- Inline comments: previously rendered as a muted one-line note; now
  full-line-wide callout bars with a leading ⚠ glyph and a warm-bg
  extending to the line end, so they read as reviewer annotations on
  their host line rather than another diff row.

- Comments panel: each comment is now a three-row card
  (`path:line` header + body + spacer) instead of a single-line
  truncated summary, matching the pinned-card layout reviewers expect.

- File filter: new `/` shortcut opens a prompt; entering a substring
  hides files whose path doesn't match (case-insensitive), empty
  clears. The toolbar filter chip reflects the active query. Filter
  state lives on the review-mode state object and is cleared on
  restart.

All colors continue to resolve through theme keys only — the new
`syntax.type` accent, `syntax.string` warm badge, and
`editor.selection_bg` button chip all follow theme swaps.
Adds `blog_showcase_review_diff_ui`, an `#[ignore]`-gated animation
test that exercises every redesigned piece of the Review Diff UI:

- opens the command palette and launches Review Diff,
- lands the cursor on a changed line in README.md (exercising the
  `[GIT] README.md  +4 / -3` sticky header),
- adds two inline comments in two different files so the generated
  GIF shows both the full-width ⚠ callout bar in the diff and two
  stacked cards in the COMMENTS panel,
- exercises the new `/` filter (type "hello" → only hello.py is
  visible and the toolbar filter chip reflects the query; then
  backspace + Enter to clear).

The test also doubles as a visual regression harness for the
redesign — every step is an `snap()` call, so the frame sequence
captures the structural changes end-to-end. Generated GIF checked
in under `docs/blog/editing/review-diff/`.

Runs under the existing `blog_showcase_` filter and follows the
project's semantic-wait rule (`wait_for_prompt`, `wait_until` on
"Generating Review Diff Stream") — no fixed sleeps in the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants