Skip to content
TypeScript

refactor(web): stacked sidebar groups share one inset (#13037)

Julius Marminge016cdb962235
diff --git a/apps/web/src/components/LegacySidebar.tsx b/apps/web/src/components/LegacySidebar.tsx
index 34ec83fb4b1..910bb23be7c 100644
--- a/apps/web/src/components/LegacySidebar.tsx
+++ b/apps/web/src/components/LegacySidebar.tsx
@@ -2673,7 +2673,7 @@ function LocalSecondaryStatus() {
}
return (
- <SidebarGroup className="px-2 pt-2 pb-0">
+ <SidebarGroup>
{connecting.length > 0 ? (
<Alert
variant="default"
@@ -2966,11 +2966,10 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
return (
<SidebarContent
- className="gap-0"
fixedHeader={
// Lifted above the stage backdrop, whose fade bleeds below the
// header and would otherwise paint across the search row's outline.
- <SidebarGroup className="relative z-[1] px-2 pt-2 pb-1">
+ <SidebarGroup className="z-[1]">
<SidebarMenu>
<SidebarMenuItem>
<CommandDialogTrigger
@@ -2995,7 +2994,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
}
>
{showArm64IntelBuildWarning && arm64IntelBuildWarningDescription ? (
- <SidebarGroup className="px-2 pt-2 pb-0">
+ <SidebarGroup>
<Alert variant="warning" className="rounded-2xl border-warning/40 bg-warning/8">
<TriangleAlertIcon />
<AlertTitle>Intel build on Apple Silicon</AlertTitle>
@@ -3018,7 +3017,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
</SidebarGroup>
) : null}
<LocalSecondaryStatus />
- <SidebarGroup className="px-2 py-2">
+ <SidebarGroup>
<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">
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 90a3fb9864f..66cc11625f4 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -4391,11 +4391,11 @@ export default function Sidebar() {
<>
<SidebarChromeHeader isElectron={isElectron} />
<SidebarContent
- className="gap-0 min-h-full"
+ className="min-h-full"
fixedHeader={
// Lifted above the stage backdrop, whose fade bleeds below the
// header and would otherwise paint across the search row's outline.
- <SidebarGroup className="relative z-[1] p-[var(--sidebar-content-inset)] pt-1">
+ <SidebarGroup className="z-[1]">
<SidebarThreadHeader
searchFieldRef={headerSearchRef}
hasProjects={projectGroups.length > 0}
@@ -4554,7 +4554,7 @@ export default function Sidebar() {
</SidebarGroup>
}
>
- <SidebarGroup className="ps-[calc(var(--sidebar-content-inset)+1px)] pe-[var(--sidebar-content-inset)] pb-1 pt-0 flex-1">
+ <SidebarGroup className="flex-1 ps-[calc(var(--sidebar-content-inset)+1px)]">
{isSearchingThreads ? (
threadSearchResults.length > 0 ? (
<TooltipProvider
diff --git a/apps/web/src/components/settings/SettingsSidebarNav.tsx b/apps/web/src/components/settings/SettingsSidebarNav.tsx
index cb466d3bb9f..665a9f963c4 100644
--- a/apps/web/src/components/settings/SettingsSidebarNav.tsx
+++ b/apps/web/src/components/settings/SettingsSidebarNav.tsx
@@ -234,7 +234,7 @@ export function SettingsSidebarNav({ pathname }: { pathname: string }) {
return (
<>
<SidebarContent className="overflow-x-hidden">
- <SidebarGroup className="gap-2 p-[var(--sidebar-content-inset)]">
+ <SidebarGroup className="gap-2">
<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" />
<SidebarInput
diff --git a/apps/web/src/components/ui/sidebar.tsx b/apps/web/src/components/ui/sidebar.tsx
index a131d782ec9..3dd28025872 100644
--- a/apps/web/src/components/ui/sidebar.tsx
+++ b/apps/web/src/components/ui/sidebar.tsx
@@ -602,7 +602,10 @@ function SidebarContent({
<div
// Reordered rows must not pull the viewport to their new position.
className={cn(
- "flex w-full min-w-0 flex-col gap-2 [overflow-anchor:none] group-data-[collapsible=icon]:overflow-hidden",
+ // Stacked groups share one inset between them instead of doubling
+ // it, including across the fixed header's boundary.
+ "flex w-full min-w-0 flex-col [overflow-anchor:none] group-data-[collapsible=icon]:overflow-hidden [&>[data-sidebar=group]+[data-sidebar=group]]:pt-0",
+ fixedHeader && "[&>[data-sidebar=group]:first-child]:pt-0",
className,
)}
data-sidebar="content"
diff --git a/scripts/lint-restyle-ceiling.ts b/scripts/lint-restyle-ceiling.ts
index 0ad18533309..d94e2bc2525 100644
--- a/scripts/lint-restyle-ceiling.ts
+++ b/scripts/lint-restyle-ceiling.ts
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
// migrate a file, and delete this script when the rule becomes an error.
-export const RESTYLE_CEILING = 812;
+export const RESTYLE_CEILING = 793;
const RULE = "shadcn(no-restyle)";