From 1c139402d0ebbd0a1910acb65b88db6ab3d5baad Mon Sep 17 00:00:00 2001 From: TJ Date: Thu, 20 Aug 2026 16:08:00 -0700 Subject: [PATCH] feat(site/src): use DateTimeRangePicker on the AI sessions page (#28426) Follow-up to #28392. Wires the new `DateTimeRangePicker` into the AI Gateway sessions page, replacing the text-expression `DateTimeRangeFilter`, and removes the redundant "Filters" preset button. - The picker trigger sits in the filter row alongside the search field and the User/Provider/Client/Model dropdowns. - The preset queries (All sessions, My sessions) behind the Filters button duplicate the search field and the user dropdown, so the button is dropped by passing no presets. Other pages using the shared `Filter` component are unaffected. - No API or URL contract changes: the filter query still stores resolved `started_after`/`started_before` timestamps. The picker's preset id is display-only component state, shown only while the URL range still matches what the preset resolved to, so shared links keep rendering as custom ranges. - Clearing the search resets the picker to the default window, labeled "Last 24 hours". - The picker trigger chevron now uses the shared animated `ChevronDownIcon`, rotating on open like the other dropdown triggers. - The old `DateTimeRangeFilter` component is left in place (still referenced by its stories); removing it can be a separate cleanup. Storybook: the sessions filter story now asserts the Filters button is gone and exercises opening the picker; existing stories updated to the new value shape. `biome`, `tsc`, and the Storybook interaction tests for the page pass. --- Generated by Coder Agents on behalf of @tracyjohnsonux. --- .../DateTimeRangePicker.tsx | 5 ++- .../ListSessionsFilter.stories.tsx | 41 +++++++++++++------ .../ListSessionsPage/ListSessionsFilter.tsx | 27 ++++-------- .../ListSessionsPage/ListSessionsPage.tsx | 37 +++++++++++++++-- .../ListSessionsPageView.stories.tsx | 10 ++--- 5 files changed, 78 insertions(+), 42 deletions(-) diff --git a/site/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx b/site/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx index 20f75fa24de..0d97f72fb6c 100644 --- a/site/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx +++ b/site/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx @@ -3,9 +3,10 @@ * hidden until "Custom range" is chosen. */ -import { CalendarIcon, CheckIcon, ChevronDownIcon } from "lucide-react"; +import { CalendarIcon, CheckIcon } from "lucide-react"; import { type FC, type KeyboardEvent, useEffect, useId, useState } from "react"; import type { DateRange as DayPickerDateRange } from "react-day-picker"; +import { ChevronDownIcon } from "#/components/AnimatedIcons/ChevronDown"; import { Button, type ButtonProps } from "#/components/Button/Button"; import { Calendar } from "#/components/Calendar/Calendar"; import { Input } from "#/components/Input/Input"; @@ -210,7 +211,7 @@ export const DateTimeRangePicker: FC = ({ return ( -