Skip to content

feat(desktop): make PR badge clickable in sidebar - #877

Merged
saddlepaddle merged 2 commits into
mainfrom
make-pr-badge-clicka
Jan 21, 2026
Merged

saddlepaddle merged 2 commits into
mainfrom
make-pr-badge-clicka

Conversation

@saddlepaddle

@saddlepaddle saddlepaddle commented Jan 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Makes the PR status badge in the sidebar clickable, opening the PR in the browser
  • Adds hover state with 30% opacity background for visual feedback
  • Fixes vertical text centering and prevents layout shift

Test plan

  • Hover over a PR badge in the sidebar - should see background darken
  • Click the PR badge - should open the PR in browser
  • Verify no layout shift when hovering

Summary by CodeRabbit

  • New Features

    • Status badges are now clickable to open associated pull request links when available.
    • Hover background and cursor affordances added for clearer interactivity.
  • Refactor

    • Collapsed sidebar rendering simplified for a cleaner compact view.
    • Branch subtitle logic streamlined so branch subtitles are shown consistently only for non-branch workspaces.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add hover state with 30% opacity background
- Click opens PR in browser via shell.openExternal
- Fix vertical centering with leading-none
- Add shrink-0 to prevent layout shift
@coderabbitai

coderabbitai Bot commented Jan 21, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds an optional prUrl prop to WorkspaceStatusBadge, makes the badge render as a clickable button when prUrl is present, and opens the PR URL via an electron trpc/openUrl call on click; also simplifies branch subtitle logic and collapses some hover-card behavior in the list item.

Changes

Cohort / File(s) Summary
PR Prop Forwarding
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceListItem.tsx
Forward pr.url to WorkspaceStatusBadge as prUrl; simplified showBranchSubtitle to !isBranchWorkspace; collapsed hover-card logic for collapsed sidebar rendering.
Clickable Status Badge
apps/desktop/src/renderer/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx
Add prUrl?: string prop; render a button when clickable; wire electronTrpc.openUrl.mutate to open prUrl with event.stopPropagation(); add per-state hoverBgColor and conditional hover/cursor styling; preserve non-click behavior and PR number display.

Sequence Diagram(s)

sequenceDiagram
  participant UI as WorkspaceStatusBadge (button)
  participant Renderer as Renderer Main Process
  participant Electron as electronTrpc.openUrl
  participant Browser as External Browser

  UI->>Renderer: onClick (prUrl)\nstopPropagation()
  Renderer->>Electron: openUrl.mutate(prUrl)
  Electron->>Browser: open(prUrl)
  Browser-->>Electron: opened
  Electron-->>Renderer: success
  Renderer-->>UI: click handled (no further propagation)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
I hopped to the sidebar, bright and spry,
A badge now clickable—off to PRs I fly.
One gentle tap, through electron's door,
I whisk you to reviews and back once more.
✨🐇

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a summary of changes and test plan, but omits required template sections like 'Related Issues', 'Type of Change', and 'Screenshots'. Fill in all required template sections: add related issue links, select appropriate 'Type of Change' (New feature), and include any applicable screenshots of the hover and click behavior.
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 (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: making the PR badge clickable in the sidebar, which aligns with the primary objective of the changeset.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

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/screens/main/components/WorkspaceSidebar/WorkspaceListItem/WorkspaceStatusBadge.tsx (1)

21-73: Add error handling for openUrl mutation in WorkspaceStatusBadge.

The mutation at line 72 silently fails without error logging. The procedure definition confirms the input expects a string (which prUrl correctly provides), but errors are not caught at the call site. Add error handling following the codebase pattern:

-	const handleClick = (e: React.MouseEvent) => {
-		if (prUrl) {
-			e.stopPropagation();
-			openUrl.mutate(prUrl);
-		}
+	const handleClick = (e: React.MouseEvent) => {
+		if (prUrl) {
+			e.stopPropagation();
+			openUrl.mutate(prUrl, {
+				onError: (error) => {
+					console.error(
+						"[workspace-status-badge/open-url] Failed to open PR URL",
+						error,
+					);
+				},
+			});
+		}

Per coding guidelines, errors must not be swallowed and should include context-prefixed logging.

Remove conditions that hid branch subtitle when name matched branch
or during rename - branch is now always visible for worktree workspaces.
@saddlepaddle
saddlepaddle merged commit 957e90e into main Jan 21, 2026
4 of 5 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@Kitenite
Kitenite deleted the make-pr-badge-clicka branch January 22, 2026 17:48
@coderabbitai coderabbitai Bot mentioned this pull request Jan 27, 2026
3 tasks done
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