Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/mobile/src/features/threads/thread-list-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export const THREAD_LIST_COMPACT_INSET = HOME_HORIZONTAL_INSET;
const SIDEBAR_ROW_RADIUS = 12;

function pullRequestTintColor(
pr: Pick<ThreadPrPresentation, "state" | "isDraft">,
pr: Pick<ThreadPrPresentation, "state" | "isDraft" | "others">,
colorScheme: "light" | "dark",
) {
const dark = colorScheme === "dark";
if (pr.state === "open" && pr.isDraft === true) {
if (pr.others > 0 || (pr.state === "open" && pr.isDraft === true)) {
return dark ? "#a1a1aa" : "#71717a";
}
switch (pr.state) {
Expand Down
8 changes: 1 addition & 7 deletions apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -880,13 +880,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
? materialYouStyleLayoutActive
? "accent-thread-selected-foreground"
: "accent-user-bubble-foreground"
: 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"
: "accent-foreground-muted"
}
/>
) : null}
Expand Down
10 changes: 7 additions & 3 deletions apps/mobile/src/state/thread-pr-presentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ export function presentThreadLinkedPullRequests(
const snapshot = link.snapshot;
const state = badge.kind === "stack" ? badge.state : (snapshot?.state ?? null);
const isDraft = snapshot?.isDraft === true && state === "open";
const linkedCount = badge.kind === "pull-request" && badge.others > 0 ? badge.others + 1 : null;
const label =
badge.kind === "stack"
? String(badge.layers)
: badge.others > 0
? `+${badge.others}`
: linkedCount !== null
? `+${linkedCount}`
: String(link.number);
Comment thread
juliusmarminge marked this conversation as resolved.
return {
kind: badge.kind,
Expand All @@ -84,7 +85,10 @@ export function presentThreadLinkedPullRequests(
badge.kind === "stack"
? `${badge.layers} pull requests in stack, ${state ?? "status pending"}`
: `#${link.number} pull request ${state === null ? "status pending" : isDraft ? "draft" : state}${badge.others > 0 ? `, ${badge.others} more linked` : ""}`,
textClassName: state === null || isDraft ? "text-foreground-muted" : PR_STATE_TEXT_CLASS[state],
textClassName:
linkedCount !== null || state === null || isDraft
? "text-foreground-muted"
: PR_STATE_TEXT_CLASS[state],
};
}

Expand Down
4 changes: 3 additions & 1 deletion apps/mobile/src/state/use-thread-pr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ describe("presentThreadLinkedPullRequests", () => {
it("counts unrelated links without labelling them a stack", () => {
expect(presentThreadLinkedPullRequests([linkedPr(1), linkedPr(2)])).toMatchObject({
kind: "pull-request",
label: "+1",
label: "+2",
others: 1,
textClassName: "text-foreground-muted",
});
});

Expand Down
10 changes: 6 additions & 4 deletions apps/web/src/components/Sidebar.tsx
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
// content; surface is reserved for interaction (hover, multi-select, route).
const rowSurfaceClassName = cn(
"group/sidebar-row relative w-full cursor-pointer overflow-hidden rounded-md text-left outline-none select-none",
variantAction === "unsettle" && "[&:not(:hover):not(:focus-within)_*]:text-secondary-label/70",
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
props.isActive
? "bg-sidebar-row-active text-sidebar-foreground"
: isSelected
Expand Down Expand Up @@ -1469,7 +1470,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
: "text-foreground/90",
)
: cn(
"truncate group-hover/sidebar-row:text-foreground",
"truncate group-focus-within/sidebar-row:text-foreground group-hover/sidebar-row:text-foreground",
shouldRecede
? "text-secondary-label/70"
: props.isActive || isWoke
Expand All @@ -1485,7 +1486,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
</span>
);

// Stacks show their layer count; unrelated links show only the remainder count.
// Stacks show their layer count; multiple unrelated links show their total count.
// Plain clicks open T3; individual PR links also support opening the host in a new tab.
const prBadgeShape = supportsMultiplePullRequests
? resolveThreadPullRequestBadge(thread.pullRequests)
Expand Down Expand Up @@ -1597,8 +1598,8 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
<span
className={cn(
"shrink-0 transition-opacity",
!props.isActive &&
"opacity-40 grayscale group-hover/sidebar-row:opacity-100 group-hover/sidebar-row:grayscale-0",
(!props.isActive || variantAction === "unsettle") &&
"opacity-40 grayscale group-focus-within/sidebar-row:opacity-100 group-focus-within/sidebar-row:grayscale-0 group-hover/sidebar-row:opacity-100 group-hover/sidebar-row:grayscale-0",
)}
>
{props.project ? <ProjectFavicon project={props.project} className="size-4" /> : null}
Expand All @@ -1617,6 +1618,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
the time/jump label yields to the settle affordance. */}
{prBadge}
{prBadge &&
variantAction !== "unsettle" &&
pr &&
(supportsMultiplePullRequests
? visibleThreadPullRequests(thread.pullRequests).length === 0
Expand Down
13 changes: 7 additions & 6 deletions apps/web/src/components/ThreadStatusIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export function ThreadPullRequestBadgeControl({
onOpenPullRequest: (event: MouseEvent<HTMLAnchorElement>) => void;
}) {
const isStack = badge?.kind === "stack";
const linkedCount = badge?.kind === "pull-request" && badge.others > 0 ? badge.others + 1 : null;
if (!isStack && (number === undefined || url === undefined)) return null;
const label = isStack
? `Stack of ${badge.layers} pull requests, ${badge.state}`
Expand All @@ -169,16 +170,16 @@ export function ThreadPullRequestBadgeControl({
"text-xs tabular-nums",
variant === "ghost" &&
"font-normal text-xs! active:scale-100 [--control-icon-color:currentColor]",
isStack ? PR_STATE_COLOR_CLASS[badge.state] : (status?.colorClass ?? "text-muted-foreground"),
linkedCount !== null
? "text-secondary-label"
: isStack
? PR_STATE_COLOR_CLASS[badge.state]
: (status?.colorClass ?? "text-muted-foreground"),
);
const content = (
<>
<ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
{isStack
? badge.layers
: badge?.kind === "pull-request" && badge.others > 0
? `+${badge.others}`
: number}
{isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
</>
);
return (
Expand Down
Loading