Skip to content

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

feat(layouts): real mobile hamburger for the sidebar trigger (LFE-11067) (#15232)

Nikita Kabardin5788a742664e
diff --git a/web/src/components/layouts/page-header.tsx b/web/src/components/layouts/page-header.tsx
index fedbd0483d..7e23dd0849 100644
--- a/web/src/components/layouts/page-header.tsx
+++ b/web/src/components/layouts/page-header.tsx
@@ -4,6 +4,7 @@ import BreadcrumbComponent from "@/src/components/layouts/breadcrumb";
import { PageHeaderControlsSlotTarget } from "@/src/components/layouts/page-header-controls-slot";
import { InAppAiAgentButton } from "@/src/components/nav/in-app-ai-agent-button";
import { TopbarBrand } from "@/src/components/nav/topbar-brand";
+import { useHasAppSidebar } from "@/src/components/nav/sidebar-presence";
import DocPopup from "@/src/components/layouts/doc-popup";
import { SidebarTrigger } from "@/src/components/ui/sidebar";
import {
@@ -78,6 +79,12 @@ const PageHeader = ({
breadcrumbBadges,
}: PageHeaderProps) => {
const router = useRouter();
+ const hasAppSidebar = useHasAppSidebar();
+ // The sidebar trigger + brand mark only make sense where a real AppSidebar
+ // exists to toggle/mirror. On the sidebar-less MinimalLayout (public/shared
+ // trace and session views) show the page's own leadingControl instead — no
+ // hamburger opening an empty sheet, no orphaned brand mark.
+ const showSidebarChrome = showSidebarTrigger && hasAppSidebar;
return (
<div
className={cn([
@@ -103,16 +110,12 @@ const PageHeader = ({
)}
>
<div className="flex min-w-0 flex-wrap items-center gap-3">
- {showSidebarTrigger ? (
+ {showSidebarChrome ? (
<>
<SidebarTrigger />
{/* Brand the app in the top bar while the sidebar (which
owns the logo) is off-canvas below `md`. Hidden on
- desktop where the sidebar logo is visible. Gated on the
- same condition as the trigger so it only appears where a
- sidebar actually exists to mirror — never on the
- sidebar-less MinimalLayout (e.g. the public/shared trace
- view, which supplies its own leadingControl). */}
+ desktop where the sidebar logo is visible. */}
<TopbarBrand className="md:hidden" />
</>
) : (
diff --git a/web/src/components/ui/sidebar.tsx b/web/src/components/ui/sidebar.tsx
index cab54e9d9e..e09833eb79 100644
--- a/web/src/components/ui/sidebar.tsx
+++ b/web/src/components/ui/sidebar.tsx
@@ -3,7 +3,7 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { type VariantProps, cva } from "class-variance-authority";
-import { PanelLeft } from "lucide-react";
+import { Menu, PanelLeft } from "lucide-react";
import { useIsMobile } from "@/src/hooks/use-mobile";
import useLocalStorage from "@/src/components/useLocalStorage";
import { cn } from "@/src/utils/tailwind";
@@ -288,14 +288,20 @@ const SidebarTrigger = React.forwardRef<
data-sidebar="trigger"
variant="ghost"
size="icon"
- className={cn("h-5 w-5", className)}
+ // A real hamburger tap target on mobile (where it opens the off-canvas
+ // nav sheet); compact on desktop where it's just a panel-collapse toggle
+ // next to the docked sidebar.
+ className={cn("h-9 w-9 md:h-5 md:w-5", className)}
onClick={(event) => {
onClick?.(event);
toggleSidebar();
}}
{...props}
>
- <PanelLeft />
+ {/* Hamburger below `md` (opens the sheet); panel-collapse glyph on
+ desktop (toggles the docked sidebar). */}
+ <Menu className="size-5 md:hidden" />
+ <PanelLeft className="hidden md:block" />
<span className="sr-only">Toggle Sidebar</span>
</Button>
);