feat(web): refine compact thread row badges (#11644)
This commit is contained in:
1 parent
77bca8b2d7
commit
df7ccc8fd0
2 files changed
+83
-28
No files matched your search
@@ -1584,7 +1584,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
useRightPanelStore.getState().open(threadRef, "pull-requests");
|
||||
if (!props.isActive) onThreadActivate(threadRef);
|
||||
}, [onThreadActivate, props.isActive, threadRef]);
|
||||
const prBadge =
|
||||
const renderPrBadge = (iconOnly: boolean) =>
|
||||
prBadgeShape?.kind === "stack" || pr || currentLinkedPr ? (
|
||||
<ThreadPullRequestBadgeControl
|
||||
variant="underline"
|
||||
@@ -1592,10 +1592,12 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
number={pr?.number ?? currentLinkedPr?.number}
|
||||
url={pr?.url ?? currentLinkedPr?.url}
|
||||
status={prStatus}
|
||||
iconOnly={iconOnly}
|
||||
onOpenStack={handlePrStackClick}
|
||||
onOpenPullRequest={handlePrClick}
|
||||
/>
|
||||
) : null;
|
||||
const prBadge = renderPrBadge(false);
|
||||
const terminalStatusIcon = terminalStatus ? (
|
||||
<span
|
||||
role="img"
|
||||
@@ -1687,17 +1689,37 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
/>
|
||||
}
|
||||
>
|
||||
{props.project ? (
|
||||
<ProjectFavicon project={props.project} className="size-4 shrink-0" />
|
||||
) : driverKind ? (
|
||||
<ProviderInstanceIcon
|
||||
driverKind={driverKind}
|
||||
displayName={providerEntry?.displayName ?? modelInstanceId}
|
||||
iconClassName="size-4"
|
||||
/>
|
||||
) : (
|
||||
<SquarePenIcon aria-hidden className="size-4" />
|
||||
)}
|
||||
<span className="relative inline-flex size-4 shrink-0 items-center justify-center">
|
||||
{props.project ? (
|
||||
<ProjectFavicon project={props.project} className="size-4" />
|
||||
) : driverKind ? (
|
||||
<ProviderInstanceIcon
|
||||
driverKind={driverKind}
|
||||
displayName={providerEntry?.displayName ?? modelInstanceId}
|
||||
iconClassName="size-4"
|
||||
/>
|
||||
) : (
|
||||
<SquarePenIcon aria-hidden className="size-4" />
|
||||
)}
|
||||
{isRemote ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<span
|
||||
role="img"
|
||||
aria-label={props.environmentLabel ?? "Remote environment"}
|
||||
className="absolute -left-1 -bottom-1 inline-flex size-3 items-center justify-center rounded-full bg-sidebar text-sidebar-muted-foreground ring-1 ring-sidebar"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EnvironmentMachineIcon kind={props.environmentMachine} className="size-2.5" />
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="right">
|
||||
{props.environmentLabel ?? "Remote environment"}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</span>
|
||||
{topStatus ? (
|
||||
<span
|
||||
aria-hidden
|
||||
@@ -1943,7 +1965,47 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
<div className="flex h-5 w-full min-w-0 items-center gap-1.5">
|
||||
{draftIndicator}
|
||||
{props.project ? (
|
||||
<ProjectFavicon project={props.project} className="size-4 shrink-0" />
|
||||
<span className="relative inline-flex size-4 shrink-0 items-center justify-center">
|
||||
<ProjectFavicon project={props.project} className="size-4" />
|
||||
{compactRows && isRemote ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<span
|
||||
role="img"
|
||||
aria-label={props.environmentLabel ?? "Remote environment"}
|
||||
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"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EnvironmentMachineIcon
|
||||
kind={props.environmentMachine}
|
||||
className="size-2.5"
|
||||
/>
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="top">
|
||||
{props.environmentLabel ?? "Remote environment"}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
</span>
|
||||
) : compactRows && isRemote ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<span
|
||||
role="img"
|
||||
aria-label={props.environmentLabel ?? "Remote environment"}
|
||||
className="inline-flex size-4 shrink-0 items-center justify-center text-sidebar-muted-foreground/70"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EnvironmentMachineIcon kind={props.environmentMachine} className="size-3.5" />
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="top">
|
||||
{props.environmentLabel ?? "Remote environment"}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
{compactRows ? (
|
||||
title
|
||||
@@ -1962,18 +2024,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
{pinIndicator}
|
||||
{compactRows ? (
|
||||
<>
|
||||
{isRemote ? (
|
||||
<span
|
||||
role="img"
|
||||
aria-label={props.environmentLabel ?? "Remote environment"}
|
||||
className="inline-flex shrink-0 text-sidebar-muted-foreground/70"
|
||||
>
|
||||
<EnvironmentMachineIcon
|
||||
kind={props.environmentMachine}
|
||||
className="size-3.5"
|
||||
/>
|
||||
</span>
|
||||
) : null}
|
||||
{terminalStatusIcon}
|
||||
{topStatus && CompactStatusIcon ? (
|
||||
isWokeStatus ? (
|
||||
@@ -2001,7 +2051,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
</span>
|
||||
)
|
||||
) : null}
|
||||
{prBadge}
|
||||
{renderPrBadge(true)}
|
||||
</>
|
||||
) : null}
|
||||
{/* The visible state owns this slot's width: status at rest,
|
||||
@@ -2031,7 +2081,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
>
|
||||
{compactRows ? (
|
||||
status === "working" ? (
|
||||
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
|
||||
<span className={topStatus?.className}>
|
||||
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />
|
||||
</span>
|
||||
) : compactCompletedAt ? (
|
||||
<SidebarCompletedTime completedAt={compactCompletedAt} />
|
||||
) : (
|
||||
|
||||
@@ -144,6 +144,7 @@ export function ThreadPullRequestBadgeControl({
|
||||
number,
|
||||
url,
|
||||
status,
|
||||
iconOnly = false,
|
||||
onOpenStack,
|
||||
onOpenPullRequest,
|
||||
}: {
|
||||
@@ -152,6 +153,8 @@ export function ThreadPullRequestBadgeControl({
|
||||
number?: number | undefined;
|
||||
url?: string | undefined;
|
||||
status: PrStatusIndicator | null;
|
||||
/** Dense rows drop the number/layer count and keep only the state glyph. */
|
||||
iconOnly?: boolean;
|
||||
onOpenStack: () => void;
|
||||
onOpenPullRequest: (event: MouseEvent<HTMLAnchorElement>) => void;
|
||||
}) {
|
||||
@@ -179,7 +182,7 @@ export function ThreadPullRequestBadgeControl({
|
||||
const content = (
|
||||
<>
|
||||
<ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
|
||||
{isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
|
||||
{iconOnly ? null : isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
|
||||
</>
|
||||
);
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user