TypeScript
feat(web): boring sidebar can show folder threads on two lines (#26463)
Theo Browne5211acfe95a0
diff --git a/apps/desktop/src/settings/DesktopClientSettings.test.ts b/apps/desktop/src/settings/DesktopClientSettings.test.tsindex 1a927643be6..ea351b6ceb2 100644--- a/apps/desktop/src/settings/DesktopClientSettings.test.ts+++ b/apps/desktop/src/settings/DesktopClientSettings.test.ts@@ -63,6 +63,7 @@ const clientSettings: ClientSettings = {sidebarProjectSortOrder: "manual",sidebarThreadSortOrder: "created_at",boringSidebarEnabled: false,+ boringSidebarMultilineRows: false,legacySidebarEnabled: false,sidebarWorkingShelfEnabled: false,loadBalancingEnabled: false,diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsxindex 0868554b50f..c4ba300a030 100644--- a/apps/web/src/components/Sidebar.tsx+++ b/apps/web/src/components/Sidebar.tsx@@ -962,6 +962,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve},});const boringSidebarEnabled = useBoringSidebarEnabled();+ const folderRowsMultiline = useClientSettings((settings) => settings.boringSidebarMultilineRows);const newThreadContext = useHandleNewThread();// Row callbacks capture only the handler; the rest of the context changes with the route.const { handleNewThread } = newThreadContext;@@ -3168,7 +3169,13 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve);const isCard =section === "active" || section === "pinned" || section === "working";- const rowVariant = folderRow ? "folder" : isCard ? "card" : "slim";+ const rowVariant = folderRow+ ? folderRowsMultiline+ ? "folder-multiline"+ : "folder"+ : isCard+ ? "card"+ : "slim";return (<SortableThreadRowkey={threadKey}diff --git a/apps/web/src/components/settings/LabsSettingsPanel.tsx b/apps/web/src/components/settings/LabsSettingsPanel.tsxindex 5f944c867db..15c943728f1 100644--- a/apps/web/src/components/settings/LabsSettingsPanel.tsx+++ b/apps/web/src/components/settings/LabsSettingsPanel.tsx@@ -17,6 +17,7 @@ export function LabsSettingsPanel() {<SettingsPageContainer><SettingsSection id="beta" title="Beta"><BoringSidebarRow />+ <BoringSidebarMultilineRow />{/* Clerk is only mounted when this build has T3 Connect. */}{hasCloudPublicConfig() ? <GuestLinksRowWithSignIn /> : <GuestLinksRow />}<LinkedEnvironmentsRow />@@ -47,6 +48,26 @@ function BoringSidebarRow() {);}+function BoringSidebarMultilineRow() {+ const settings = useScopedSettings();+ const updateSettings = useUpdateScopedSettings();+ return (+ <SettingsRow+ {...searchableSetting("boring-sidebar-multiline")}+ description="In the boring sidebar, show folder threads on two lines: the title, then the branch, pull request, and agent."+ control={+ <Switch+ checked={settings.boringSidebarMultilineRows}+ onCheckedChange={(checked) =>+ updateSettings({ boringSidebarMultilineRows: Boolean(checked) })+ }+ aria-label="Two-line folder rows"+ />+ }+ />+ );+}+/** Signed out of T3 Connect, the row offers to sign in instead of its switch. */function GuestLinksRowWithSignIn() {const { isSignedIn } = useAuth();diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.tsindex fe4faa61996..325d0c1ba75 100644--- a/apps/web/src/components/settings/settingsSearch.ts+++ b/apps/web/src/components/settings/settingsSearch.ts@@ -431,6 +431,12 @@ export const SETTINGS_SEARCH_ITEMS = [to: "/settings/labs",searchTerms: ["beta folders project tree legacy old classic sidebar"],},+ {+ id: "boring-sidebar-multiline",+ title: "Two-line folder rows",+ to: "/settings/labs",+ searchTerms: ["beta boring sidebar folder rows multiline branch pull request details"],+ },{id: "guest-links",title: "Guest links",diff --git a/apps/web/src/components/sidebar/SidebarThreadRow.tsx b/apps/web/src/components/sidebar/SidebarThreadRow.tsxindex eac7c8591fa..a111126342f 100644--- a/apps/web/src/components/sidebar/SidebarThreadRow.tsx+++ b/apps/web/src/components/sidebar/SidebarThreadRow.tsx@@ -533,8 +533,9 @@ function TopStatusIcon(props: { icon: keyof typeof TOP_STATUS_ICONS; className:type SidebarThreadRowProps = {thread: SidebarThreadSummary;- // "folder" is a one-line row inside a boring sidebar project folder.- variant: "card" | "slim" | "folder";+ // "folder" is a one-line row inside a boring sidebar project folder;+ // "folder-multiline" adds the card's branch and PR line under it.+ variant: "card" | "slim" | "folder" | "folder-multiline";navigationParent?: string | undefined;variantAction: SidebarSweepAction;settlementSupported: boolean;@@ -1121,8 +1122,76 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP)) : null;+ const diff = latestRunDiff(thread);+ // Only the provider icon would remain, so the row drops the line instead of leaving it blank.+ const metaLineEmpty =+ !thread.branch &&+ !showsScratchMachine &&+ prBadge === null &&+ diff === null &&+ !isRemote &&+ runningTerminalIds.length === 0;+ const metaLine = metaLineEmpty ? null : (+ <div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-secondary-label text-xs">+ {thread.branch ? (+ <>+ <ThreadWorktreeIndicator thread={thread} />+ <span className="flex min-w-0 flex-1">+ <MiddleTruncate value={thread.branch} showTitle={false} />+ </span>+ </>+ ) : showsScratchMachine ? (+ <>+ <EnvironmentMachineIcon+ aria-hidden+ kind={props.environmentMachine}+ className="size-3 shrink-0"+ />+ <span className="min-w-0 flex-1 truncate">{props.scratchMachineLabel}</span>+ </>+ ) : (+ <span className="flex-1" />+ )}+ {terminalStatusIcon}+ {prBadge}+ {diff ? (+ <span className="shrink-0 font-mono">+ <span className="text-diff-addition-foreground">+{formatDiffCount(diff.insertions)}</span>{" "}+ <span className="text-diff-deletion-foreground">−{formatDiffCount(diff.deletions)}</span>+ </span>+ ) : null}+ <span+ aria-hidden+ className="pointer-events-none ml-auto inline-flex shrink-0 items-center gap-1"+ >+ {isRemote && !showsScratchMachine ? (+ <span className="inline-flex shrink-0 items-center text-sidebar-muted-foreground/70">+ <EnvironmentMachineIcon+ aria-hidden+ kind={props.environmentMachine}+ className="size-3.5"+ />+ </span>+ ) : null}+ <SidebarProviderStack+ thread={thread}+ providerEntryByInstanceId={props.providerEntryByInstanceId}+ />+ </span>+ </div>+ );+ const titleLineProviderStack = metaLineEmpty ? (+ <span aria-hidden className="inline-flex shrink-0">+ <SidebarProviderStack+ thread={thread}+ providerEntryByInstanceId={props.providerEntryByInstanceId}+ />+ </span>+ ) : null;+if (variant !== "card") {- const inFolder = variant === "folder";+ const multiline = variant === "folder-multiline";+ const inFolder = variant === "folder" || multiline;return (<lidata-thread-item={threadKey}@@ -1130,6 +1199,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP{...(fileDropHandlers ?? {})}className={cn("list-none [content-visibility:auto] [contain-intrinsic-size:auto_36px]",+ metaLine !== null && multiline && "[contain-intrinsic-size:auto_54px]",sortable?.isDragging && "relative z-20",)}>@@ -1148,7 +1218,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowParia-busy={isRegeneratingTitle || undefined}className={cn(rowSurfaceClassName,- "flex h-9 items-center gap-2.5 px-2.5",+ multiline+ ? "flex flex-col justify-center px-2.5 py-1.5"+ : "flex h-9 items-center gap-2.5 px-2.5",// Lines titles up with the folder name, past its chevron and icon.inFolder && "ps-9",)}@@ -1159,142 +1231,147 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP/>}>- {accessibleTitle}- {inFolder ? null : (- <span- className={cn(- "flex shrink-0 items-center transition-opacity",- (!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}- </span>- )}- {draftIndicator}- {title}- {pinIndicator}- {terminalStatusIcon}- {isRegeneratingTitle ? (- <span role="status" className="sr-only">- Regenerating title- </span>- ) : null}- {sortable?.isDragging ? (- dragDestination- ) : (- <span- className={cn(- "relative ml-auto flex h-6 min-w-8 shrink-0 items-center justify-end",- props.sweepAction !== null && "hidden",- )}- >+ {/* `contents` keeps one-line rows a single flex row. */}+ <div className={multiline ? "flex h-6 min-w-0 items-center gap-2.5" : "contents"}>+ {accessibleTitle}+ {inFolder ? null : (<spanclassName={cn(- "inline-flex justify-end tabular-nums text-secondary-label transition-opacity",- !isWoke && "group-any-hover/sidebar-row:opacity-0",+ "flex shrink-0 items-center transition-opacity",+ (!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",)}>- {variantAction === "unsnooze" && props.snoozeWakeLabelText !== null ? (- <span className="inline-flex items-center gap-1 text-xs text-info-foreground tabular-nums">- {/* The clock tells a wake time from an age at a glance. */}- <AlarmClockIcon aria-hidden className="size-3" />- {props.snoozeWakeLabelText}- </span>- ) : (inFolder ? isWokeStatus : isWoke) ? (+ {props.project ? (+ <ProjectFavicon project={props.project} className="size-4" />+ ) : null}+ </span>+ )}+ {draftIndicator}+ {title}+ {multiline ? titleLineProviderStack : null}+ {pinIndicator}+ {multiline ? null : terminalStatusIcon}+ {isRegeneratingTitle ? (+ <span role="status" className="sr-only">+ Regenerating title+ </span>+ ) : null}+ {sortable?.isDragging ? (+ dragDestination+ ) : (+ <span+ className={cn(+ "relative ml-auto flex h-6 min-w-8 shrink-0 items-center justify-end",+ props.sweepAction !== null && "hidden",+ )}+ >+ <span+ className={cn(+ "inline-flex justify-end tabular-nums text-secondary-label transition-opacity",+ !isWoke && "group-any-hover/sidebar-row:opacity-0",+ )}+ >+ {variantAction === "unsnooze" && props.snoozeWakeLabelText !== null ? (+ <span className="inline-flex items-center gap-1 text-xs text-info-foreground tabular-nums">+ {/* The clock tells a wake time from an age at a glance. */}+ <AlarmClockIcon aria-hidden className="size-3" />+ {props.snoozeWakeLabelText}+ </span>+ ) : (inFolder ? isWokeStatus : isWoke) ? (+ <Tooltip>+ <TooltipTrigger+ render={+ <button+ type="button"+ aria-label="Dismiss Woke notification"+ onClick={handleAcknowledgeWokeClick}+ className="inline-flex cursor-pointer items-center gap-1 rounded-sm text-xs font-medium text-warning-foreground outline-none hover:underline focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"+ >+ <AlarmClockIcon aria-hidden className="size-3" />+ <span role="status">Woke</span>+ </button>+ }+ />+ <TooltipPopup side="top">Dismiss Woke notification</TooltipPopup>+ </Tooltip>+ ) : inFolder && topStatus ? (+ // Folder rows have no status line, so the status takes the time slot.+ <span+ className={cn(+ "inline-flex items-center gap-1 text-xs font-medium",+ topStatus.className,+ )}+ >+ <TopStatusIcon icon={topStatus.icon} className="size-3" />+ {topStatus.label}+ </span>+ ) : (+ <span className="text-xs">+ <RelativeTimeLabel+ timestamp={+ variantAction === "unsettle"+ ? resolveSettledThreadTimestamp(thread)+ : threadTimeTimestamp(thread)+ }+ />+ </span>+ )}+ </span>+ {variantAction === "unsnooze" ? (+ !props.snoozeSupported ? null : (+ <button+ type="button"+ aria-label="Wake thread now"+ onClick={handleUnsnoozeClick}+ onPointerDown={handleActionPointerDown}+ className={cn(+ "pointer-events-none absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",+ isWoke && "group-any-hover/sidebar-row:static",+ )}+ >+ <AlarmClockOffIcon className="mb-px size-3" />+ </button>+ )+ ) : !props.settlementSupported ? null : variantAction === "unsettle" ? (<Tooltip><TooltipTriggerrender={<buttontype="button"- aria-label="Dismiss Woke notification"- onClick={handleAcknowledgeWokeClick}- className="inline-flex cursor-pointer items-center gap-1 rounded-sm text-xs font-medium text-warning-foreground outline-none hover:underline focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"- >- <AlarmClockIcon aria-hidden className="size-3" />- <span role="status">Woke</span>- </button>+ aria-label="Un-settle thread"+ onClick={handleUnsettleClick}+ onPointerDown={handleActionPointerDown}+ className={cn(+ "pointer-events-none absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",+ isWoke && "group-any-hover/sidebar-row:static",+ )}+ />}- />- <TooltipPopup side="top">Dismiss Woke notification</TooltipPopup>+ >+ <Undo2Icon className="mb-px size-3.5" />+ </TooltipTrigger>+ <TooltipPopup side="top">Un-settle thread</TooltipPopup></Tooltip>- ) : inFolder && topStatus ? (- // Folder rows have no status line, so the status takes the time slot.- <span- className={cn(- "inline-flex items-center gap-1 text-xs font-medium",- topStatus.className,- )}- >- <TopStatusIcon icon={topStatus.icon} className="size-3" />- {topStatus.label}- </span>) : (- <span className="text-xs">- <RelativeTimeLabel- timestamp={- variantAction === "unsettle"- ? resolveSettledThreadTimestamp(thread)- : threadTimeTimestamp(thread)- }- />- </span>- )}- </span>- {variantAction === "unsnooze" ? (- !props.snoozeSupported ? null : (<buttontype="button"- aria-label="Wake thread now"- onClick={handleUnsnoozeClick}+ aria-label="Settle thread"+ onClick={handleSettleClick}onPointerDown={handleActionPointerDown}className={cn(- "pointer-events-none absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",+ "pointer-events-none absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",isWoke && "group-any-hover/sidebar-row:static",)}>- <AlarmClockOffIcon className="mb-px size-3" />+ <CheckIcon className="size-3" /></button>- )- ) : !props.settlementSupported ? null : variantAction === "unsettle" ? (- <Tooltip>- <TooltipTrigger- render={- <button- type="button"- aria-label="Un-settle thread"- onClick={handleUnsettleClick}- onPointerDown={handleActionPointerDown}- className={cn(- "pointer-events-none absolute inset-y-0 right-0 -mr-1 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-1.5 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",- isWoke && "group-any-hover/sidebar-row:static",- )}- />- }- >- <Undo2Icon className="mb-px size-3.5" />- </TooltipTrigger>- <TooltipPopup side="top">Un-settle thread</TooltipPopup>- </Tooltip>- ) : (- <button- type="button"- aria-label="Settle thread"- onClick={handleSettleClick}- onPointerDown={handleActionPointerDown}- className={cn(- "pointer-events-none absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",- isWoke && "group-any-hover/sidebar-row:static",- )}- >- <CheckIcon className="size-3" />- </button>- )}- </span>- )}- {props.sweepAction !== null ? dragDestination : null}+ )}+ </span>+ )}+ {props.sweepAction !== null ? dragDestination : null}+ </div>+ {multiline ? metaLine : null}{props.jumpLabel ? <JumpHintBadge label={props.jumpLabel} /> : null}</TooltipTrigger>{detailsTooltip}@@ -1303,16 +1380,6 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP);}- const diff = latestRunDiff(thread);- // Only the provider icon would remain, so the row drops the line instead of leaving it blank.- const metaLineEmpty =- !thread.branch &&- !showsScratchMachine &&- prBadge === null &&- diff === null &&- !isRemote &&- runningTerminalIds.length === 0;-return (<lidata-thread-item={threadKey}@@ -1502,68 +1569,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowPRegenerating title</span>) : null}- {metaLineEmpty ? (- <span aria-hidden className="inline-flex shrink-0">- <SidebarProviderStack- thread={thread}- providerEntryByInstanceId={props.providerEntryByInstanceId}- />- </span>- ) : null}+ {titleLineProviderStack}</div>- {metaLineEmpty ? null : (- <div className="mt-0.5 flex min-w-0 items-center gap-1.5 text-secondary-label text-xs">- {thread.branch ? (- <>- <ThreadWorktreeIndicator thread={thread} />- <span className="flex min-w-0 flex-1">- <MiddleTruncate value={thread.branch} showTitle={false} />- </span>- </>- ) : showsScratchMachine ? (- <>- <EnvironmentMachineIcon- aria-hidden- kind={props.environmentMachine}- className="size-3 shrink-0"- />- <span className="min-w-0 flex-1 truncate">{props.scratchMachineLabel}</span>- </>- ) : (- <span className="flex-1" />- )}- {terminalStatusIcon}- {prBadge}- {diff ? (- <span className="shrink-0 font-mono">- <span className="text-diff-addition-foreground">- +{formatDiffCount(diff.insertions)}- </span>{" "}- <span className="text-diff-deletion-foreground">- −{formatDiffCount(diff.deletions)}- </span>- </span>- ) : null}- <span- aria-hidden- className="pointer-events-none ml-auto inline-flex shrink-0 items-center gap-1"- >- {isRemote && !showsScratchMachine ? (- <span className="inline-flex shrink-0 items-center text-sidebar-muted-foreground/70">- <EnvironmentMachineIcon- aria-hidden- kind={props.environmentMachine}- className="size-3.5"- />- </span>- ) : null}- <SidebarProviderStack- thread={thread}- providerEntryByInstanceId={props.providerEntryByInstanceId}- />- </span>- </div>- )}+ {metaLine}</div>{props.jumpLabel ? <JumpHintBadge label={props.jumpLabel} /> : null}</TooltipTrigger>diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.tsindex 48ddc9d43b5..c6a59445d66 100644--- a/packages/contracts/src/settings.ts+++ b/packages/contracts/src/settings.ts@@ -474,6 +474,9 @@ export const ClientSettingsSchema = Schema.Struct({proactivePanelsEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),showSkillsInSlashMenu: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),boringSidebarEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),+ boringSidebarMultilineRows: Schema.Boolean.pipe(+ Schema.withDecodingDefault(Effect.succeed(false)),+ ),// Opt-in for the removed legacy sidebar. Still read so those users land in// the boring sidebar; the boring sidebar toggle clears it.legacySidebarEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),@@ -1707,6 +1710,7 @@ export const ClientSettingsPatch = Schema.Struct({proactivePanelsEnabled: Schema.optionalKey(Schema.Boolean),showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),boringSidebarEnabled: Schema.optionalKey(Schema.Boolean),+ boringSidebarMultilineRows: Schema.optionalKey(Schema.Boolean),legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),sidebarWorkingShelfEnabled: Schema.optionalKey(Schema.Boolean),sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),