🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(table): mobile filters in a bottom sheet, not crammed inline (LFE-11067) (#15319)
Nikita Kabardine316b492d498
diff --git a/web/src/components/table/FilterToggleButton.tsx b/web/src/components/table/FilterToggleButton.tsxindex 450c2cc295..df1c1cb893 100644--- a/web/src/components/table/FilterToggleButton.tsx+++ b/web/src/components/table/FilterToggleButton.tsx@@ -1,4 +1,4 @@-import { PanelLeftClose, PanelLeftOpen } from "lucide-react";+import { Filter } from "lucide-react";import { useDataTableControls } from "@/src/components/table/data-table-controls";import { Badge } from "@/src/components/ui/badge";@@ -31,12 +31,8 @@ export function FilterToggleButton({onClick={() => setOpen(!open)}className={cn("flex h-8 items-center gap-2 text-sm", className)}>- {open ? (- <PanelLeftClose className="h-4 w-4" />- ) : (- <PanelLeftOpen className="h-4 w-4" />- )}- <span>{open ? "Hide" : "Show"} filters</span>+ <Filter className="h-4 w-4" />+ <span>Filters</span>{activeFacetCount > 0 && (<Badge variant="secondary" className="ml-1 h-5 px-1.5 text-xs">{activeFacetCount}diff --git a/web/src/components/table/data-table-controls.tsx b/web/src/components/table/data-table-controls.tsxindex 50c01e3b55..5ed9bd345a 100644--- a/web/src/components/table/data-table-controls.tsx+++ b/web/src/components/table/data-table-controls.tsx@@ -38,6 +38,7 @@ import {PanelLeftOpen,Plus,UnfoldVertical,+ X,} from "lucide-react";import {DropdownMenu,@@ -84,6 +85,9 @@ interface ControlsContextType {open: boolean;setOpen: React.Dispatch<React.SetStateAction<boolean>>;tableName?: string;+ /** Below `md` the panel renders inside a bottom Sheet (not the desktop rail),+ * so its header shows a plain close instead of the collapse-to-rail chrome. */+ isMobile: boolean;}export const ControlsContext = createContext<ControlsContextType | null>(null);@@ -115,7 +119,9 @@ export function DataTableControlsProvider({const setOpen = isDesktop ? setDesktopOpen : setMobileOpen;return (- <ControlsContext.Provider value={{ open, setOpen, tableName }}>+ <ControlsContext.Provider+ value={{ open, setOpen, tableName, isMobile: !isDesktop }}+ ><div// access the data-expanded state with tailwind via `group-data-[expanded=true]/controls`className="group/controls contents"@@ -132,7 +138,12 @@ export function useDataTableControls() {if (!context) {// Return default values when not in a provider (e.g., tables without the new sidebar)- return { open: false, setOpen: () => {}, tableName: undefined };+ return {+ open: false,+ setOpen: () => {},+ tableName: undefined,+ isMobile: false,+ };}return context as ControlsContextType;@@ -173,7 +184,7 @@ export function DataTableControls({blockedColumnReason,}: DataTableControlsProps) {const { isLangfuseCloud } = useLangfuseCloudRegion();- const { setOpen, tableName } = useDataTableControls();+ const { setOpen, tableName, isMobile } = useDataTableControls();const capture = usePostHogClientCapture();const [aiPopoverOpen, setAiPopoverOpen] = useState(false);const activeFilterCount = queryFilter.filters.filter(@@ -613,23 +624,41 @@ export function DataTableControls({><div className="bg-background flex h-10 shrink-0 items-center justify-between border-b px-3"><div className="flex items-center gap-1.5">- <Tooltip>- <TooltipTrigger asChild>- <Button- variant="ghost"- size="icon"- onClick={() => {- setOpen(false);- emitSidebarToggled(false, "header");- }}- aria-label="Hide filters"- className="-ml-1 h-6 w-6"- >- <PanelLeftClose className="h-3.5 w-3.5" />- </Button>- </TooltipTrigger>- <TooltipContent>Hide filters</TooltipContent>- </Tooltip>+ {isMobile ? (+ // No tooltip: the sheet auto-focuses this control on open, and a+ // Radix tooltip opens on focus — it would pop up unprompted. An X+ // is self-evident anyway.+ <Button+ variant="ghost"+ size="icon"+ onClick={() => {+ setOpen(false);+ emitSidebarToggled(false, "header");+ }}+ aria-label="Close filters"+ className="-ml-1 h-6 w-6"+ >+ <X className="h-4 w-4" />+ </Button>+ ) : (+ <Tooltip>+ <TooltipTrigger asChild>+ <Button+ variant="ghost"+ size="icon"+ onClick={() => {+ setOpen(false);+ emitSidebarToggled(false, "header");+ }}+ aria-label="Hide filters"+ className="-ml-1 h-6 w-6"+ >+ <PanelLeftClose className="h-3.5 w-3.5" />+ </Button>+ </TooltipTrigger>+ <TooltipContent>Hide filters</TooltipContent>+ </Tooltip>+ )}<span className="text-sm font-bold">Filters</span>{activeFilterCount > 0 && (<Badge variant="secondary" className="h-5 px-1.5 text-xs">@@ -748,16 +777,22 @@ export function DataTableControls({Show only active{showOnlyActive && <Check className="ml-auto h-3.5 w-3.5" />}</DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem- onClick={() => {- setOpen(false);- emitSidebarToggled(false, "menu");- }}- className="cursor-pointer"- >- Collapse sidebar- </DropdownMenuItem>+ {/* "Collapse sidebar" is desktop-rail chrome; in the mobile+ sheet the header's X already closes it. */}+ {!isMobile && (+ <>+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onClick={() => {+ setOpen(false);+ emitSidebarToggled(false, "menu");+ }}+ className="cursor-pointer"+ >+ Collapse sidebar+ </DropdownMenuItem>+ </>+ )}</DropdownMenuContent></DropdownMenu></div>diff --git a/web/src/components/table/resizable-filter-layout.tsx b/web/src/components/table/resizable-filter-layout.tsxindex 15e29f60a1..885afc8890 100644--- a/web/src/components/table/resizable-filter-layout.tsx+++ b/web/src/components/table/resizable-filter-layout.tsx@@ -1,8 +1,9 @@"use client";import { type PropsWithChildren, Children } from "react";-import { useMediaQuery } from "react-responsive";import { ResizableSplitLayout } from "@/src/components/ui/resizable-split-layout";+import { Sheet, SheetContent, SheetTitle } from "@/src/components/ui/sheet";+import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import { useDataTableControls } from "./data-table-controls";// Mirrors the trace peek's collapsed-panel rail (TraceLayoutDesktop): instead@@ -28,8 +29,14 @@ const FILTER_PANEL_MAX_DEFAULT_PCT = 30;* Expects exactly 2 children: filter sidebar (DataTableControls) and table content.*/export function ResizableFilterLayout({ children }: PropsWithChildren) {- const { open, setOpen, tableName } = useDataTableControls();- const isDesktop = useMediaQuery({ query: "(min-width: 768px)" });+ const { open, setOpen, tableName, isMobile } = useDataTableControls();+ const capture = usePostHogClientCapture();+ // Single-source the breakpoint from the controls provider (which derives+ // `open`/`setOpen` from the same value). Evaluating the media query+ // independently here let a desktop→mobile resize render the bottom sheet+ // while `open` still held the persisted DESKTOP open-state — briefly showing+ // an open desktop sidebar as a mobile sheet.+ const isDesktop = !isMobile;// Extract filter sidebar and table content from childrenconst childrenArray = Children.toArray(children).filter(Boolean);@@ -41,13 +48,48 @@ export function ResizableFilterLayout({ children }: PropsWithChildren) {? childrenArray.slice(1): childrenArray;- // On mobile, honor the open state so the hide/show toggle works the same as- // on desktop — collapsed by default, expandable via the controls button.+ // On mobile the desktop rail doesn't fit — the table takes the full width and+ // the filter panel opens in a bottom sheet (driven by the same open state the+ // "Filters" toggle in the toolbar controls), rather than squeezing the+ // desktop sidebar inline alongside the table.if (!isDesktop) {return (- <div className="flex flex-1 overflow-hidden">- {open ? filterSidebar : null}+ <div className="flex flex-1 flex-col overflow-hidden">{tableContent}+ {filterSidebar && (+ <Sheet open={open} onOpenChange={setOpen}>+ <SheetContent+ side="bottom"+ aria-describedby={undefined}+ // Emit the same close-analytics event the header X / rail / menu+ // fire, but ONLY for user-dismiss (backdrop + Escape) — these+ // Radix callbacks don't run for the programmatic close from the+ // header X, so this counts the previously-silent dismiss path+ // without double-counting the others.+ onInteractOutside={() =>+ capture("filters:sidebar_toggled", {+ tableName,+ open: false,+ trigger: "mobile_sheet_dismiss",+ })+ }+ onEscapeKeyDown={() =>+ capture("filters:sidebar_toggled", {+ tableName,+ open: false,+ trigger: "mobile_sheet_dismiss",+ })+ }+ // Hide the Sheet's own close button — the filter panel header+ // renders its own close (X), so a second one just collides with+ // the panel's controls.+ className="flex h-[85svh] flex-col gap-0 p-0 [&>button]:hidden"+ >+ <SheetTitle className="sr-only">Filters</SheetTitle>+ {filterSidebar}+ </SheetContent>+ </Sheet>+ )}</div>);}