Skip to content

Commit 7b61099

Browse files
authored
feat(web): show the linked pull request in the compact sidebar rail (#11652)
1 parent df7ccc8 commit 7b61099

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,10 +1584,10 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
15841584
useRightPanelStore.getState().open(threadRef, "pull-requests");
15851585
if (!props.isActive) onThreadActivate(threadRef);
15861586
}, [onThreadActivate, props.isActive, threadRef]);
1587-
const renderPrBadge = (iconOnly: boolean) =>
1587+
const renderPrBadge = (iconOnly: boolean, variant: "underline" | "badge" = "underline") =>
15881588
prBadgeShape?.kind === "stack" || pr || currentLinkedPr ? (
15891589
<ThreadPullRequestBadgeControl
1590-
variant="underline"
1590+
variant={variant}
15911591
badge={prBadgeShape}
15921592
number={pr?.number ?? currentLinkedPr?.number}
15931593
url={pr?.url ?? currentLinkedPr?.url}
@@ -1597,6 +1597,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
15971597
onOpenPullRequest={handlePrClick}
15981598
/>
15991599
) : null;
1600+
const hasPrBadge = prBadgeShape?.kind === "stack" || pr !== null || currentLinkedPr !== null;
16001601
const prBadge = renderPrBadge(false);
16011602
const terminalStatusIcon = terminalStatus ? (
16021603
<span
@@ -1719,6 +1720,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
17191720
</TooltipPopup>
17201721
</Tooltip>
17211722
) : null}
1723+
{hasPrBadge ? (
1724+
<span className="absolute -top-1 -right-1 inline-flex">
1725+
{renderPrBadge(true, "badge")}
1726+
</span>
1727+
) : null}
17221728
</span>
17231729
{topStatus ? (
17241730
<span

‎apps/web/src/components/ThreadStatusIndicators.tsx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function ThreadPullRequestBadgeControl({
148148
onOpenStack,
149149
onOpenPullRequest,
150150
}: {
151-
variant: "underline" | "ghost";
151+
variant: "underline" | "ghost" | "badge";
152152
badge: ThreadPullRequestBadge | null;
153153
number?: number | undefined;
154154
url?: string | undefined;
@@ -171,7 +171,9 @@ export function ThreadPullRequestBadgeControl({
171171
const className = cn(
172172
variant === "ghost"
173173
? buttonVariants({ variant: "ghost", size: "xs" })
174-
: "inline-flex shrink-0 cursor-pointer items-center gap-0.5 whitespace-nowrap border-b border-transparent hover:border-current focus-visible:outline-2 focus-visible:outline-ring",
174+
: variant === "badge"
175+
? "inline-flex size-3 shrink-0 cursor-pointer items-center justify-center rounded-full bg-sidebar ring-1 ring-sidebar outline-none focus-visible:ring-2 focus-visible:ring-ring"
176+
: "inline-flex shrink-0 cursor-pointer items-center gap-0.5 whitespace-nowrap border-b border-transparent hover:border-current focus-visible:outline-2 focus-visible:outline-ring",
175177
"text-xs tabular-nums",
176178
variant === "ghost" &&
177179
"font-normal text-xs! active:scale-100 [--control-icon-color:currentColor]",
@@ -181,7 +183,10 @@ export function ThreadPullRequestBadgeControl({
181183
);
182184
const content = (
183185
<>
184-
<ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
186+
<ThreadPullRequestBadgeIcon
187+
icon={badge?.kind ?? "pull-request"}
188+
className={variant === "badge" ? "size-2.5" : undefined}
189+
/>
185190
{iconOnly ? null : isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
186191
</>
187192
);

0 commit comments

Comments
 (0)