Skip to content

Commit d81278a

Browse files
authored
revert(web): remove the compact sidebar (pingdotgg#11685)
Co-authored-by: maria-rcks <[email protected]>
1 parent 1bbca0e commit d81278a

22 files changed

Lines changed: 208 additions & 1036 deletions

‎apps/desktop/src/settings/DesktopClientSettings.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const clientSettings: ClientSettings = {
5757
proactivePanelsEnabled: true,
5858
showSkillsInSlashMenu: false,
5959
providerModelPreferences: {},
60-
sidebarCompactThreadRows: false,
6160
sidebarProjectGroupingMode: "repository_path",
6261
sidebarProjectGroupingOverrides: {
6362
"environment-1:/tmp/project-a": "separate",

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ import { getLocalStorageItem, removeLocalStorageItem } from "../hooks/useLocalSt
1414
import { resolveShortcutCommand, shortcutLabelForCommand } from "../keybindings";
1515
import { cn, isMacPlatform } from "../lib/utils";
1616
import { primaryServerKeybindingsAtom } from "../state/server";
17-
import {
18-
useCompactSidebarEnabled,
19-
useEnvironmentIdentificationMode,
20-
useLegacySidebarEnabled,
21-
} from "../hooks/useSettings";
17+
import { useEnvironmentIdentificationMode, useLegacySidebarEnabled } from "../hooks/useSettings";
2218
import {
2319
PanelAnimationSuppressionProvider,
2420
usePanelAnimationSettings,
@@ -148,7 +144,6 @@ function ProjectProjectionRetention() {
148144
export function AppSidebarLayout({ children }: { children: ReactNode }) {
149145
const navigate = useNavigate();
150146
const legacySidebarEnabled = useLegacySidebarEnabled();
151-
const compactSidebarEnabled = useCompactSidebarEnabled();
152147
const { active: panelAnimationsActive, durationMs: panelAnimationDurationMs } =
153148
usePanelAnimationSettings();
154149
// Settings routes show the settings nav in place of whichever thread
@@ -234,7 +229,7 @@ export function AppSidebarLayout({ children }: { children: ReactNode }) {
234229
<ProjectProjectionRetention />
235230
<Sidebar
236231
side="left"
237-
collapsible={compactSidebarEnabled ? "icon" : "offcanvas"}
232+
collapsible="offcanvas"
238233
data-app-sidebar=""
239234
className="border-r border-sidebar-border bg-sidebar text-sidebar-foreground"
240235
resizable={{

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

Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ import { SidebarChromeFooter, SidebarChromeHeader } from "./sidebar/SidebarChrom
199199
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
200200
import { useIsMobile } from "~/hooks/useMediaQuery";
201201
import { CommandDialogTrigger } from "./ui/command";
202-
import {
203-
useClientSettings,
204-
useCompactSidebarEnabled,
205-
useUpdateClientSettings,
206-
} from "~/hooks/useSettings";
202+
import { useClientSettings, useUpdateClientSettings } from "~/hooks/useSettings";
207203
import { primaryServerKeybindingsAtom } from "../state/server";
208204
import {
209205
derivePhysicalProjectKey,
@@ -1198,9 +1194,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
11981194
const router = useRouter();
11991195
const queuePendingFileDrop = useSidebarPendingFileDropStore((s) => s.queuePendingFileDrop);
12001196
const clearPendingFileDrop = useSidebarPendingFileDropStore((s) => s.clearPendingFileDrop);
1201-
const { isMobile, setOpenMobile, state, setOpen } = useSidebar();
1202-
const compactSidebarEnabled = useCompactSidebarEnabled();
1203-
const isCompact = compactSidebarEnabled && !isMobile && state === "collapsed";
1197+
const { isMobile, setOpenMobile } = useSidebar();
12041198
const markThreadUnread = useUiStateStore((state) => state.markThreadUnread);
12051199
const setProjectExpanded = useUiStateStore((state) => state.setProjectExpanded);
12061200
const toggleThreadSelection = useThreadSelectionStore((state) => state.toggleThread);
@@ -1451,13 +1445,10 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
14511445
if (useThreadSelectionStore.getState().hasSelection()) {
14521446
clearSelection();
14531447
}
1454-
setProjectExpanded(projectPreferenceKeys, isCompact || !projectExpanded);
1455-
if (isCompact) setOpen(true);
1448+
setProjectExpanded(projectPreferenceKeys, !projectExpanded);
14561449
},
14571450
[
14581451
clearSelection,
1459-
isCompact,
1460-
setOpen,
14611452
dragInProgressRef,
14621453
projectExpanded,
14631454
projectPreferenceKeys,
@@ -1474,17 +1465,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
14741465
if (dragInProgressRef.current) {
14751466
return;
14761467
}
1477-
setProjectExpanded(projectPreferenceKeys, isCompact || !projectExpanded);
1478-
if (isCompact) setOpen(true);
1468+
setProjectExpanded(projectPreferenceKeys, !projectExpanded);
14791469
},
1480-
[
1481-
dragInProgressRef,
1482-
isCompact,
1483-
projectExpanded,
1484-
projectPreferenceKeys,
1485-
setOpen,
1486-
setProjectExpanded,
1487-
],
1470+
[dragInProgressRef, projectExpanded, projectPreferenceKeys, setProjectExpanded],
14881471
);
14891472

14901473
const handleProjectButtonPointerDownCapture = useCallback(
@@ -2376,10 +2359,8 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
23762359
<>
23772360
<div className="group/project-header relative">
23782361
<SidebarMenuButton
2379-
tooltip={project.displayName}
2380-
aria-label={project.displayName}
23812362
ref={isManualProjectSorting ? dragHandleProps?.setActivatorNodeRef : undefined}
2382-
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 ${
2363+
className={`pr-8 group-hover/project-header:bg-sidebar-row-hover group-hover/project-header:text-sidebar-foreground max-sm:pr-14 ${
23832364
isManualProjectSorting ? "cursor-grab active:cursor-grabbing" : ""
23842365
}`}
23852366
{...(isManualProjectSorting && dragHandleProps ? dragHandleProps.attributes : {})}
@@ -2389,7 +2370,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
23892370
onKeyDown={handleProjectButtonKeyDown}
23902371
onContextMenu={handleProjectButtonContextMenu}
23912372
>
2392-
{isCompact ? null : !projectExpanded && projectStatus ? (
2373+
{!projectExpanded && projectStatus ? (
23932374
<Tooltip>
23942375
<TooltipTrigger
23952376
render={
@@ -2420,7 +2401,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
24202401
<span className="flex shrink-0">
24212402
<ProjectFavicon project={project} />
24222403
</span>
2423-
<span className="flex min-w-0 flex-1 items-center gap-2 group-data-[collapsible=icon]:hidden">
2404+
<span className="flex min-w-0 flex-1 items-center gap-2">
24242405
<span className="truncate text-sm font-medium text-sidebar-foreground/90">
24252406
{project.displayName}
24262407
</span>
@@ -2434,7 +2415,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
24342415
{/* Environment badge – visible by default, crossfades with the
24352416
"new thread" button on hover using the same pointer-events +
24362417
opacity pattern as the thread row archive/timestamp swap. */}
2437-
{!isCompact && project.environmentPresence === "remote-only" && (
2418+
{project.environmentPresence === "remote-only" && (
24382419
<Tooltip>
24392420
<TooltipTrigger
24402421
render={
@@ -2460,7 +2441,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
24602441
<Tooltip>
24612442
<TooltipTrigger
24622443
render={
2463-
<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">
2444+
<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">
24642445
<button
24652446
type="button"
24662447
aria-label={`Create new thread in ${project.displayName}`}
@@ -2693,7 +2674,7 @@ function LocalSecondaryStatus() {
26932674
}
26942675

26952676
return (
2696-
<SidebarGroup className="px-2 pt-2 pb-0 group-data-[collapsible=icon]:hidden">
2677+
<SidebarGroup className="px-2 pt-2 pb-0">
26972678
{connecting.length > 0 ? (
26982679
<Alert
26992680
variant="default"
@@ -2997,16 +2978,14 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
29972978
render={
29982979
<SidebarMenuButton
29992980
className="focus-visible:ring-0"
3000-
tooltip="Search"
3001-
aria-label="Search"
30022981
data-testid="command-palette-trigger"
30032982
/>
30042983
}
30052984
>
30062985
<SearchIcon />
3007-
<span className="flex-1 truncate group-data-[collapsible=icon]:hidden">Search</span>
2986+
<span className="flex-1 truncate">Search</span>
30082987
{commandPaletteShortcutLabel ? (
3009-
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px] group-data-[collapsible=icon]:hidden">
2988+
<Kbd className="h-4 min-w-0 rounded-sm px-1.5 text-[10px]">
30102989
{commandPaletteShortcutLabel}
30112990
</Kbd>
30122991
) : null}
@@ -3017,7 +2996,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
30172996
}
30182997
>
30192998
{showArm64IntelBuildWarning && arm64IntelBuildWarningDescription ? (
3020-
<SidebarGroup className="px-2 pt-2 pb-0 group-data-[collapsible=icon]:hidden">
2999+
<SidebarGroup className="px-2 pt-2 pb-0">
30213000
<Alert variant="warning" className="rounded-2xl border-warning/40 bg-warning/8">
30223001
<TriangleAlertIcon />
30233002
<AlertTitle>Intel build on Apple Silicon</AlertTitle>
@@ -3041,21 +3020,17 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
30413020
) : null}
30423021
<LocalSecondaryStatus />
30433022
<SidebarGroup className="px-2 py-2">
3044-
<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">
3045-
<span className="text-xs font-medium text-sidebar-muted-foreground/80 group-data-[collapsible=icon]:hidden">
3046-
Projects
3047-
</span>
3023+
<div className="mb-1 flex items-center justify-between pl-2 pr-1.5">
3024+
<span className="text-xs font-medium text-sidebar-muted-foreground/80">Projects</span>
30483025
<div className="flex items-center gap-1">
3049-
<div className="group-data-[collapsible=icon]:hidden">
3050-
<ProjectSortMenu
3051-
projectSortOrder={projectSortOrder}
3052-
threadSortOrder={threadSortOrder}
3053-
threadPreviewCount={threadPreviewCount}
3054-
onProjectSortOrderChange={handleProjectSortOrderChange}
3055-
onThreadSortOrderChange={handleThreadSortOrderChange}
3056-
onThreadPreviewCountChange={handleThreadPreviewCountChange}
3057-
/>
3058-
</div>
3026+
<ProjectSortMenu
3027+
projectSortOrder={projectSortOrder}
3028+
threadSortOrder={threadSortOrder}
3029+
threadPreviewCount={threadPreviewCount}
3030+
onProjectSortOrderChange={handleProjectSortOrderChange}
3031+
onThreadSortOrderChange={handleThreadSortOrderChange}
3032+
onThreadPreviewCountChange={handleThreadPreviewCountChange}
3033+
/>
30593034
<Tooltip>
30603035
<TooltipTrigger
30613036
render={
@@ -3152,9 +3127,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
31523127
)}
31533128

31543129
{projectsLength === 0 && (
3155-
<div className="px-2 pt-4 text-center text-secondary-label text-xs group-data-[collapsible=icon]:hidden">
3156-
No projects yet
3157-
</div>
3130+
<div className="px-2 pt-4 text-center text-secondary-label text-xs">No projects yet</div>
31583131
)}
31593132
</SidebarGroup>
31603133
</SidebarContent>

‎apps/web/src/components/Sidebar.drag.ts‎

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export function createSidebarSortingStrategy(input: {
103103
snoozedThreadCount?: number;
104104
cardHeight?: number;
105105
slimHeight?: number;
106-
compact?: boolean;
107106
/** Space each pinned boundary opens for its label while dragging. The
108107
* markers stay zero height at rest, so nothing is reserved until pickup. */
109108
boundaryLabelHeight?: number;
@@ -141,14 +140,11 @@ export function createSidebarSortingStrategy(input: {
141140
else slimHeight ??= rects[index]?.height;
142141
if (item.key !== active.key) groups[item.section].push(item);
143142
}
144-
// Compact icons use h-7; expanded cards include their vertical padding.
145-
const scale = input.compact
146-
? (cardHeight ?? slimHeight ?? 28) / 28
147-
: slimHeight !== undefined
148-
? slimHeight / 36
149-
: (headerScale ?? (cardHeight ?? 82) / 82);
150-
cardHeight ??= (input.compact ? 28 : 82) * scale;
151-
slimHeight ??= (input.compact ? 28 : 36) * scale;
143+
// Cards are 4.875rem + 0.25rem padding; slim rows/placeholders are h-9.
144+
const scale =
145+
slimHeight !== undefined ? slimHeight / 36 : (headerScale ?? (cardHeight ?? 82) / 82);
146+
cardHeight ??= 82 * scale;
147+
slimHeight ??= 36 * scale;
152148
const labelHeight = (input.boundaryLabelHeight ?? 0) * scale;
153149
const group = groups[target.section];
154150
const order =
@@ -222,11 +218,7 @@ export function createSidebarSortingStrategy(input: {
222218
// Consume the shelf's auto margin as drag labels and resized rows need
223219
// room, keeping the combined shelves at their measured bottom.
224220
let shelfSpace =
225-
!input.compact &&
226-
shelfRect &&
227-
beforeShelf &&
228-
lastRect &&
229-
shelfRect.top > beforeShelf.bottom + 1
221+
shelfRect && beforeShelf && lastRect && shelfRect.top > beforeShelf.bottom + 1
230222
? Math.max(
231223
0,
232224
lastRect.bottom - rects[0].top - heights.reduce((sum, height) => sum + height + 1, -1),

0 commit comments

Comments
 (0)