Skip to content

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

fix(filters): fix width of filter sidebar (#10382)

Nimarf827aa74860e
diff --git a/web/src/components/nav/sidebar-notifications.tsx b/web/src/components/nav/sidebar-notifications.tsx
index aa635a98a0..a1388befac 100644
--- a/web/src/components/nav/sidebar-notifications.tsx
+++ b/web/src/components/nav/sidebar-notifications.tsx
@@ -208,7 +208,7 @@ export function SidebarNotifications() {
<Button
variant="ghost"
size="sm"
- className="absolute right-2 top-2 h-6 w-6 p-0"
+ className="absolute right-1.5 top-2.5 h-5 w-5 p-0"
onClick={() => {
capture("notification:dismiss_notification", {
notification_id: currentNotification.id,
@@ -217,13 +217,15 @@ export function SidebarNotifications() {
}}
title="Dismiss"
>
- <X className="h-4 w-4" />
+ <X className="h-3.5 w-3.5" />
</Button>
- <CardHeader className="p-4 pb-0">
+ <CardHeader className="px-3 pb-0 pr-6 pt-2.5">
<CardTitle className="text-sm">{currentNotification.title}</CardTitle>
- <CardDescription>{currentNotification.description}</CardDescription>
+ <CardDescription className="mt-1">
+ {currentNotification.description}
+ </CardDescription>
</CardHeader>
- <CardContent className="p-4 pt-2">
+ <CardContent className="px-3 pb-2.5 pt-1.5">
{currentNotification.link &&
(currentNotification.linkContent ? (
<Link
@@ -238,7 +240,7 @@ export function SidebarNotifications() {
{currentNotification.linkContent}
</Link>
) : (
- <Button variant="secondary" size="sm" asChild>
+ <Button variant="secondary" size="sm" className="w-full" asChild>
<Link
href={currentNotification.link}
target="_blank"
diff --git a/web/src/components/table/data-table-controls.tsx b/web/src/components/table/data-table-controls.tsx
index fdd522e4b4..3ab0077e20 100644
--- a/web/src/components/table/data-table-controls.tsx
+++ b/web/src/components/table/data-table-controls.tsx
@@ -6,7 +6,8 @@ import {
useRef,
useCallback,
} from "react";
-import useLocalStorage from "@/src/components/useLocalStorage";
+import { useMediaQuery } from "react-responsive";
+import useSessionStorage from "@/src/components/useSessionStorage";
import { cn } from "@/src/utils/tailwind";
import { compactNumberFormatter } from "@/src/utils/numbers";
import { Accordion } from "@/src/components/ui/accordion";
@@ -44,6 +45,7 @@ import { useLangfuseCloudRegion } from "@/src/features/organizations/hooks";
interface ControlsContextType {
open: boolean;
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
+ tableName?: string;
}
export const ControlsContext = createContext<ControlsContextType | null>(null);
@@ -57,14 +59,15 @@ export function DataTableControlsProvider({
tableName?: string;
defaultSidebarCollapsed?: boolean;
}) {
+ const isDesktop = useMediaQuery({ query: "(min-width: 768px)" });
const storageKey = tableName
? `data-table-controls-${tableName}`
: "data-table-controls";
- const defaultOpen = !defaultSidebarCollapsed;
- const [open, setOpen] = useLocalStorage(storageKey, defaultOpen);
+ const defaultOpen = isDesktop ? !defaultSidebarCollapsed : false;
+ const [open, setOpen] = useSessionStorage(storageKey, defaultOpen);
return (
- <ControlsContext.Provider value={{ open, setOpen }}>
+ <ControlsContext.Provider value={{ open, setOpen, tableName }}>
<div
// access the data-expanded state with tailwind via `group-data-[expanded=true]/controls`
className="group/controls contents"
@@ -81,7 +84,7 @@ export function useDataTableControls() {
if (!context) {
// Return default values when not in a provider (e.g., tables without the new sidebar)
- return { open: false, setOpen: () => {} };
+ return { open: false, setOpen: () => {}, tableName: undefined };
}
return context as ControlsContextType;
@@ -1019,13 +1022,13 @@ interface FilterModeTabsProps {
function FilterModeTabs({ mode, onModeChange }: FilterModeTabsProps) {
return (
- <div className="mb-2 flex items-center gap-1.5 px-4">
+ <div className="mb-2 flex flex-wrap items-center gap-1.5 px-4 @container">
<span className="text-[10px] text-muted-foreground/80">Mode:</span>
- <div className="inline-flex flex-1 rounded border border-input/50 bg-background text-[10px]">
+ <div className="flex flex-1 flex-col rounded border border-input/50 bg-background text-[10px] @[7.5rem]:min-w-[140px] @[7.5rem]:flex-row">
<button
onClick={() => onModeChange("select")}
className={cn(
- "flex-1 rounded-l px-3 py-0.5 transition-colors",
+ "flex-1 rounded-t px-3 py-0.5 transition-colors @[7.5rem]:rounded-l @[7.5rem]:rounded-tr-none",
mode === "select"
? "bg-accent font-medium text-accent-foreground"
: "text-muted-foreground hover:text-foreground",
@@ -1033,11 +1036,11 @@ function FilterModeTabs({ mode, onModeChange }: FilterModeTabsProps) {
>
SELECT
</button>
- <div className="w-px bg-border/50" />
+ <div className="h-px bg-border/50 @[7.5rem]:h-auto @[7.5rem]:w-px" />
<button
onClick={() => onModeChange("text")}
className={cn(
- "flex-1 rounded-r px-3 py-0.5 transition-colors",
+ "flex-1 rounded-b px-3 py-0.5 transition-colors @[7.5rem]:rounded-r @[7.5rem]:rounded-bl-none",
mode === "text"
? "bg-accent font-medium text-accent-foreground"
: "text-muted-foreground hover:text-foreground",
diff --git a/web/src/components/table/resizable-filter-layout.tsx b/web/src/components/table/resizable-filter-layout.tsx
index e2e913c93a..c160c27d73 100644
--- a/web/src/components/table/resizable-filter-layout.tsx
+++ b/web/src/components/table/resizable-filter-layout.tsx
@@ -14,7 +14,7 @@ import { useDataTableControls } from "./data-table-controls";
* Expects exactly 2 children: filter sidebar (DataTableControls) and table content.
*/
export function ResizableFilterLayout({ children }: PropsWithChildren) {
- const { open } = useDataTableControls();
+ const { open, tableName } = useDataTableControls();
const isDesktop = useMediaQuery({ query: "(min-width: 768px)" });
// On mobile, render children as-is (stacked layout)
@@ -27,8 +27,8 @@ export function ResizableFilterLayout({ children }: PropsWithChildren) {
const filterSidebar = childrenArray[0];
const tableContent = childrenArray.slice(1);
- const filterDefault = 25;
- const tableDefault = 75;
+ const filterDefault = 15;
+ const tableDefault = 85;
// If sidebar is collapsed or doesn't exist, render only the table content
if (!open || !filterSidebar) {
@@ -37,9 +37,16 @@ export function ResizableFilterLayout({ children }: PropsWithChildren) {
);
}
+ const autoSaveId = tableName ? `filter-layout-${tableName}` : "filter-layout";
+
return (
- <ResizablePanelGroup direction="horizontal" className="flex h-full w-full">
- <ResizablePanel defaultSize={filterDefault} minSize={20} maxSize={50}>
+ <ResizablePanelGroup
+ direction="horizontal"
+ className="flex h-full w-full"
+ autoSaveId={autoSaveId}
+ storage={sessionStorage}
+ >
+ <ResizablePanel defaultSize={filterDefault} minSize={12} maxSize={50}>
{filterSidebar}
</ResizablePanel>
<ResizableHandle />