You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(competitors): add a date range filter to the Competitors page #892
The Competitors page always shows the last 30 days (#951). competitors/page.tsx builds that window in last30Days() (line 1149) and passes it to getCompetitorComparison (line 1185). There is no control to change it, so a marketer can't compare the last week with the last quarter, or look at all-time numbers.
Everything needed already exists:
getCompetitorComparison in web/src/lib/actions/tracking.ts (line 2009) accepts days: { dayFrom, dayTo } (served from the daily rollups) plus dateFrom/dateTo.
The shared DateRangeFilter is already used by Insights, Prompts and Traffic.
Add a DateRangeFilter to the Competitors page header (7d / 30d / 90d / all-time / custom). The default stays 30d, so nothing changes for existing users.
The benchmark and per-model numbers reload for the chosen window.
Always pass a days window for the benchmark, including all-time (days: {}), so the read stays on the rollup tables. A raw scan over a large brand's results exceeds the statement timeout. Reusing or extracting Insights' getDateRange is preferred over writing a new one, and last30Days() can go once the filter drives the window.
Run yarn lint and yarn build from web/ before opening the PR — see CONTRIBUTING.md.
Activity