Skip to content

tighten v2 diff file header layout#3776

Merged
saddlepaddle merged 1 commit intomainfrom
fix-tooltip-badge-layout
Apr 26, 2026
Merged

tighten v2 diff file header layout#3776
saddlepaddle merged 1 commit intomainfrom
fix-tooltip-badge-layout

Conversation

@saddlepaddle
Copy link
Copy Markdown
Collaborator

@saddlepaddle saddlepaddle commented Apr 26, 2026

Summary

  • Size the file badge to its content instead of stretching full-width across the row
  • Move +/- LOC out of the badge and next to the right-side actions
  • Drop the redundant Open in editor button (badge ⌘ click already opens in editor)
  • Simplify the file badge tooltip to just the click hint (no more duplicated path / verbose intro)

Test plan

  • Open a diff pane in a v2 workspace, confirm the file badge fits its icon + path
  • Confirm the badge truncates the path with an ellipsis when the pane is narrow
  • Hover the badge — tooltip is one line: ⇧ click: new tab · ⌘ click: editor
  • Click / ⇧ click / ⌘ click the badge — opens in viewer / new tab / external editor respectively
  • Verify +/- LOC render to the right, before the Viewed checkbox

Summary by CodeRabbit

  • Style
    • Refined diff file header layout with improved button sizing and spacing
    • Simplified UI tooltips for clarity
    • Repositioned additions/deletions counter to a prominent badge for better visibility

Summary by cubic

Tightened the v2 diff file header to reduce clutter and make interactions clearer. The file badge now fits its content, the tooltip is concise, and LOC counts sit with the right-side controls.

  • Refactors
    • Size the file badge to its content; truncate path with ellipsis on narrow panes.
    • Move +/− LOC out of the badge to the right, before the Viewed checkbox.
    • Remove the redundant “Open in editor” button; badge supports click / ⇧ click / ⌘ click with a simple hint-only tooltip.

Written for commit dea7480. Summary will update on new commits.

- size the file badge to its content instead of stretching full-width
- move +/- LOC out of the badge and next to the right-side actions
- drop redundant Open in editor button (badge ⌘ click already does it)
- simplify file badge tooltip to just the click hint
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Walkthrough

The DiffFileHeader component UI is refactored with adjusted flex sizing, simplified tooltip messaging, removal of an external editor button, relocation of the additions/deletions counter to a conditional right-side badge, and condensed imports.

Changes

Cohort / File(s) Summary
DiffFileHeader UI Refactoring
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx
Adjusted file-viewer button flex sizing, replaced multi-line tooltip with CLICK_HINT_TOOLTIP, removed external editor button and ExternalLink icon usage, relocated additions/deletions counter to new conditional right-side badge, and condensed lucide-react imports to single line.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A diff header springs to life so neat,
Flex sizing tight, the layout's sweet—
One badge now shows what's gone, what's new,
Tooltips trimmed and cleaner too!
Simpler code with less to see,
Beauty in simplicity! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'tighten v2 diff file header layout' accurately summarizes the main change: improving the layout/sizing of the DiffFileHeader component by adjusting flex sizing and reorganizing its elements.
Description check ✅ Passed The pull request description includes a clear summary of changes, a detailed test plan, and aligns with the template structure. All key changes are documented with actionable verification steps.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-tooltip-badge-layout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 26, 2026

Greptile Summary

This PR tightens the diff file header layout: the file-path badge is shrunk to fit its content (min-w-0 instead of flex-[1_1_10rem]), +/− LOC counters are moved to the right-side actions bar, and the dedicated "Open in editor" (ExternalLink) button is removed in favour of the existing -click shortcut on the badge. The tooltip is simplified to a single-line CLICK_HINT_TOOLTIP. The only notable concern is that the simplified tooltip still advertises ⌘ click: editor regardless of whether onOpenInExternalEditor is actually available, which was previously surfaced to users via the dedicated button's "unavailable" state.

Confidence Score: 5/5

Safe to merge; changes are purely cosmetic/layout with one minor UX edge case around the tooltip hint when the external editor is unavailable.

All findings are P2 style/UX concerns. No logic errors, data-integrity issues, or security risks were identified. The layout changes are straightforward Tailwind class adjustments, and the removed button's functionality is preserved via the existing keyboard-modifier shortcut.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx UI refactor: badge now sizes to content (min-w-0), LOC stats moved to right-side action bar, redundant "Open in editor" button removed; tooltip simplified to CLICK_HINT_TOOLTIP but still advertises ⌘-click-to-editor even when onOpenInExternalEditor is unavailable.

Sequence Diagram

sequenceDiagram
    participant User
    participant Badge as File Badge (button)
    participant getSidebarClickIntent
    participant onOpenFile
    participant onOpenInExternalEditor

    User->>Badge: plain click
    Badge->>getSidebarClickIntent: event
    getSidebarClickIntent-->>Badge: "openInViewer"
    Badge->>onOpenFile: onOpenFile?.(false)

    User->>Badge: ⇧ click
    Badge->>getSidebarClickIntent: event
    getSidebarClickIntent-->>Badge: "openInNewTab"
    Badge->>onOpenFile: onOpenFile?.(true)

    User->>Badge: ⌘ click
    Badge->>getSidebarClickIntent: event
    getSidebarClickIntent-->>Badge: "openInEditor"
    Badge->>onOpenInExternalEditor: onOpenInExternalEditor?.()
    Note over onOpenInExternalEditor: No-op if prop is undefined,<br/>but tooltip still shows ⌘ click hint
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx
Line: 83-85

Comment:
**Tooltip hints ⌘-click even when editor unavailable**

