🪢 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
fix(chart-view): make Visualize panel responsive on mobile (LFE-11067) (#15326)
Nikita Kabardinf5dd66c15c4a
diff --git a/web/src/features/chart-view/components/ChartViewPanel.stories.tsx b/web/src/features/chart-view/components/ChartViewPanel.stories.tsxnew file mode 100644index 0000000000..1b5822148e--- /dev/null+++ b/web/src/features/chart-view/components/ChartViewPanel.stories.tsx@@ -0,0 +1,62 @@+import preview from "../../../../.storybook/preview";+import { fn } from "storybook/test";+import { type DataPoint } from "@/src/features/widgets/chart-library/chart-props";+import { ChartViewPanel } from "./ChartViewPanel";+import { DEFAULT_CONFIG } from "../vocab";++/**+ * Deterministic fixture — count of events per hour, broken down by model.+ * Small on purpose: `ChartViewPanel` just hands `data` to the shared+ * `chart-library`, so a couple of buckets/series are enough to render a real+ * line chart.+ */+const MODELS = [+ { name: "gpt-4o", base: 12 },+ { name: "claude-3-5-sonnet", base: 8 },+];+const HOURS = ["00:00", "01:00", "02:00", "03:00"];++const DATA: DataPoint[] = HOURS.flatMap((hour, hourIndex) =>+ MODELS.map(({ name, base }, seed) => ({+ time_dimension: hour,+ dimension: name,+ metric: base + ((hourIndex + seed * 2) % 4) * 3,+ })),+);++/**+ * The "Take B" chart-view layout: a maximized canvas with the "Visualize"+ * config docked in a collapsible panel (`EventsChartView`'s production UI).+ * Presentational — `data`/`config` come in as props, so it renders without+ * any query or context dependency.+ *+ * The panel's outer row is `flex-col md:flex-row` (LFE-11067): a config panel+ * beside the chart at desktop widths, stacked below it under the `md`+ * breakpoint. That's a real viewport-width media query, not a container+ * query, so — unlike most other layout stories in this repo — a fixed-width+ * wrapper `<div>` here would only clip the desktop layout rather than trigger+ * the stack (this Storybook setup has no viewport-switching addon wired up).+ * To see the mobile layout, narrow the actual browser window or the devtools+ * device toolbar to ~390px while viewing this story — the preview iframe is+ * fluid-width, so the same media query that fires on a phone fires there too.+ */+const meta = preview.meta({+ component: ChartViewPanel,+ args: {+ config: DEFAULT_CONFIG,+ data: DATA,+ onConfigChange: fn(),+ },+ decorators: [+ // `ChartViewPanel`'s root relies on a bounded-height flex ancestor+ // (`flex-1`/`min-h-0`) — same as its production host (`EventsChartView`+ // inside the events table) — so give it one here.+ (Story) => (+ <div className="flex h-[420px] flex-col">+ <Story />+ </div>+ ),+ ],+});++export const Default = meta.story({});diff --git a/web/src/features/chart-view/components/ChartViewPanel.tsx b/web/src/features/chart-view/components/ChartViewPanel.tsxindex 69df975f45..68e7f04418 100644--- a/web/src/features/chart-view/components/ChartViewPanel.tsx+++ b/web/src/features/chart-view/components/ChartViewPanel.tsx@@ -66,11 +66,16 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({);return (- <div className="flex min-h-0 flex-1">- {/* Canvas */}- <div className="flex min-h-0 min-w-0 flex-1 flex-col gap-1 p-3">+ <div className="flex min-h-0 flex-1 flex-col md:flex-row">+ {/* Canvas — floored on mobile so a tall stacked config panel can't shrink+ the chart to 0 on short viewports (flex-basis:0 gets none of a negative+ deficit); desktop keeps min-h-0 for the side-by-side row. */}+ <div className="flex min-h-64 min-w-0 flex-1 flex-col gap-1 p-3 md:min-h-0"><div className="flex items-center justify-between gap-2">- <div className="text-foreground text-sm font-bold">+ <div+ className="text-foreground min-w-0 truncate text-sm font-bold"+ title={describeConfig(config)}+ >{describeConfig(config)}</div>{chartActions}@@ -97,7 +102,7 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({{/* Config panel */}{open ? (- <div className="flex w-72 shrink-0 flex-col gap-3 overflow-y-auto border-l p-3">+ <div className="flex w-full flex-col gap-3 overflow-y-auto border-t p-3 md:w-72 md:shrink-0 md:border-t-0 md:border-l"><div className="flex items-center justify-between"><span className="text-sm font-bold">Visualize</span><Button@@ -134,7 +139,7 @@ export const ChartViewPanel = React.memo(function ChartViewPanel({) : null}</div>) : (- <div className="flex shrink-0 flex-col items-center border-l p-1.5">+ <div className="flex flex-col items-center border-t p-1.5 md:shrink-0 md:border-t-0 md:border-l"><Buttonvariant="ghost"size="icon-xs"