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
merge: feat(themes): Add themed SVG fallbacks for API error responses (#8253)
## Description
Fixes#7796
## Pillar
- [x] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [ ] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
Previously, when hitting API rate limits or facing validation errors,
CommitPulse returned a generic `#2d0000` (red) SVG error box which
looked out of place on beautifully themed GitHub Profile READMEs.
With this PR:
- Error responses now parse the incoming query params (`theme`, custom
`bg`, `accent`, `text`, etc.) using `resolveErrorTheme`.
- A matching visually-themed SVG fallback is generated via
`buildInlineErrorSVG` containing the appropriate border radius,
background, text, and accent borders.
- Supported in `/api/spotify`, `/api/spotlight`, `/api/streak`,
`/api/wakatime`, and `/api/wrapped`.
*Example theme response when requesting `theme=dracula`:*
```xml
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="150" viewBox="0 0 400 150">
<rect width="400" height="150" fill="#282a36" rx="8" stroke="#bd93f9" stroke-opacity="0.25" stroke-width="1"/>
<text x="200" y="75" text-anchor="middle" dominant-baseline="central" fill="#f8f8f2" font-family="sans-serif" font-size="13">Rate Limit Exceeded</text>
</svg>
```
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
- [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- [ ] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] I have started the repo.
- [x] I have made sure that i have only one commit to merge in this PR.
- [x] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
- [x] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.
0 commit comments