`CLICK_HINT_TOOLTIP` is now always shown as-is, but it still advertises `⌘ click: editor`. When `onOpenInExternalEditor` is `undefined`, that modifier silently does nothing (`onOpenInExternalEditor?.()`) while the tooltip continues to promise it works. The old code addressed this by showing "Open in editor unavailable" on the dedicated button. Consider either suppressing the `⌘ click` line from the tooltip when `onOpenInExternalEditor` is falsy, or accepting that the hint will occasionally be a no-op.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "tighten v2 diff file header layout" | Re-trigger Greptile

Comment on lines +83 to 85
<TooltipContent side="bottom" showArrow={false}>
{CLICK_HINT_TOOLTIP}
</TooltipContent>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Tooltip hints ⌘-click even when editor unavailable

CLICK_HINT_TOOLTIP is now always shown as-is, but it still advertises ⌘ click: editor. When onOpenInExternalEditor is undefined, that modifier silently does nothing (onOpenInExternalEditor?.()) while the tooltip continues to promise it works. The old code addressed this by showing "Open in editor unavailable" on the dedicated button. Consider either suppressing the ⌘ click line from the tooltip when onOpenInExternalEditor is falsy, or accepting that the hint will occasionally be a no-op.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx
Line: 83-85

Comment:
**Tooltip hints ⌘-click even when editor unavailable**

`CLICK_HINT_TOOLTIP` is now always shown as-is, but it still advertises `⌘ click: editor`. When `onOpenInExternalEditor` is `undefined`, that modifier silently does nothing (`onOpenInExternalEditor?.()`) while the tooltip continues to promise it works. The old code addressed this by showing "Open in editor unavailable" on the dedicated button. Consider either suppressing the `⌘ click` line from the tooltip when `onOpenInExternalEditor` is falsy, or accepting that the hint will occasionally be a no-op.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx (1)

65-75: ⚠️ Potential issue | 🟡 Minor

⌘-click silently no-ops when onOpenInExternalEditor is not provided.

The button stays enabled as long as either callback is present (line 73), but the click handler returns early on intent === "openInEditor" without falling back to onOpenFile. If a caller wires up onOpenFile only (e.g. environments without an external editor configured), the tooltip still advertises ⌘ click: editor and ⌘-click does nothing — no viewer fallback, no error — which is a confusing dead end now that the explicit "Open in editor" button is gone.

Consider either falling back to the viewer or disabling the editor branch of the tooltip when the handler is missing.

🛡️ Proposed fallback
 						onClick={(event) => {
 							const intent = getSidebarClickIntent(event);
-							if (intent === "openInEditor") {
+							if (intent === "openInEditor" && onOpenInExternalEditor) {
 								onOpenInExternalEditor?.();
 								return;
 							}
 							onOpenFile?.(intent === "openInNewTab");
 						}}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx
around lines 65 - 75, The click handler for the button (using
getSidebarClickIntent) returns early when intent === "openInEditor", causing a
silent no-op if onOpenInExternalEditor is not provided; update the handler in
DiffFileHeader.tsx so that when intent === "openInEditor" it calls
onOpenInExternalEditor if available otherwise falls back to onOpenFile (passing
true when appropriate), and ensure the disabled prop/tooltip logic reflects
whether the editor action is actually available (i.e., hide or disable the
⌘-click editor hint when onOpenInExternalEditor is undefined) so users get
either a viewer fallback or correct tooltip state.
🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx (1)

47-87: Minor: ml-auto on the right-side group is redundant with parent justify-between.

Parent at line 47 already uses justify-between, so the explicit ml-auto at line 87 is belt-and-suspenders. Not harmful (it actually helps keep layout stable if a future change adds a third left-side item), so feel free to leave as-is — flagging only for awareness.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx
around lines 47 - 87, The right-side container in the DiffFileHeader component
uses a redundant ml-auto alongside the parent container's justify-between; open
the DiffFileHeader.tsx file, locate the div with className "ml-auto flex
shrink-0 items-center gap-1.5" inside the DiffFileHeader component, and remove
the ml-auto token from that className (leaving "flex shrink-0 items-center
gap-1.5") to rely on the parent's justify-between; alternatively, if you prefer
to preserve defensive layout for future changes, add a short comment above the
div explaining why ml-auto is intentionally kept.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx:
- Around line 65-75: The click handler for the button (using
getSidebarClickIntent) returns early when intent === "openInEditor", causing a
silent no-op if onOpenInExternalEditor is not provided; update the handler in
DiffFileHeader.tsx so that when intent === "openInEditor" it calls
onOpenInExternalEditor if available otherwise falls back to onOpenFile (passing
true when appropriate), and ensure the disabled prop/tooltip logic reflects
whether the editor action is actually available (i.e., hide or disable the
⌘-click editor hint when onOpenInExternalEditor is undefined) so users get
either a viewer fallback or correct tooltip state.

---

Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/`$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx:
- Around line 47-87: The right-side container in the DiffFileHeader component
uses a redundant ml-auto alongside the parent container's justify-between; open
the DiffFileHeader.tsx file, locate the div with className "ml-auto flex
shrink-0 items-center gap-1.5" inside the DiffFileHeader component, and remove
the ml-auto token from that className (leaving "flex shrink-0 items-center
gap-1.5") to rely on the parent's justify-between; alternatively, if you prefer
to preserve defensive layout for future changes, add a short comment above the
div explaining why ml-auto is intentionally kept.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 63402a1c-22e9-4c54-b22d-c6bcc04937a9

📥 Commits

Reviewing files that changed from the base of the PR and between b6db247 and dea7480.

📒 Files selected for processing (1)
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/DiffPane/components/DiffFileHeader/DiffFileHeader.tsx

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@saddlepaddle saddlepaddle merged commit 9f76264 into main Apr 26, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch

Thank you for your contribution! 🎉

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.

1 participant