Skip to content

[FEAT] Add date range filter (7d / 30d / 90d) to PR Analytics widget #2449

@vbarik317-droid

Description

@vbarik317-droid

Problem Statement

Is your feature request related to a problem?
The commit activity chart has a 7d / 14d / 30d / 90d range selector, but the PR Analytics widget always shows all-time data — creating inconsistency when reviewing a specific time period.

Describe the solution you'd like
Add the same range selector to the PR Analytics widget so users can filter average review time, merge rate, and open/closed PR counts by time range.

Proposed Solution

Proposed Solution

  • Reuse the existing range selector component from the commit chart
  • Pass selected range as a query param to /api/metrics/prs?range=30d
  • Update the PR metrics API route to accept and apply the range param
  • Default range: 30d
  • All PR stat tiles (merge rate, review time, PR counts) update on range change

Implementation Notes

  • Check src/app/api/metrics/prs/ — extend date filtering if not already supported
  • Reuse the same RangeSelector or toggle component used by the commit chart
  • Avoid duplicate fetches — debounce or use useEffect with range as dependency

Why this helps
Makes PR analytics consistent with commit analytics and gives users meaningful time-scoped insights.

Checklist

  • Range selector added to PR Analytics widget
  • API route accepts range query param
  • All PR metrics update on range change
  • Default range is 30d
  • No TypeScript errors / lint issues

Feature Area

Dashboard

Alternatives Considered

No response

Acceptance Criteria

  • ...
  • ...

Additional Context

No response

Metadata

Metadata

Labels

enhancementNew feature or requestgssoc:assignedGSSoC: Issue assigned to a contributorneeds-triageNeeds maintainer triage

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions