Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore: bring back click on sidebar to collapse (#12821)

Tobias Wochingera75e6f0a2e22
diff --git a/web/src/components/nav/app-sidebar.tsx b/web/src/components/nav/app-sidebar.tsx
index fa80d88410..b39ca30632 100644
--- a/web/src/components/nav/app-sidebar.tsx
+++ b/web/src/components/nav/app-sidebar.tsx
@@ -17,6 +17,7 @@ import {
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
+ SidebarRail,
} from "@/src/components/ui/sidebar";
import { env } from "@/src/env.mjs";
import { useRouter } from "next/router";
@@ -65,6 +66,7 @@ export function AppSidebar({
<SidebarFooter>
<NavUser {...userNavProps} />
</SidebarFooter>
+ <SidebarRail />
</Sidebar>
);
}
diff --git a/web/src/components/ui/sidebar.tsx b/web/src/components/ui/sidebar.tsx
index f99cf366e0..df1d79cc8d 100644
--- a/web/src/components/ui/sidebar.tsx
+++ b/web/src/components/ui/sidebar.tsx
@@ -299,6 +299,31 @@ const SidebarTrigger = React.forwardRef<
});
SidebarTrigger.displayName = "SidebarTrigger";
+const SidebarRail = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button">
+>(({ className, ...props }, ref) => {
+ const { toggleSidebar } = useSidebar();
+
+ return (
+ <button
+ ref={ref}
+ data-sidebar="rail"
+ aria-label="Toggle Sidebar"
+ tabIndex={-1}
+ onClick={toggleSidebar}
+ title="Toggle Sidebar"
+ className={cn(
+ "hover:after:bg-sidebar-border absolute inset-y-0 z-50 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] md:flex",
+ "cursor-pointer",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarRail.displayName = "SidebarRail";
+
const SidebarInset = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"main">
@@ -757,6 +782,7 @@ export {
SidebarMenuSubButton,
SidebarMenuSubItem,
SidebarProvider,
+ SidebarRail,
SidebarSeparator,
SidebarTrigger,
useSidebar,