Repository navigation
Description
Problem
The AI Traffic Analytics page has a partial time range picker — only 7d / 30d / 90d relative presets (web/src/app/[locale]/(dashboard)/dashboard/traffic/page.tsx, TIME_RANGE_OPTIONS). Every other analytical page (Insights, Citations, the prompt detail page) offers 24h / 7d / 30d / 90d / All / Custom with From/To date inputs. A user who reviews yesterday's spike or a specific campaign week on Insights cannot reproduce the same window on Traffic.
Design
Mirror the Insights filter bar (reference implementations: the getDateRange helper + preset bar in web/src/app/[locale]/(dashboard)/dashboard/insights/page.tsx, and the recent prompt-detail version added in #496):
UI
- Replace the three-button strip with the full preset row:
24h / 7d / 30d / 90d / All / Custom;Customreveals From/To date inputs. Keep the current visual style of the page's picker. - Section labels that interpolate the day count ("Last {days} Days", "last {days} days") need range-aware wording — e.g. "Last 24 hours", "All time", or the explicit From–To dates for custom.
- The referral visits table's pager must reset to page 0 when the range changes (it already resets on filter changes — extend the same dependency).
Server actions (web/src/lib/actions/traffic.ts)
getTrafficSummary,getTrafficTrendand the visits query currently takedays: number. Accept an optional{ dateFrom?: string; dateTo?: string }window instead (or alongside, with the presets resolved client-side viagetDateRange), applying the repo'sexpandDateToEndOfDayconvention fromweb/src/lib/dates.tsso a bareYYYY-MM-DDTo-date includes the whole day.- All sections (summary KPIs, trend chart, referral visits table) must follow the same window from the same resolved range — no section may keep its own notion of the period.
All= no date bounds. The trend query buckets per day; verify it stays reasonable on long histories (cap or aggregate if needed and say so in the PR).
Acceptance criteria
- The picker offers
24h / 7d / 30d / 90d / All / Custom(with working From/To inputs) and defaults to7d(current behavior). - KPIs, the trend chart and the visits table all change together with the selected range; the pager resets on range change.
- Section headings describe the selected range correctly for every preset, including Custom and All.
- A window selected on Insights and the same window selected on Traffic cover the same time span (end-of-day inclusive To dates).
yarn lint,yarn typecheckandyarn format:checkpass fromweb/.
Getting started
See CONTRIBUTING.md for setup. npm run dev with the seed data (supabase/seed.sql) is enough to verify. Comment here to claim the issue before opening a PR.
Activity
Utkarsh-Singhal-26 commentedon Jul 22, 2026
hi @gkhngyk, can i work on this ?
gkhngyk commentedon Jul 22, 2026
hi @Utkarsh-Singhal-26 , I've assigned this to you. Thank you!