Skip to content

feat: support dynamic timeframe ranges via query parameter (30, 90, 180, 365 days) #794

@Sahitya3105

Description

@Sahitya3105

Is your feature request related to a problem? Please describe.

Currently, CommitPulse hardcodes the visualization landscape to a fixed 98-day grid (representing a 14-week block). While 98 days is a great default, users who want a compact sprint-based badge on their sidebar (e.g., 30 days) or a comprehensive yearly visual (365 days) cannot customize the layout.

Describe the solution you'd like

Introduce a range parameter allowing users to select their contribution window:

  • range=30 (approx. 4 weeks): A compact, high-density dashboard.
  • range=90 (approx. 13 weeks): Similar to the current default.
  • range=180 (approx. 26 weeks): Half-year review.
  • range=365 (52 weeks): Full-year circular/monolithic timeline.

Proposed API Query Schema

  • range=number (default: 98, allowed values: 30, 60, 90, 180, 365).

Suggested Technical Implementation Outline

  • Dynamic GraphQL Fetching: Modify the GitHub GraphQL API request payload to fetch contributions starting from today - range days instead of a hardcoded offset.
  • Dynamic ViewBox & Grid Math:
    • Instead of hardcoded SVG viewBox="0 0 W H", calculate W and H dynamically based on the number of column tracks: cols = Math.ceil(range / 7).
    • Calculate grid origin offsets dynamically to center the isometric city inside the responsive SVG canvas.
  • Aspect Ratio Maintenance: Adjust the base border and background path calculations to resize proportionally.

I would love to be assigned this issue to work on it as part of GSSOC '26!

Describe alternatives you've considered

I considered hardcoding two separate routes (e.g., /api/streak and /api/yearly), but using a unified, dynamic range query parameter is a much cleaner, more scalable solution that keeps the codebase DRY (Don't Repeat Yourself).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions