fix(ui): simplify multiple linked pull request badges (#11104)

This commit is contained in:
maria authored and GitHub committed 2026-09-10 15:24:25 -03:00
1 parent 3836890e44
commit e784975bbe
5 files changed
+24 -12

No files matched your search

@@ -871,16 +871,22 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
)}
{pr ? (
<View className="flex-row items-center gap-1" accessibilityLabel={pr.accessibilityLabel}>
{pr.kind === "stack" ? (
{pr.kind === "stack" || pr.others > 0 ? (
<SymbolView
name="square.3.layers.3d"
name={pr.kind === "stack" ? "square.3.layers.3d" : "arrow.triangle.pull"}
size={12}
tintColorClassName={
selected
? materialYouStyleLayoutActive
? "accent-thread-selected-foreground"
: "accent-user-bubble-foreground"
: "accent-foreground-muted"
: pr.kind === "stack" || pr.isDraft || pr.state === null
? "accent-foreground-muted"
: pr.state === "open"
? "accent-adaptive-emerald-600-400"
: pr.state === "merged"
? "accent-adaptive-violet-600-400"
: "accent-foreground-muted"
}
/>
) : null}
@@ -896,7 +902,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
)}
style={{ fontFamily: MONO_FONT }}
>
{pr.kind === "stack" ? pr.label : `#${pr.label}`}
{pr.kind === "stack" || pr.others > 0 ? pr.label : `#${pr.label}`}
</Text>
</View>
) : null}
@@ -17,11 +17,12 @@ export interface ThreadPrPresentation {
readonly number: number;
readonly state: ThreadPr["state"] | null;
readonly kind: "pull-request" | "stack";
readonly others: number;
readonly isDraft: boolean;
/** Provider-side last activity, bounding when a terminal state landed. */
readonly updatedAt: string | null;
readonly url: string;
/** Compact pull request number label, e.g. "3774". */
/** Compact pull request number or linked count, e.g. "3774" or "+2". */
readonly label: string;
/** Full, provider-aware label for assistive technologies. */
readonly accessibilityLabel: string;
@@ -42,6 +43,7 @@ export function presentThreadPr(
const isDraft = pr.state === "open" && pr.isDraft === true;
return {
kind: "pull-request",
others: 0,
number: pr.number,
state: pr.state,
isDraft,
@@ -66,9 +68,12 @@ export function presentThreadLinkedPullRequests(
const label =
badge.kind === "stack"
? String(badge.layers)
: `${link.number}${badge.others > 0 ? ` +${badge.others}` : ""}`;
: badge.others > 0
? `+${badge.others}`
: String(link.number);
return {
kind: badge.kind,
others: badge.kind === "pull-request" ? badge.others : 0,
number: link.number,
state,
isDraft,
+1 -1
View File
@@ -87,7 +87,7 @@ describe("presentThreadLinkedPullRequests", () => {
it("counts unrelated links without labelling them a stack", () => {
expect(presentThreadLinkedPullRequests([linkedPr(1), linkedPr(2)])).toMatchObject({
kind: "pull-request",
label: "1 +1",
label: "+1",
});
});
+1 -1
View File
@@ -1485,7 +1485,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
</span>
);
// Stacks show their layer count; unrelated links show the current PR and a remainder count.
// Stacks show their layer count; unrelated links show only the remainder count.
// Plain clicks open T3; individual PR links also support opening the host in a new tab.
const prBadgeShape = supportsMultiplePullRequests
? resolveThreadPullRequestBadge(thread.pullRequests)
@@ -174,10 +174,11 @@ export function ThreadPullRequestBadgeControl({
const content = (
<>
<ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
{isStack ? badge.layers : number}
{badge?.kind === "pull-request" && badge.others > 0 ? (
<span className="opacity-70">+{badge.others}</span>
) : null}
{isStack
? badge.layers
: badge?.kind === "pull-request" && badge.others > 0
? `+${badge.others}`
: number}
</>
);
return (