Skip to content
TypeScript

feat(web): show the linked pull request in the compact sidebar rail (#11652)

maria7b61099886f3
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 65ac1cf7752..9cee123e4ec 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -1584,10 +1584,10 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
useRightPanelStore.getState().open(threadRef, "pull-requests");
if (!props.isActive) onThreadActivate(threadRef);
}, [onThreadActivate, props.isActive, threadRef]);
- const renderPrBadge = (iconOnly: boolean) =>
+ const renderPrBadge = (iconOnly: boolean, variant: "underline" | "badge" = "underline") =>
prBadgeShape?.kind === "stack" || pr || currentLinkedPr ? (
<ThreadPullRequestBadgeControl
- variant="underline"
+ variant={variant}
badge={prBadgeShape}
number={pr?.number ?? currentLinkedPr?.number}
url={pr?.url ?? currentLinkedPr?.url}
@@ -1597,6 +1597,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
onOpenPullRequest={handlePrClick}
/>
) : null;
+ const hasPrBadge = prBadgeShape?.kind === "stack" || pr !== null || currentLinkedPr !== null;
const prBadge = renderPrBadge(false);
const terminalStatusIcon = terminalStatus ? (
<span
@@ -1719,6 +1720,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
</TooltipPopup>
</Tooltip>
) : null}
+ {hasPrBadge ? (
+ <span className="absolute -top-1 -right-1 inline-flex">
+ {renderPrBadge(true, "badge")}
+ </span>
+ ) : null}
</span>
{topStatus ? (
<span
diff --git a/apps/web/src/components/ThreadStatusIndicators.tsx b/apps/web/src/components/ThreadStatusIndicators.tsx
index bb99df0a3d3..4b26d044202 100644
--- a/apps/web/src/components/ThreadStatusIndicators.tsx
+++ b/apps/web/src/components/ThreadStatusIndicators.tsx
@@ -148,7 +148,7 @@ export function ThreadPullRequestBadgeControl({
onOpenStack,
onOpenPullRequest,
}: {
- variant: "underline" | "ghost";
+ variant: "underline" | "ghost" | "badge";
badge: ThreadPullRequestBadge | null;
number?: number | undefined;
url?: string | undefined;
@@ -171,7 +171,9 @@ export function ThreadPullRequestBadgeControl({
const className = cn(
variant === "ghost"
? buttonVariants({ variant: "ghost", size: "xs" })
- : "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",
+ : variant === "badge"
+ ? "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"
+ : "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",
"text-xs tabular-nums",
variant === "ghost" &&
"font-normal text-xs! active:scale-100 [--control-icon-color:currentColor]",
@@ -181,7 +183,10 @@ export function ThreadPullRequestBadgeControl({
);
const content = (
<>
- <ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
+ <ThreadPullRequestBadgeIcon
+ icon={badge?.kind ?? "pull-request"}
+ className={variant === "badge" ? "size-2.5" : undefined}
+ />
{iconOnly ? null : isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
</>
);