Skip to content

feat(api): add monthly summary badge mode with view=monthly #160

@JhaSourav07

Description

@JhaSourav07

🧩 Background

Current badge focuses on contribution grid + streak style output. Some users want a compact monthly summary view for clean READMEs.

🎯 Objective

Add a new badge mode that displays current month contribution totals and month-over-month delta.

💡 Example usage

/api/streak?user=octocat&view=monthly

📁 Files to check

  • app/api/streak/route.ts
  • lib/svg/generator.ts
  • types/index.ts
  • README.md
  • lib/svg/generator.test.ts

🛠️ Implementation steps

  • Parse optional view query param in route.
  • Support values:
    • default (existing behavior)
    • monthly (new)
  • In monthly mode:
    • compute current month total from contribution days.
    • compute previous month total.
    • show delta (+12%, -8%, etc.) or absolute diff if preferred.
  • Render compact SVG layout for monthly mode (smaller and text-focused).
  • Keep theme/color parameters compatible with both views.
  • Add tests for mode routing + snapshot tests for monthly SVG.
  • Add docs section with examples.

✅ Definition of done

  • view=monthly renders a valid SVG summary.
  • Existing default mode remains unchanged.
  • Tests + README examples are added.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions