Skip to content

Commit 7a84fd6

Browse files
committed
fix(sidebar): drop unused header imports and cap the scope popup width
Removes the SearchIcon, Input and SidebarMenuButton imports the header no longer needs, caps the project picker at 18rem so long project names truncate instead of stretching it, and keeps the header tooltips on the right as before so they never sit over the open picker.
1 parent b795f27 commit 7a84fd6

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import {
4949
PinIcon,
5050
PinOffIcon,
5151
PlusIcon,
52-
SearchIcon,
5352
SettingsIcon,
5453
SquarePenIcon,
5554
TerminalIcon,
@@ -214,7 +213,6 @@ import {
214213
import { useThreadRunningTerminalIds } from "../state/terminalSessions";
215214
import { stackedThreadToast, toastManager } from "./ui/toast";
216215
import { Button } from "./ui/button";
217-
import { Input } from "./ui/input";
218216
import {
219217
Combobox,
220218
ComboboxEmpty,
@@ -225,7 +223,7 @@ import {
225223
ComboboxTrigger,
226224
useComboboxFilter,
227225
} from "./ui/combobox";
228-
import { SidebarContent, SidebarGroup, SidebarMenuButton, useSidebar } from "./ui/sidebar";
226+
import { SidebarContent, SidebarGroup, useSidebar } from "./ui/sidebar";
229227
import { SidebarChromeFooter, SidebarChromeHeader } from "./sidebar/SidebarChrome";
230228
import { SidebarHeaderIconButton, SidebarThreadHeader } from "./sidebar/SidebarThreadHeader";
231229
import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover";
@@ -2443,10 +2441,10 @@ export default function Sidebar() {
24432441
},
24442442
[isMobile, router, setOpenMobile],
24452443
);
2446-
// Safari can send a click after Ctrl+click opens settings. Ignore that one
2447-
// selection, then clear the guard when the picker opens again.
24482444
// Anchor for the scope popup: the header search field, not its icon trigger.
24492445
const headerSearchRef = useRef<HTMLDivElement | null>(null);
2446+
// Safari can send a click after Ctrl+click opens settings. Ignore that one
2447+
// selection, then clear the guard when the picker opens again.
24502448
const suppressNextScopeChangeRef = useRef(false);
24512449
const highlightedProjectScopeKeyRef = useRef<string | null>(null);
24522450
const handleProjectSettings = useCallback(
@@ -4363,9 +4361,10 @@ export default function Sidebar() {
43634361
align="start"
43644362
// Anchored to the search field, not the 28px trigger: the
43654363
// popup opens under the field, is at least as wide as it,
4366-
// and grows to fit project names.
4364+
// and grows to fit project names up to a cap, past which
4365+
// the rows truncate.
43674366
anchor={headerSearchRef}
4368-
className="overflow-hidden"
4367+
className="max-w-[min(18rem,var(--available-width))] overflow-hidden"
43694368
>
43704369
<ComboboxSearchInput
43714370
aria-label="Search projects"

‎apps/web/src/components/sidebar/SidebarThreadHeader.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export function SidebarHeaderIconButton({
176176
tooltip?: ReactNode;
177177
className?: string | undefined;
178178
children?: ReactNode;
179-
} & Omit<ComponentProps<typeof SidebarMenuButton>, "children" | "className">) {
179+
} & Omit<ComponentProps<typeof SidebarMenuButton>, "children" | "className" | "tooltip">) {
180180
return (
181181
<Tooltip>
182182
<TooltipTrigger
@@ -200,7 +200,7 @@ export function SidebarHeaderIconButton({
200200
className="pointer-events-none absolute left-1/2 top-1/2 size-[max(100%,3rem)] -translate-1/2 pointer-fine:hidden"
201201
/>
202202
</TooltipTrigger>
203-
<TooltipPopup side="bottom">{tooltip}</TooltipPopup>
203+
<TooltipPopup side="right">{tooltip}</TooltipPopup>
204204
</Tooltip>
205205
);
206206
}

0 commit comments

Comments
 (0)