Skip to content

Commit 2b7d7f5

Browse files
committed
feat(web): refine compact thread row badges
Show only the pull-request glyph in compact rows, move the remote machine indicator onto the project favicon, and tint the working duration with the working status color.
1 parent 77bca8b commit 2b7d7f5

2 files changed

Lines changed: 35 additions & 17 deletions

File tree

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

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,18 +1584,20 @@ 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 prBadge =
1587+
const renderPrBadge = (iconOnly: boolean) =>
15881588
prBadgeShape?.kind === "stack" || pr || currentLinkedPr ? (
15891589
<ThreadPullRequestBadgeControl
15901590
variant="underline"
15911591
badge={prBadgeShape}
15921592
number={pr?.number ?? currentLinkedPr?.number}
15931593
url={pr?.url ?? currentLinkedPr?.url}
15941594
status={prStatus}
1595+
iconOnly={iconOnly}
15951596
onOpenStack={handlePrStackClick}
15961597
onOpenPullRequest={handlePrClick}
15971598
/>
15981599
) : null;
1600+
const prBadge = renderPrBadge(false);
15991601
const terminalStatusIcon = terminalStatus ? (
16001602
<span
16011603
role="img"
@@ -1943,7 +1945,30 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
19431945
<div className="flex h-5 w-full min-w-0 items-center gap-1.5">
19441946
{draftIndicator}
19451947
{props.project ? (
1946-
<ProjectFavicon project={props.project} className="size-4 shrink-0" />
1948+
<span className="relative inline-flex size-4 shrink-0 items-center justify-center">
1949+
<ProjectFavicon project={props.project} className="size-4" />
1950+
{compactRows && isRemote ? (
1951+
<Tooltip>
1952+
<TooltipTrigger
1953+
render={
1954+
<span
1955+
role="img"
1956+
aria-label={props.environmentLabel ?? "Remote environment"}
1957+
className="absolute -right-1 -bottom-1 inline-flex size-3 items-center justify-center rounded-full bg-sidebar text-sidebar-muted-foreground ring-1 ring-sidebar"
1958+
/>
1959+
}
1960+
>
1961+
<EnvironmentMachineIcon
1962+
kind={props.environmentMachine}
1963+
className="size-2.5"
1964+
/>
1965+
</TooltipTrigger>
1966+
<TooltipPopup side="top">
1967+
{props.environmentLabel ?? "Remote environment"}
1968+
</TooltipPopup>
1969+
</Tooltip>
1970+
) : null}
1971+
</span>
19471972
) : null}
19481973
{compactRows ? (
19491974
title
@@ -1962,18 +1987,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
19621987
{pinIndicator}
19631988
{compactRows ? (
19641989
<>
1965-
{isRemote ? (
1966-
<span
1967-
role="img"
1968-
aria-label={props.environmentLabel ?? "Remote environment"}
1969-
className="inline-flex shrink-0 text-sidebar-muted-foreground/70"
1970-
>
1971-
<EnvironmentMachineIcon
1972-
kind={props.environmentMachine}
1973-
className="size-3.5"
1974-
/>
1975-
</span>
1976-
) : null}
19771990
{terminalStatusIcon}
19781991
{topStatus && CompactStatusIcon ? (
19791992
isWokeStatus ? (
@@ -2001,7 +2014,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
20012014
</span>
20022015
)
20032016
) : null}
2004-
{prBadge}
2017+
{renderPrBadge(true)}
20052018
</>
20062019
) : null}
20072020
{/* The visible state owns this slot's width: status at rest,
@@ -2031,7 +2044,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
20312044
>
20322045
{compactRows ? (
20332046
status === "working" ? (
2034-
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
2047+
<span className={topStatus?.className}>
2048+
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
2049+
</span>
20352050
) : compactCompletedAt ? (
20362051
<SidebarCompletedTime completedAt={compactCompletedAt} />
20372052
) : (

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ export function ThreadPullRequestBadgeControl({
144144
number,
145145
url,
146146
status,
147+
iconOnly = false,
147148
onOpenStack,
148149
onOpenPullRequest,
149150
}: {
@@ -152,6 +153,8 @@ export function ThreadPullRequestBadgeControl({
152153
number?: number | undefined;
153154
url?: string | undefined;
154155
status: PrStatusIndicator | null;
156+
/** Dense rows drop the number/layer count and keep only the state glyph. */
157+
iconOnly?: boolean;
155158
onOpenStack: () => void;
156159
onOpenPullRequest: (event: MouseEvent<HTMLAnchorElement>) => void;
157160
}) {
@@ -179,7 +182,7 @@ export function ThreadPullRequestBadgeControl({
179182
const content = (
180183
<>
181184
<ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
182-
{isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
185+
{iconOnly ? null : isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
183186
</>
184187
);
185188
return (

0 commit comments

Comments
 (0)