Skip to content

feat(composer): clickable PR pill next to branch selector#3065

Open
TheIcarusWings wants to merge 2 commits into
pingdotgg:mainfrom
TheIcarusWings:composer-bar-pr-pill
Open

feat(composer): clickable PR pill next to branch selector#3065
TheIcarusWings wants to merge 2 commits into
pingdotgg:mainfrom
TheIcarusWings:composer-bar-pr-pill

Conversation

@TheIcarusWings

@TheIcarusWings TheIcarusWings commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

Adds a small clickable PR pill next to the branch selector in the bottom composer bar. When the active branch has a pull request, the pill shows the PR icon + #<number>, colored by state:

  • open → emerald
  • merged → violet
  • closed → zinc

Clicking the pill opens the PR in the system browser. It sits to the left of the branch selector and does not open the branch dropdown (click is stopped/prevented).

Details

  • Reuses prStatusIndicator / ChangeRequestStatusIcon / resolveThreadPr from ThreadStatusIndicators.tsx, and the readLocalApi()?.shell.openExternal pattern for opening links.
  • Data comes from the existing useVcsStatus({ environmentId, cwd: branchCwd }) query already in BranchToolbarBranchSelector.tsx — no backend changes.
  • The pill renders as a sibling of the ComboboxTrigger inside a flex row; the toolbar layout classes were moved onto that wrapper so the branch group stays right-aligned.
  • Tooltip is action-oriented ("Open pull request #N (state) in browser") using the provider's terminology, distinct from the sidebar's state-description tooltip.
  • Works with cross-repo fork PRs (head TheIcarusWings, base pingdotgg/t3code) via the existing GitManager.findLatestPr detection.

Test

Switch the bottom-bar branch to one with an open PR and confirm the pill appears with the right color and opens the correct GitHub URL.


Note

Low Risk
UI-only change with a small shared hook refactor; no backend, auth, or data-model changes.

Overview
Adds a clickable PR pill to the left of the composer branch selector when the active branch has an associated pull request. It reuses resolveThreadPr, prStatusIndicator, and ChangeRequestStatusIcon from existing thread status UI, colors by PR state, and uses an action-oriented tooltip. Clicks open the PR in the system browser without opening the branch dropdown.

Introduces shared useOpenPrLink (openPullRequestLink.ts) to centralize preventDefault/stopPropagation, shell.openExternal, and error toasts. Sidebar drops its inlined handler in favor of this hook.

Reviewed by Cursor Bugbot for commit 7c713b9. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add clickable PR status pill next to branch selector in composer toolbar

  • Adds a colored PR status pill showing the PR number next to the branch selector in BranchToolbarBranchSelector; clicking it opens the PR in the system browser.
  • Extracts a reusable useOpenPrLink hook in openPullRequestLink.ts that handles click propagation, shows an error toast if the local API is unavailable, and surfaces a failure toast if the URL can't be opened.
  • Refactors Sidebar.tsx to use the new useOpenPrLink hook instead of an inline callback.

Macroscope summarized 7c713b9.

Render a small PR pill (icon + #number) to the left of the branch
selector in the bottom composer bar when the active branch has a pull
request. The pill is colored by PR state (open=emerald, merged=violet,
closed=zinc) via the shared prStatusIndicator, and clicking it opens the
PR in the system browser without opening the branch dropdown.

The tooltip is action-oriented ("Open pull request #N (state) in
browser") and uses the provider's terminology, distinct from the
sidebar's state-description tooltip.
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ed25aaa2-40dc-4d03-915d-849653d75980

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 12, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 12, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Minor UI feature adding a clickable PR pill next to the branch selector. The changes extract existing PR link logic into a shared hook and reuse existing components for the pill display. Low risk, self-contained UI enhancement with no backend or schema impact.

You can customize Macroscope's approvability policy. Learn more.

Comment on lines +526 to +557
const branchPr = resolveThreadPr(resolvedActiveBranch, branchStatusQuery.data ?? null);
const branchPrStatus = prStatusIndicator(
branchPr,
branchStatusQuery.data?.sourceControlProvider,
);
// Action-oriented tooltip (the pill opens the PR), distinct from the sidebar's
// state-description tooltip.
const branchPrTooltip = branchPr
? `Open ${sourceControlPresentation.terminology.singular} #${branchPr.number} (${branchPr.state}) in browser`
: "";
const openPrLink = useCallback((event: MouseEvent<HTMLElement>, prUrl: string) => {
event.preventDefault();
event.stopPropagation();

const api = readLocalApi();
if (!api) {
toastManager.add({
type: "error",
title: "Link opening is unavailable.",
});
return;
}

void api.shell.openExternal(prUrl).catch((error) => {
toastManager.add(
stackedThreadToast({
type: "error",
title: "Unable to open pull request link",
description: error instanceof Error ? error.message : "An error occurred.",
}),
);
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is all duplicated from sidebar? should be extracted to some shared hook/module

@TheIcarusWings TheIcarusWings Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Extracted into a shared useOpenPrLink hook (apps/web/src/lib/openPullRequestLink.ts) and updated both the sidebar and the composer branch selector to use it. Pushed in 91f6d6a.

@macroscopeapp macroscopeapp Bot dismissed their stale review June 14, 2026 19:50

Dismissing prior approval to re-evaluate 91f6d6a

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Jun 14, 2026
Address review feedback: the openPrLink handler was duplicated verbatim
between Sidebar and the composer branch selector. Extract it into a
shared lib/openPullRequestLink hook and use it from both call sites.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants