revert(web): remove the compact sidebar (#11685)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
1bbca0e782
commit
d81278aa6b
22 files changed
+208
-1036
No files matched your search
@@ -57,7 +57,6 @@ const clientSettings: ClientSettings = {
|
||||
proactivePanelsEnabled: true,
|
||||
showSkillsInSlashMenu: false,
|
||||
providerModelPreferences: {},
|
||||
sidebarCompactThreadRows: false,
|
||||
sidebarProjectGroupingMode: "repository_path",
|
||||
sidebarProjectGroupingOverrides: {
|
||||
"environment-1:/tmp/project-a": "separate",
|
||||
|
||||
@@ -14,11 +14,7 @@ import { getLocalStorageItem, removeLocalStorageItem } from "../hooks/useLocalSt
|
||||
import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
|
||||
import { cn, isMacPlatform } from "../lib/utils";
|
||||
import { primaryServerKeybindingsAtom } from "../state/server";
|
||||
import {
|
||||
useCompactSidebarEnabled,
|
||||
useEnvironmentIdentificationMode,
|
||||
useLegacySidebarEnabled,
|
||||
} from "../hooks/useSettings";
|
||||
import { useEnvironmentIdentificationMode, useLegacySidebarEnabled } from "../hooks/useSettings";
|
||||
import {
|
||||
PanelAnimationSuppressionProvider,
|
||||
usePanelAnimationSettings,
|
||||
@@ -148,7 +144,6 @@ function ProjectProjectionRetention() {
|
||||
export function AppSidebarLayout({ children }: { children: ReactNode }) {
|
||||
const navigate = useNavigate();
|
||||
const legacySidebarEnabled = useLegacySidebarEnabled();
|
||||
const compactSidebarEnabled = useCompactSidebarEnabled();
|
||||
const { active: panelAnimationsActive, durationMs: panelAnimationDurationMs } =
|
||||
usePanelAnimationSettings();
|
||||
// Settings routes show the settings nav in place of whichever thread
|
||||
@@ -234,7 +229,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
|
||||
<ProjectProjectionRetention />
|
||||
<Sidebar
|
||||
side="left"
|
||||
collapsible={compactSidebarEnabled ? "icon" : "offcanvas"}
|
||||
collapsible="offcanvas"
|
||||
data-app-sidebar=""
|
||||
className="border-r border-sidebar-border bg-sidebar text-sidebar-foreground"
|
||||
resizable={{
|
||||
|
||||
@@ -199,11 +199,7 @@ import { SidebarChromeFooter, SidebarChromeHeader } from "./sidebar/SidebarChrom
|
||||
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
|
||||
import { useIsMobile } from "~/hooks/useMediaQuery";
|
||||
import { CommandDialogTrigger } from "./ui/command";
|
||||
import {
|
||||
useClientSettings,
|
||||
useCompactSidebarEnabled,
|
||||
useUpdateClientSettings,
|
||||
} from "~/hooks/useSettings";
|
||||
import { useClientSettings, useUpdateClientSettings } from "~/hooks/useSettings";
|
||||
import { primaryServerKeybindingsAtom } from "../state/server";
|
||||
import {
|
||||
derivePhysicalProjectKey,
|
||||
@@ -1198,9 +1194,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
const router = useRouter();
|
||||
const queuePendingFileDrop = useSidebarPendingFileDropStore((s) => s.queuePendingFileDrop);
|
||||
const clearPendingFileDrop = useSidebarPendingFileDropStore((s) => s.clearPendingFileDrop);
|
||||
const { isMobile, setOpenMobile, state, setOpen } = useSidebar();
|
||||
const compactSidebarEnabled = useCompactSidebarEnabled();
|
||||
const isCompact = compactSidebarEnabled && !isMobile && state === "collapsed";
|
||||
const { isMobile, setOpenMobile } = useSidebar();
|
||||
const markThreadUnread = useUiStateStore((state) => state.markThreadUnread);
|
||||
const setProjectExpanded = useUiStateStore((state) => state.setProjectExpanded);
|
||||
const toggleThreadSelection = useThreadSelectionStore((state) => state.toggleThread);
|
||||
@@ -1451,13 +1445,10 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
if (useThreadSelectionStore.getState().hasSelection()) {
|
||||
clearSelection();
|
||||
}
|
||||
setProjectExpanded(projectPreferenceKeys, isCompact || !projectExpanded);
|
||||
if (isCompact) setOpen(true);
|
||||
setProjectExpanded(projectPreferenceKeys, !projectExpanded);
|
||||
},
|
||||
[
|
||||
clearSelection,
|
||||
isCompact,
|
||||
setOpen,
|
||||
dragInProgressRef,
|
||||
projectExpanded,
|
||||
projectPreferenceKeys,
|
||||
@@ -1474,17 +1465,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
if (dragInProgressRef.current) {
|
||||
return;
|
||||
}
|
||||
setProjectExpanded(projectPreferenceKeys, isCompact || !projectExpanded);
|
||||
if (isCompact) setOpen(true);
|
||||
setProjectExpanded(projectPreferenceKeys, !projectExpanded);
|
||||
},
|
||||
[
|
||||
dragInProgressRef,
|
||||
isCompact,
|
||||
projectExpanded,
|
||||
projectPreferenceKeys,
|
||||
setOpen,
|
||||
setProjectExpanded,
|
||||
],
|
||||
[dragInProgressRef, projectExpanded, projectPreferenceKeys, setProjectExpanded],
|
||||
);
|
||||
|
||||
const handleProjectButtonPointerDownCapture = useCallback(
|
||||
@@ -2376,10 +2359,8 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
<>
|
||||
<div className="group/project-header relative">
|
||||
<SidebarMenuButton
|
||||
tooltip={project.displayName}
|
||||
aria-label={project.displayName}
|
||||
ref={isManualProjectSorting ? dragHandleProps?.setActivatorNodeRef : undefined}
|
||||
className={`pr-8 group-hover/project-header:bg-sidebar-row-hover group-hover/project-header:text-sidebar-foreground max-sm:pr-14 group-data-[collapsible=icon]:justify-center ${
|
||||
className={`pr-8 group-hover/project-header:bg-sidebar-row-hover group-hover/project-header:text-sidebar-foreground max-sm:pr-14 ${
|
||||
isManualProjectSorting ? "cursor-grab active:cursor-grabbing" : ""
|
||||
}`}
|
||||
{...(isManualProjectSorting && dragHandleProps ? dragHandleProps.attributes : {})}
|
||||
@@ -2389,7 +2370,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
onKeyDown={handleProjectButtonKeyDown}
|
||||
onContextMenu={handleProjectButtonContextMenu}
|
||||
>
|
||||
{isCompact ? null : !projectExpanded && projectStatus ? (
|
||||
{!projectExpanded && projectStatus ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
@@ -2420,7 +2401,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
<span className="flex shrink-0">
|
||||
<ProjectFavicon project={project} />
|
||||
</span>
|
||||
<span className="flex min-w-0 flex-1 items-center gap-2 group-data-[collapsible=icon]:hidden">
|
||||
<span className="flex min-w-0 flex-1 items-center gap-2">
|
||||
<span className="truncate text-sm font-medium text-sidebar-foreground/90">
|
||||
{project.displayName}
|
||||
</span>
|
||||
@@ -2434,7 +2415,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
{/* Environment badge – visible by default, crossfades with the
|
||||
"new thread" button on hover using the same pointer-events +
|
||||
opacity pattern as the thread row archive/timestamp swap. */}
|
||||
{!isCompact && project.environmentPresence === "remote-only" && (
|
||||
{project.environmentPresence === "remote-only" && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
@@ -2460,7 +2441,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<div className="pointer-events-none absolute top-[calc(50%+1px)] right-0.5 -translate-y-1/2 opacity-0 transition-opacity duration-150 max-sm:pointer-events-auto max-sm:opacity-100 group-hover/project-header:pointer-events-auto group-hover/project-header:opacity-100 group-focus-within/project-header:pointer-events-auto group-focus-within/project-header:opacity-100 group-data-[collapsible=icon]:hidden">
|
||||
<div className="pointer-events-none absolute top-[calc(50%+1px)] right-0.5 -translate-y-1/2 opacity-0 transition-opacity duration-150 max-sm:pointer-events-auto max-sm:opacity-100 group-hover/project-header:pointer-events-auto group-hover/project-header:opacity-100 group-focus-within/project-header:pointer-events-auto group-focus-within/project-header:opacity-100">
|
||||
<button
|
||||
type="button"
|
||||
aria-label={`Create new thread in ${project.displayName}`}
|
||||
@@ -2693,7 +2674,7 @@ function LocalSecondaryStatus() {
|
||||
}
|
||||
|
||||
return (
|
||||
<SidebarGroup className="px-2 pt-2 pb-0 group-data-[collapsible=icon]:hidden">
|
||||
<SidebarGroup className="px-2 pt-2 pb-0">
|
||||
{connecting.length > 0 ? (
|
||||
<Alert
|
||||
variant="default"
|
||||
@@ -2997,16 +2978,14 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
render={
|
||||
<SidebarMenuButton
|
||||
className="focus-visible:ring-0"
|
||||
tooltip="Search"
|
||||
aria-label="Search"
|
||||
data-testid="command-palette-trigger"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<SearchIcon />
|
||||
<span className="flex-1 truncate group-data-[collapsible=icon]:hidden">Search</span>
|
||||
<span className="flex-1 truncate">Search</span>
|
||||
{commandPaletteShortcutLabel ? (
|
||||
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px] group-data-[collapsible=icon]:hidden">
|
||||
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px]">
|
||||
{commandPaletteShortcutLabel}
|
||||
</Kbd>
|
||||
) : null}
|
||||
@@ -3017,7 +2996,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
}
|
||||
>
|
||||
{showArm64IntelBuildWarning && arm64IntelBuildWarningDescription ? (
|
||||
<SidebarGroup className="px-2 pt-2 pb-0 group-data-[collapsible=icon]:hidden">
|
||||
<SidebarGroup className="px-2 pt-2 pb-0">
|
||||
<Alert variant="warning" className="rounded-2xl border-warning/40 bg-warning/8">
|
||||
<TriangleAlertIcon />
|
||||
<AlertTitle>Intel build on Apple Silicon</AlertTitle>
|
||||
@@ -3041,21 +3020,17 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
) : null}
|
||||
<LocalSecondaryStatus />
|
||||
<SidebarGroup className="px-2 py-2">
|
||||
<div className="mb-1 flex items-center justify-between pl-2 pr-1.5 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:px-0">
|
||||
<span className="text-xs font-medium text-sidebar-muted-foreground/80 group-data-[collapsible=icon]:hidden">
|
||||
Projects
|
||||
</span>
|
||||
<div className="mb-1 flex items-center justify-between pl-2 pr-1.5">
|
||||
<span className="text-xs font-medium text-sidebar-muted-foreground/80">Projects</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<div className="group-data-[collapsible=icon]:hidden">
|
||||
<ProjectSortMenu
|
||||
projectSortOrder={projectSortOrder}
|
||||
threadSortOrder={threadSortOrder}
|
||||
threadPreviewCount={threadPreviewCount}
|
||||
onProjectSortOrderChange={handleProjectSortOrderChange}
|
||||
onThreadSortOrderChange={handleThreadSortOrderChange}
|
||||
onThreadPreviewCountChange={handleThreadPreviewCountChange}
|
||||
/>
|
||||
</div>
|
||||
<ProjectSortMenu
|
||||
projectSortOrder={projectSortOrder}
|
||||
threadSortOrder={threadSortOrder}
|
||||
threadPreviewCount={threadPreviewCount}
|
||||
onProjectSortOrderChange={handleProjectSortOrderChange}
|
||||
onThreadSortOrderChange={handleThreadSortOrderChange}
|
||||
onThreadPreviewCountChange={handleThreadPreviewCountChange}
|
||||
/>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
@@ -3152,9 +3127,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
|
||||
)}
|
||||
|
||||
{projectsLength === 0 && (
|
||||
<div className="px-2 pt-4 text-center text-secondary-label text-xs group-data-[collapsible=icon]:hidden">
|
||||
No projects yet
|
||||
</div>
|
||||
<div className="px-2 pt-4 text-center text-secondary-label text-xs">No projects yet</div>
|
||||
)}
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
|
||||
@@ -103,7 +103,6 @@ export function createSidebarSortingStrategy(input: {
|
||||
snoozedThreadCount?: number;
|
||||
cardHeight?: number;
|
||||
slimHeight?: number;
|
||||
compact?: boolean;
|
||||
/** Space each pinned boundary opens for its label while dragging. The
|
||||
* markers stay zero height at rest, so nothing is reserved until pickup. */
|
||||
boundaryLabelHeight?: number;
|
||||
@@ -141,14 +140,11 @@ export function createSidebarSortingStrategy(input: {
|
||||
else slimHeight ??= rects[index]?.height;
|
||||
if (item.key !== active.key) groups[item.section].push(item);
|
||||
}
|
||||
// Compact icons use h-7; expanded cards include their vertical padding.
|
||||
const scale = input.compact
|
||||
? (cardHeight ?? slimHeight ?? 28) / 28
|
||||
: slimHeight !== undefined
|
||||
? slimHeight / 36
|
||||
: (headerScale ?? (cardHeight ?? 82) / 82);
|
||||
cardHeight ??= (input.compact ? 28 : 82) * scale;
|
||||
slimHeight ??= (input.compact ? 28 : 36) * scale;
|
||||
// Cards are 4.875rem + 0.25rem padding; slim rows/placeholders are h-9.
|
||||
const scale =
|
||||
slimHeight !== undefined ? slimHeight / 36 : (headerScale ?? (cardHeight ?? 82) / 82);
|
||||
cardHeight ??= 82 * scale;
|
||||
slimHeight ??= 36 * scale;
|
||||
const labelHeight = (input.boundaryLabelHeight ?? 0) * scale;
|
||||
const group = groups[target.section];
|
||||
const order =
|
||||
@@ -222,11 +218,7 @@ export function createSidebarSortingStrategy(input: {
|
||||
// Consume the shelf's auto margin as drag labels and resized rows need
|
||||
// room, keeping the combined shelves at their measured bottom.
|
||||
let shelfSpace =
|
||||
!input.compact &&
|
||||
shelfRect &&
|
||||
beforeShelf &&
|
||||
lastRect &&
|
||||
shelfRect.top > beforeShelf.bottom + 1
|
||||
shelfRect && beforeShelf && lastRect && shelfRect.top > beforeShelf.bottom + 1
|
||||
? Math.max(
|
||||
0,
|
||||
lastRect.bottom - rects[0].top - heights.reduce((sum, height) => sum + height + 1, -1),
|
||||
|
||||
+139
-603
File diff suppressed because it is too large.
Load diff
@@ -144,17 +144,14 @@ export function ThreadPullRequestBadgeControl({
|
||||
number,
|
||||
url,
|
||||
status,
|
||||
iconOnly = false,
|
||||
onOpenStack,
|
||||
onOpenPullRequest,
|
||||
}: {
|
||||
variant: "underline" | "ghost" | "badge";
|
||||
variant: "underline" | "ghost";
|
||||
badge: ThreadPullRequestBadge | null;
|
||||
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;
|
||||
}) {
|
||||
@@ -171,9 +168,7 @@ export function ThreadPullRequestBadgeControl({
|
||||
const className = cn(
|
||||
variant === "ghost"
|
||||
? buttonVariants({ variant: "ghost", size: "xs" })
|
||||
: variant === "badge"
|
||||
? "inline-flex size-3 shrink-0 cursor-pointer items-center justify-center rounded-full bg-sidebar ring-1 ring-sidebar outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
: "inline-flex shrink-0 cursor-pointer items-center gap-0.5 whitespace-nowrap border-b border-transparent hover:border-current focus-visible:outline-2 focus-visible:outline-ring",
|
||||
: "inline-flex shrink-0 cursor-pointer items-center gap-0.5 whitespace-nowrap border-b border-transparent hover:border-current focus-visible:outline-2 focus-visible:outline-ring",
|
||||
"text-xs tabular-nums",
|
||||
variant === "ghost" &&
|
||||
"font-normal text-xs! active:scale-100 [--control-icon-color:currentColor]",
|
||||
@@ -183,11 +178,8 @@ export function ThreadPullRequestBadgeControl({
|
||||
);
|
||||
const content = (
|
||||
<>
|
||||
<ThreadPullRequestBadgeIcon
|
||||
icon={badge?.kind ?? "pull-request"}
|
||||
className={variant === "badge" ? "size-2.5" : undefined}
|
||||
/>
|
||||
{iconOnly ? null : isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
|
||||
<ThreadPullRequestBadgeIcon icon={badge?.kind ?? "pull-request"} />
|
||||
{isStack ? badge.layers : linkedCount !== null ? `+${linkedCount}` : number}
|
||||
</>
|
||||
);
|
||||
return (
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
|
||||
export function CompactSidebarPreview({
|
||||
railEnabled,
|
||||
compactRows,
|
||||
}: {
|
||||
railEnabled: boolean;
|
||||
compactRows: boolean;
|
||||
}) {
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const sidebarRef = useRef<HTMLSpanElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
||||
const animation = sidebarRef.current?.animate(
|
||||
[
|
||||
{ width: "36px", offset: 0 },
|
||||
{ width: railEnabled ? "12px" : "0px", offset: 0.45 },
|
||||
{ width: railEnabled ? "12px" : "0px", offset: 0.6 },
|
||||
{ width: "36px", offset: 1 },
|
||||
],
|
||||
{ duration: 800, easing: "ease-in-out" },
|
||||
);
|
||||
return () => animation?.cancel();
|
||||
}, [railEnabled, compactRows]);
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Toggle compact sidebar preview"
|
||||
aria-pressed={collapsed}
|
||||
className="group/compact-preview relative flex h-10 w-full cursor-pointer overflow-hidden rounded-lg border border-border bg-background p-1 shadow-xs/5 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background"
|
||||
onClick={() => {
|
||||
sidebarRef.current?.getAnimations().forEach((animation) => animation.cancel());
|
||||
setCollapsed((value) => !value);
|
||||
}}
|
||||
>
|
||||
<span
|
||||
ref={sidebarRef}
|
||||
aria-hidden
|
||||
className={cn(
|
||||
"flex h-full shrink-0 flex-col justify-center gap-1 overflow-hidden rounded-md bg-sidebar transition-[width] duration-250 ease-out motion-reduce:transition-none",
|
||||
collapsed ? (railEnabled ? "w-3" : "w-0") : "w-9",
|
||||
)}
|
||||
>
|
||||
{(compactRows ? [0, 1, 2, 3] : [0, 1, 2]).map((row) => (
|
||||
<span key={row} className="flex shrink-0 items-start gap-1 px-1">
|
||||
<span className="size-1 shrink-0 rounded-[1px] bg-muted-foreground/50" />
|
||||
<span
|
||||
className={cn(
|
||||
"flex shrink-0 flex-col gap-0.5 transition-opacity duration-250 ease-out motion-reduce:transition-none",
|
||||
collapsed && "opacity-0",
|
||||
)}
|
||||
>
|
||||
<span className="h-0.5 w-4 rounded-full bg-muted-foreground/25" />
|
||||
{!compactRows && <span className="h-0.5 w-2 rounded-full bg-muted-foreground/15" />}
|
||||
</span>
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
<span aria-hidden className="flex min-w-0 flex-1 flex-col gap-1 px-1 pt-1">
|
||||
<span className="h-0.5 w-full rounded-full bg-muted-foreground/25" />
|
||||
<span className="h-0.5 w-4/5 rounded-full bg-muted-foreground/20" />
|
||||
<span className="h-0.5 w-3/5 rounded-full bg-muted-foreground/15" />
|
||||
</span>
|
||||
<span
|
||||
aria-hidden
|
||||
className={cn(
|
||||
"pointer-events-none absolute top-3 left-5 flex w-9 flex-col gap-1 rounded-sm border border-border bg-popover p-1 opacity-0 shadow-xs transition-opacity duration-150 ease-out motion-reduce:transition-none",
|
||||
collapsed &&
|
||||
railEnabled &&
|
||||
"group-hover/compact-preview:opacity-100 group-focus-visible/compact-preview:opacity-100",
|
||||
)}
|
||||
>
|
||||
<span className="h-0.5 w-full rounded-full bg-popover-foreground/45" />
|
||||
<span className="h-0.5 w-2/3 rounded-full bg-popover-foreground/25" />
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -170,7 +170,6 @@ import {
|
||||
import { searchableSetting } from "./settingsSearch";
|
||||
import { ProjectFavicon } from "../ProjectFavicon";
|
||||
import { PanelAnimationsPreview } from "./PanelAnimationsPreview";
|
||||
import { CompactSidebarPreview } from "./CompactSidebarPreview";
|
||||
|
||||
const ENVIRONMENT_IDENTIFICATION_LABELS: Record<EnvironmentIdentificationMode, string> = {
|
||||
artwork: "Artwork",
|
||||
@@ -524,10 +523,6 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
...(theme !== "system" ? ["Theme"] : []),
|
||||
...(!followSystem ? ["Follow system"] : []),
|
||||
...(themeHalves !== null ? ["Theme mix"] : []),
|
||||
...(settings.compactSidebarEnabled !== DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled ||
|
||||
settings.sidebarCompactThreadRows !== DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows
|
||||
? ["Compact sidebar"]
|
||||
: []),
|
||||
...(settings.appearanceContrast !== DEFAULT_UNIFIED_SETTINGS.appearanceContrast
|
||||
? ["Contrast"]
|
||||
: []),
|
||||
@@ -634,7 +629,6 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
settings.browserLinkTarget,
|
||||
settings.browserAutoShowFloatingPreview,
|
||||
settings.appearanceContrast,
|
||||
settings.compactSidebarEnabled,
|
||||
settings.diffColorScheme,
|
||||
settings.enableAgentBrowserAccess,
|
||||
settings.confirmQuit,
|
||||
@@ -666,7 +660,6 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
settings.continueThreadsAfterServerUpdate,
|
||||
settings.sidebarAutoSettleAfterDays,
|
||||
settings.sidebarAutoSettleOnMerge,
|
||||
settings.sidebarCompactThreadRows,
|
||||
settings.sidebarProjectGroupingMode,
|
||||
settings.sidebarThreadPreviewCount,
|
||||
settings.showSkillsInSlashMenu,
|
||||
@@ -744,7 +737,6 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
}
|
||||
updateSettings({
|
||||
appearanceContrast: DEFAULT_UNIFIED_SETTINGS.appearanceContrast,
|
||||
compactSidebarEnabled: DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled,
|
||||
diffColorScheme: DEFAULT_UNIFIED_SETTINGS.diffColorScheme,
|
||||
timestampFormat: DEFAULT_UNIFIED_SETTINGS.timestampFormat,
|
||||
notificationMode: DEFAULT_UNIFIED_SETTINGS.notificationMode,
|
||||
@@ -762,7 +754,6 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
panelAnimationDurationMs: DEFAULT_UNIFIED_SETTINGS.panelAnimationDurationMs,
|
||||
sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,
|
||||
sidebarProjectGroupingMode: DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode,
|
||||
sidebarCompactThreadRows: DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows,
|
||||
sidebarAutoSettleAfterDays: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays,
|
||||
sidebarAutoSettleOnMerge: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge,
|
||||
responseStreamingMode: DEFAULT_UNIFIED_SETTINGS.responseStreamingMode,
|
||||
@@ -1143,19 +1134,6 @@ export function AppearanceSettingsPanel() {
|
||||
const [isImportThemeOpen, setIsImportThemeOpen] = useState(false);
|
||||
const settings = useScopedSettings();
|
||||
const updateSettings = useUpdateScopedSettings();
|
||||
const compactSidebarMode = settings.compactSidebarEnabled
|
||||
? settings.sidebarCompactThreadRows
|
||||
? "both"
|
||||
: "rail"
|
||||
: settings.sidebarCompactThreadRows
|
||||
? "threads"
|
||||
: "off";
|
||||
const compactSidebarModes = {
|
||||
off: "Off",
|
||||
rail: "Rail only",
|
||||
threads: "Threads only",
|
||||
both: "Both",
|
||||
};
|
||||
const environmentStageLabel = useEnvironmentStageLabel();
|
||||
const showEnvironmentIdentification =
|
||||
resolveEnvironmentIdentificationPillLabel(environmentStageLabel) !== null;
|
||||
@@ -1442,64 +1420,6 @@ export function AppearanceSettingsPanel() {
|
||||
/>
|
||||
</SettingsSection>
|
||||
|
||||
<SettingsSection id="appearance-sidebar" title="Sidebar">
|
||||
<SettingsRow
|
||||
{...searchableSetting("compact-sidebar")}
|
||||
description="Choose a collapsed icon rail, denser thread rows, or both. Click the preview to collapse or expand."
|
||||
resetAction={
|
||||
settings.compactSidebarEnabled !== DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled ||
|
||||
settings.sidebarCompactThreadRows !==
|
||||
DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows ? (
|
||||
<SettingResetButton
|
||||
label="compact sidebar"
|
||||
onClick={() =>
|
||||
updateSettings({
|
||||
compactSidebarEnabled: DEFAULT_UNIFIED_SETTINGS.compactSidebarEnabled,
|
||||
sidebarCompactThreadRows: DEFAULT_UNIFIED_SETTINGS.sidebarCompactThreadRows,
|
||||
})
|
||||
}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
control={
|
||||
<div className="grid w-full grid-cols-[5rem_1fr] items-center gap-3 sm:w-auto sm:grid-cols-[7rem_10rem] sm:gap-4">
|
||||
<CompactSidebarPreview
|
||||
key={compactSidebarMode}
|
||||
railEnabled={settings.compactSidebarEnabled}
|
||||
compactRows={settings.sidebarCompactThreadRows}
|
||||
/>
|
||||
<Select
|
||||
value={compactSidebarMode}
|
||||
onValueChange={(value) => {
|
||||
if (
|
||||
value !== "off" &&
|
||||
value !== "rail" &&
|
||||
value !== "threads" &&
|
||||
value !== "both"
|
||||
)
|
||||
return;
|
||||
updateSettings({
|
||||
compactSidebarEnabled: value === "rail" || value === "both",
|
||||
sidebarCompactThreadRows: value === "threads" || value === "both",
|
||||
});
|
||||
}}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full" aria-label="Compact sidebar">
|
||||
<SelectValue>{compactSidebarModes[compactSidebarMode]}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectPopup align="end" alignItemWithTrigger={false}>
|
||||
{Object.entries(compactSidebarModes).map(([value, label]) => (
|
||||
<SelectItem key={value} hideIndicator value={value}>
|
||||
{label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectPopup>
|
||||
</Select>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</SettingsSection>
|
||||
|
||||
<TypographySection />
|
||||
</SettingsPageContainer>
|
||||
);
|
||||
|
||||
@@ -24,7 +24,6 @@ import {
|
||||
XIcon,
|
||||
} from "lucide-react";
|
||||
import { useLocation, useNavigate } from "@tanstack/react-router";
|
||||
import { useCompactSidebarEnabled } from "../../hooks/useSettings";
|
||||
|
||||
import { Button } from "../ui/button";
|
||||
import { Input } from "../ui/input";
|
||||
@@ -112,13 +111,12 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
(item) => item.to !== "/settings/projects" || isSettingsOverviewVisible(scopeSearch),
|
||||
);
|
||||
const { isMobile, setOpenMobile, open, setOpen } = useSidebar();
|
||||
const compactSidebarEnabled = useCompactSidebarEnabled();
|
||||
const searchInputRef = useRef<HTMLInputElement>(null);
|
||||
const [query, setQuery] = useState("");
|
||||
const [activeResultIndex, setActiveResultIndex] = useState(0);
|
||||
const searchableItems = useAvailableSettingsSearchItems();
|
||||
const results = useMemo(() => searchSettings(query, searchableItems), [query, searchableItems]);
|
||||
const isSearching = query.trim().length > 0 && !(compactSidebarEnabled && !isMobile && !open);
|
||||
const isSearching = query.trim().length > 0;
|
||||
const hasResults = results.length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -235,18 +233,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
<>
|
||||
<SidebarContent className="overflow-x-hidden">
|
||||
<SidebarGroup className="gap-2 p-[var(--sidebar-content-inset)]">
|
||||
<SidebarMenuButton
|
||||
className="hidden group-data-[collapsible=icon]:flex"
|
||||
aria-label="Search settings"
|
||||
tooltip="Search settings"
|
||||
onClick={() => {
|
||||
setOpen(true);
|
||||
requestAnimationFrame(() => searchInputRef.current?.focus());
|
||||
}}
|
||||
>
|
||||
<SearchIcon />
|
||||
</SidebarMenuButton>
|
||||
<div className="flex h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground group-data-[collapsible=icon]:hidden">
|
||||
<div className="flex h-8 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground">
|
||||
<SearchIcon className="size-4 shrink-0 text-sidebar-muted-foreground/80" />
|
||||
<Input
|
||||
ref={searchInputRef}
|
||||
@@ -343,14 +330,10 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
<SidebarMenuItem key={item.to}>
|
||||
<SidebarMenuButton
|
||||
isActive={isActive}
|
||||
aria-label={item.label}
|
||||
tooltip={item.label}
|
||||
onClick={() => handleSectionClick(item.to)}
|
||||
>
|
||||
<Icon />
|
||||
<span className="truncate group-data-[collapsible=icon]:hidden">
|
||||
{item.label}
|
||||
</span>
|
||||
<span className="truncate">{item.label}</span>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
);
|
||||
@@ -360,12 +343,10 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
<SidebarFooter className="px-[var(--sidebar-content-inset)] py-1">
|
||||
<div className="contents group-data-[collapsible=icon]:hidden">
|
||||
<Suspense fallback={null}>
|
||||
<T3ConnectSidebarSignIn />
|
||||
</Suspense>
|
||||
</div>
|
||||
<div className="flex items-center gap-1 group-data-[collapsible=icon]:flex-col">
|
||||
<Suspense fallback={null}>
|
||||
<T3ConnectSidebarSignIn />
|
||||
</Suspense>
|
||||
<div className="flex items-center gap-1">
|
||||
<div className="min-w-0 flex-1">
|
||||
<SidebarUtilityMenu />
|
||||
</div>
|
||||
|
||||
@@ -159,14 +159,6 @@ export const SETTINGS_SEARCH_ITEMS = [
|
||||
title: "Panel animations",
|
||||
to: "/settings/appearance",
|
||||
},
|
||||
{
|
||||
id: "compact-sidebar",
|
||||
title: "Compact sidebar",
|
||||
to: "/settings/appearance",
|
||||
searchTerms: [
|
||||
"collapsed icons rail hover navigation preview expanded dense density one line rows chats threads compact thread list",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "environment-identification",
|
||||
title: "Environment identification",
|
||||
|
||||
@@ -86,7 +86,7 @@ function SidebarBrand({ onBackdrop }: { onBackdrop: boolean }) {
|
||||
<Link
|
||||
aria-label="Go to threads"
|
||||
className={cn(
|
||||
"relative z-10 ml-[var(--workspace-titlebar-content-left)] hidden h-7 w-fit min-w-0 shrink-0 items-center overflow-hidden rounded-md outline-hidden ring-ring focus-visible:ring-2 md:flex group-data-[collapsible=icon]:hidden",
|
||||
"relative z-10 ml-[var(--workspace-titlebar-content-left)] hidden h-7 w-fit min-w-0 shrink-0 items-center overflow-hidden rounded-md outline-hidden ring-ring focus-visible:ring-2 md:flex",
|
||||
onBackdrop ? "text-white" : "text-foreground",
|
||||
)}
|
||||
to="/"
|
||||
@@ -187,12 +187,12 @@ export const SidebarUtilityMenu = memo(function SidebarUtilityMenu() {
|
||||
}, [canGoBack, closeMobileSidebar, navigate]);
|
||||
|
||||
return (
|
||||
<SidebarMenu className="flex-row items-center group-data-[collapsible=icon]:flex-col">
|
||||
<SidebarMenu className="flex-row items-center">
|
||||
{currentFooterPage ? (
|
||||
<SidebarMenuItem className="min-w-0 flex-1">
|
||||
<SidebarMenuButton onClick={handleBackClick} aria-label="Back" tooltip="Back">
|
||||
<SidebarMenuButton onClick={handleBackClick}>
|
||||
<ArrowLeftIcon />
|
||||
<span className="group-data-[collapsible=icon]:hidden">Back</span>
|
||||
<span>Back</span>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
) : (
|
||||
@@ -224,10 +224,8 @@ export const SidebarUtilityMenu = memo(function SidebarUtilityMenu() {
|
||||
export const SidebarChromeFooter = memo(function SidebarChromeFooter() {
|
||||
return (
|
||||
<SidebarFooter className="px-[var(--sidebar-content-inset)] py-1">
|
||||
<div className="contents group-data-[collapsible=icon]:hidden">
|
||||
<SidebarProviderUpdatePill />
|
||||
<SidebarUpdateArchitectureWarning />
|
||||
</div>
|
||||
<SidebarProviderUpdatePill />
|
||||
<SidebarUpdateArchitectureWarning />
|
||||
<SidebarUtilityMenu />
|
||||
</SidebarFooter>
|
||||
);
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
import { act, memo } from "react";
|
||||
import { create, type ReactTestRenderer } from "react-test-renderer";
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vite-plus/test";
|
||||
|
||||
import { SidebarCompletedTime } from "./SidebarCompletedTime";
|
||||
|
||||
let renderer: ReactTestRenderer | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
vi.setSystemTime(new Date("2026-09-07T01:01:00Z"));
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
vi.stubGlobal("window", {
|
||||
setTimeout,
|
||||
clearTimeout,
|
||||
setInterval,
|
||||
clearInterval,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await act(() => renderer?.unmount());
|
||||
renderer = undefined;
|
||||
vi.unstubAllGlobals();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("advances visible and accessible completion times without rerendering its memoized row", async () => {
|
||||
const rowRender = vi.fn();
|
||||
const Row = memo(function Row() {
|
||||
rowRender();
|
||||
return <SidebarCompletedTime completedAt="2026-09-07T01:00:00Z" />;
|
||||
});
|
||||
await act(() => {
|
||||
renderer = create(<Row />);
|
||||
});
|
||||
expect(renderer!.root.findByType("time").props.dateTime).toBe("2026-09-07T01:00:00Z");
|
||||
expect(renderer!.root.findByProps({ className: "sr-only" }).children).toEqual(["Completed "]);
|
||||
expect(
|
||||
renderer!.root.findAll((node) => node.props.role === "status" || node.props["aria-live"]),
|
||||
).toHaveLength(0);
|
||||
expect(renderer!.root.findByProps({ className: "text-secondary-label" }).children).toEqual([
|
||||
"1m",
|
||||
]);
|
||||
|
||||
await act(() => vi.advanceTimersByTime(60_000));
|
||||
|
||||
expect(renderer!.root.findByProps({ className: "sr-only" }).children).toEqual(["Completed "]);
|
||||
expect(renderer!.root.findByProps({ className: "text-secondary-label" }).children).toEqual([
|
||||
"2m",
|
||||
]);
|
||||
expect(rowRender).toHaveBeenCalledTimes(1);
|
||||
await act(() => renderer!.unmount());
|
||||
renderer = undefined;
|
||||
expect(vi.getTimerCount()).toBe(0);
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import { useNowMinute } from "../../hooks/useNowMinute";
|
||||
import { formatRelativeTimeLabel } from "../../timestampFormat";
|
||||
|
||||
export function SidebarCompletedTime({ completedAt }: { completedAt: string }) {
|
||||
// Subscribe inside the label so time advances even when the row is memoized.
|
||||
const nowMinute = useNowMinute();
|
||||
const relativeTime = formatRelativeTimeLabel(completedAt, Date.parse(`${nowMinute}:00Z`));
|
||||
const label = relativeTime === "just now" ? "now" : relativeTime.replace(/ ago$/, "");
|
||||
|
||||
return (
|
||||
<time dateTime={completedAt} className="inline-flex items-center">
|
||||
<span className="sr-only">Completed </span>
|
||||
<span className="text-secondary-label">{label}</span>
|
||||
</time>
|
||||
);
|
||||
}
|
||||
@@ -20,10 +20,9 @@ import {
|
||||
} from "react";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
import { useCompactSidebarEnabled } from "../../hooks/useSettings";
|
||||
import { Button } from "../ui/button";
|
||||
import { Input } from "../ui/input";
|
||||
import { SidebarMenuButton, useSidebar } from "../ui/sidebar";
|
||||
import { SidebarMenuButton } from "../ui/sidebar";
|
||||
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
|
||||
|
||||
export interface SidebarThreadHeaderProps {
|
||||
@@ -70,9 +69,6 @@ export function SidebarThreadHeader({
|
||||
activeSearchResultIndex,
|
||||
onClearSearch,
|
||||
}: SidebarThreadHeaderProps) {
|
||||
const compactEnabled = useCompactSidebarEnabled();
|
||||
const { state, isMobile, setOpen } = useSidebar();
|
||||
const compact = compactEnabled && state === "collapsed" && !isMobile;
|
||||
const resultsVisible = isSearching && searchResultCount > 0;
|
||||
// Results shrink as the query narrows, so the active index can outrun the
|
||||
// list; pointing aria-activedescendant at a removed option strands the
|
||||
@@ -83,24 +79,10 @@ export function SidebarThreadHeader({
|
||||
: "New thread";
|
||||
|
||||
return (
|
||||
<div className={cn("flex items-center gap-1", compact && "flex-col")}>
|
||||
{compact ? (
|
||||
<SidebarHeaderIconButton
|
||||
label="Search threads"
|
||||
onClick={() => {
|
||||
setOpen(true);
|
||||
requestAnimationFrame(() => searchInputRef.current?.focus());
|
||||
}}
|
||||
>
|
||||
<SearchIcon />
|
||||
</SidebarHeaderIconButton>
|
||||
) : null}
|
||||
<div className="flex items-center gap-1">
|
||||
<div
|
||||
ref={searchFieldRef}
|
||||
className={cn(
|
||||
"flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
|
||||
compact && "hidden",
|
||||
)}
|
||||
className="flex h-8 min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-sidebar-muted-foreground hover:bg-sidebar-row-hover hover:text-sidebar-foreground"
|
||||
>
|
||||
<SearchIcon className="size-4 shrink-0 text-[var(--sidebar-icon-color)]" />
|
||||
<Input
|
||||
@@ -142,12 +124,7 @@ export function SidebarThreadHeader({
|
||||
</div>
|
||||
{/* Segmented well: the icons read as one control instead of three loose
|
||||
buttons competing with the search field beside them. */}
|
||||
<div
|
||||
className={cn(
|
||||
"flex shrink-0 items-center rounded-md bg-sidebar-control-surface/60 p-px",
|
||||
compact && "flex-col",
|
||||
)}
|
||||
>
|
||||
<div className="flex shrink-0 items-center rounded-md bg-sidebar-control-surface/60 p-px">
|
||||
{hasProjects ? (
|
||||
<>
|
||||
{projectScope}
|
||||
|
||||
@@ -348,7 +348,7 @@ function SidebarUpdateControl() {
|
||||
);
|
||||
|
||||
return (
|
||||
<SidebarMenuItem className="ml-auto shrink-0 group-data-[collapsible=icon]:hidden">
|
||||
<SidebarMenuItem className="ml-auto shrink-0">
|
||||
<Popover
|
||||
handle={releaseNotesPopoverHandle}
|
||||
onOpenChange={(open, details) => {
|
||||
|
||||
@@ -591,11 +591,9 @@ function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof S
|
||||
function SidebarContent({
|
||||
className,
|
||||
fixedHeader,
|
||||
fixedFooter,
|
||||
...props
|
||||
}: React.ComponentProps<"div"> & {
|
||||
fixedHeader?: React.ReactNode;
|
||||
fixedFooter?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
@@ -619,7 +617,6 @@ function SidebarContent({
|
||||
{...props}
|
||||
/>
|
||||
</ScrollArea>
|
||||
{fixedFooter ? <div className="w-full shrink-0">{fixedFooter}</div> : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -379,13 +379,6 @@ export function useLegacySidebarEnabled(): boolean {
|
||||
return settingsHydrated && legacySidebarEnabled;
|
||||
}
|
||||
|
||||
/** Keep the default collapsed sidebar until persisted client settings hydrate. */
|
||||
export function useCompactSidebarEnabled(): boolean {
|
||||
const settingsHydrated = useClientSettingsHydrated();
|
||||
const compactSidebarEnabled = useClientSettingsValue().compactSidebarEnabled;
|
||||
return settingsHydrated && compactSidebarEnabled;
|
||||
}
|
||||
|
||||
/** Read current settings for one environment, merged with client-local preferences. */
|
||||
export function useEnvironmentSettings<T = UnifiedSettings>(
|
||||
environmentId: EnvironmentId,
|
||||
|
||||
@@ -228,15 +228,3 @@ describe("formatElapsedDurationLabel", () => {
|
||||
expect(formatElapsedDurationLabel("2026-04-03T12:00:00.000Z")).toBe("4d");
|
||||
});
|
||||
});
|
||||
|
||||
describe("explicit relative-time clock", () => {
|
||||
it("uses the supplied minute instead of the wall clock", () => {
|
||||
const completedAt = "2026-09-07T01:00:00Z";
|
||||
expect(formatRelativeTimeLabel(completedAt, Date.parse("2026-09-07T01:01:00Z"))).toBe("1m ago");
|
||||
expect(formatRelativeTimeLabel(completedAt, Date.parse("2026-09-07T01:02:00Z"))).toBe("2m ago");
|
||||
expect(formatRelativeTime(completedAt, Date.parse("2026-09-07T01:02:00Z"))).toEqual({
|
||||
value: "2m",
|
||||
suffix: "ago",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -196,10 +196,10 @@ export type RelativeTimeState =
|
||||
| { status: "invalid" }
|
||||
| { status: "relative"; value: string; suffix: string | null };
|
||||
|
||||
export function formatRelativeTime(isoDate: string, nowMs = Date.now()): RelativeTimeParts | null {
|
||||
export function formatRelativeTime(isoDate: string): RelativeTimeParts | null {
|
||||
const date = parseTimestampDate(isoDate);
|
||||
if (!date) return null;
|
||||
const diffMs = nowMs - date.getTime();
|
||||
const diffMs = Date.now() - date.getTime();
|
||||
if (diffMs < 0) return { value: "just now", suffix: null };
|
||||
const seconds = Math.floor(diffMs / 1000);
|
||||
if (seconds < 60) return { value: "just now", suffix: null };
|
||||
@@ -211,8 +211,8 @@ export function formatRelativeTime(isoDate: string, nowMs = Date.now()): Relativ
|
||||
return { value: `${days}d`, suffix: "ago" };
|
||||
}
|
||||
|
||||
export function formatRelativeTimeLabel(isoDate: string, nowMs = Date.now()) {
|
||||
const relative = formatRelativeTime(isoDate, nowMs);
|
||||
export function formatRelativeTimeLabel(isoDate: string) {
|
||||
const relative = formatRelativeTime(isoDate);
|
||||
if (!relative) return "";
|
||||
return relative.suffix ? `${relative.value} ${relative.suffix}` : relative.value;
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export const COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS =
|
||||
"[[data-sidebar-state=collapsed]_&]:pl-[var(--workspace-titlebar-content-left)] [[data-sidebar-state=collapsed]:has([data-side=left][data-collapsible=icon])_&]:pl-[max(calc(env(safe-area-inset-left)+1.25rem),calc(var(--workspace-titlebar-content-left)-var(--sidebar-width-icon)))]";
|
||||
"[[data-sidebar-state=collapsed]_&]:pl-[var(--workspace-titlebar-content-left)]";
|
||||
@@ -482,18 +482,7 @@ describe("ClientSettings environment identification", () => {
|
||||
|
||||
describe("ClientSettings sidebar", () => {
|
||||
it("defaults to the current sidebar", () => {
|
||||
const settings = decodeClientSettings({});
|
||||
expect(settings.legacySidebarEnabled).toBe(false);
|
||||
expect(settings.sidebarCompactThreadRows).toBe(false);
|
||||
});
|
||||
|
||||
it("preserves an explicit compact thread row preference", () => {
|
||||
expect(decodeClientSettings({ sidebarCompactThreadRows: true }).sidebarCompactThreadRows).toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
decodeClientSettingsPatch({ sidebarCompactThreadRows: true }).sidebarCompactThreadRows,
|
||||
).toBe(true);
|
||||
expect(decodeClientSettings({}).legacySidebarEnabled).toBe(false);
|
||||
});
|
||||
|
||||
it("drops the retired sidebar v2 beta keys, resetting everyone to the default", () => {
|
||||
@@ -506,6 +495,14 @@ describe("ClientSettings sidebar", () => {
|
||||
expect(decoded).not.toHaveProperty("sidebarV2ConfiguredByUser");
|
||||
});
|
||||
|
||||
it("drops the retired compact sidebar keys for users who opted in", () => {
|
||||
const stored = { compactSidebarEnabled: true, sidebarCompactThreadRows: true };
|
||||
const decoded = decodeClientSettings(stored);
|
||||
expect(decoded).not.toHaveProperty("compactSidebarEnabled");
|
||||
expect(decoded).not.toHaveProperty("sidebarCompactThreadRows");
|
||||
expect(decodeClientSettingsPatch(stored)).toEqual({});
|
||||
});
|
||||
|
||||
it("preserves an explicit legacy sidebar opt-in", () => {
|
||||
expect(decodeClientSettings({ legacySidebarEnabled: true }).legacySidebarEnabled).toBe(true);
|
||||
expect(decodeClientSettingsPatch({ legacySidebarEnabled: true }).legacySidebarEnabled).toBe(
|
||||
|
||||
@@ -437,7 +437,6 @@ export const ClientSettingsSchema = Schema.Struct({
|
||||
// old keys, so everyone, including prior beta opt-outs, resets to the new
|
||||
// default sidebar.
|
||||
legacySidebarEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
compactSidebarEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
sidebarProjectGroupingMode: SidebarProjectGroupingMode.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE)),
|
||||
),
|
||||
@@ -451,7 +450,6 @@ export const ClientSettingsSchema = Schema.Struct({
|
||||
sidebarThreadSortOrder: SidebarThreadSortOrder.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_SORT_ORDER)),
|
||||
),
|
||||
sidebarCompactThreadRows: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
sidebarThreadPreviewCount: SidebarThreadPreviewCount.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT)),
|
||||
),
|
||||
@@ -1504,14 +1502,12 @@ export const ClientSettingsPatch = Schema.Struct({
|
||||
proactivePanelsEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),
|
||||
legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
compactSidebarEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),
|
||||
sidebarProjectGroupingOverrides: Schema.optionalKey(
|
||||
Schema.Record(TrimmedNonEmptyString, SidebarProjectGroupingMode),
|
||||
),
|
||||
sidebarProjectSortOrder: Schema.optionalKey(SidebarProjectSortOrder),
|
||||
sidebarThreadSortOrder: Schema.optionalKey(SidebarThreadSortOrder),
|
||||
sidebarCompactThreadRows: Schema.optionalKey(Schema.Boolean),
|
||||
sidebarThreadPreviewCount: Schema.optionalKey(SidebarThreadPreviewCount),
|
||||
timestampFormat: Schema.optionalKey(TimestampFormat),
|
||||
snapShotEnabled: Schema.optionalKey(Schema.Boolean),
|
||||
|
||||
Reference in new issue
Block a user