Skip to content

feat(site): add DateRangePicker to analytics page#23992

Closed
DanielleMaywood wants to merge 1 commit into
danielle/behavior-collapsiblefrom
danielle/analytics-datepicker
Closed

feat(site): add DateRangePicker to analytics page#23992
DanielleMaywood wants to merge 1 commit into
danielle/behavior-collapsiblefrom
danielle/analytics-datepicker

Conversation

@DanielleMaywood

@DanielleMaywood DanielleMaywood commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was written by Coder Agent on behalf of Danielle Maywood 🤖

PR 3/4 in a stack to unify agent settings pages.

What

Replaces the fixed 30-day date range on the analytics page with a URL search param–driven DateRangePicker, and extracts a shared date utility.

Why

The analytics page previously hardcoded a 30-day lookback with no way to change it. Adding the same DateRangePicker component already used on the Spend page (PR 4) lets users select custom date ranges. Persisting the selection in URL search params (startDate/endDate) means the range survives page refreshes and can be shared via URL.

The date utility extraction addresses a duplication issue: both the analytics and spend pages need to detect exclusive-midnight end dates (the date picker uses midnight of the following day as the exclusive upper bound) and adjust the display by −1 ms. This logic was duplicated inline in both view components. utils/dateRange.ts provides isMidnight and toInclusiveDateRange as a single source of truth.

Changes

AgentAnalyticsPage — parses startDate/endDate from URL search params, validates them, falls back to the default 30-day range. Passes onDateRangeChange that updates the URL params and resets to page 1.

AgentAnalyticsPageView — uses toInclusiveDateRange() from the new utility instead of inline midnight detection. Adds SectionHeader for consistent page headings.

utils/dateRange.tsisMidnight(date) predicate and toInclusiveDateRange(dateRange, hasExplicitDateRange) helper. formatUsageDateRange will be added in PR 4 when it gains its first consumer.

Layout standardizationChatModelAdminPanel and MCPServerAdminPanel changed from space-y-3 to space-y-6 to match the vertical rhythm used across the other settings pages. PRInsightsView gains a SectionHeader with AdminBadge for consistency.

Stack

  1. CollapsibleSection + shared fixes (feat(site): add CollapsibleSection component and shared utilities #23990)
  2. Behavior page CollapsibleSection cards (feat(site): wrap behavior page sections in CollapsibleSection cards #23991)
  3. ➡️ This PR — Analytics DateRangePicker
  4. Unified Spend page (feat: merge Limits + Usage into unified Spend page #24093)

@github-actions github-actions Bot added the community Pull Requests and issues created by the community. label Apr 2, 2026
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from 086af11 to d1126ba Compare April 2, 2026 18:11
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 2647970 to e866d28 Compare April 2, 2026 18:12
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from d1126ba to 5a71b01 Compare April 2, 2026 18:20
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch 2 times, most recently from 10e5668 to ca81cdd Compare April 7, 2026 12:13
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch 2 times, most recently from 2df2da3 to 8c37a80 Compare April 7, 2026 12:58
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from ca81cdd to 2ad4c35 Compare April 7, 2026 12:58
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from 8c37a80 to 4a8ae12 Compare April 7, 2026 13:23
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 2ad4c35 to 0d52625 Compare April 7, 2026 13:23
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from 4a8ae12 to 1339fdf Compare April 7, 2026 13:35
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 0d52625 to d18e3a3 Compare April 7, 2026 13:35
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from 1339fdf to c9b492e Compare April 7, 2026 13:40
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch 2 times, most recently from f36406b to 847cb45 Compare April 7, 2026 13:51
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from c9b492e to d763bdd Compare April 7, 2026 13:51
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 847cb45 to 421a732 Compare April 7, 2026 13:56
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch 2 times, most recently from fcfb877 to 254e305 Compare April 7, 2026 15:54
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 421a732 to 581dfdc Compare April 7, 2026 15:54
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from 254e305 to debdc88 Compare April 7, 2026 16:00
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 581dfdc to 70f8e74 Compare April 7, 2026 16:00
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from debdc88 to f79e590 Compare April 7, 2026 16:01
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch 2 times, most recently from 4fe05f9 to f04c99f Compare April 7, 2026 16:17
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch 2 times, most recently from be3c23d to 646b432 Compare April 7, 2026 16:24
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from f04c99f to 069be14 Compare April 7, 2026 16:24
@DanielleMaywood DanielleMaywood force-pushed the danielle/behavior-collapsible branch from 646b432 to 669328e Compare April 7, 2026 17:54
@DanielleMaywood DanielleMaywood force-pushed the danielle/analytics-datepicker branch from 069be14 to 37b0cbb Compare April 7, 2026 17:54
@jakehwll jakehwll removed the community Pull Requests and issues created by the community. label Apr 8, 2026
@github-actions github-actions Bot added the stale This issue is like stale bread. label Apr 16, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

stale This issue is like stale bread.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants