feat: add customizable label URL parameter for CommitPulse card title#8246
Conversation
|
@sureshsuriya is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
This PR adds a new feature that allows users to customize the title displayed on the CommitPulse card via a URL parameter. It includes validation and sanitization to enhance security and usability. This is somewhat related to previous decisions regarding responsive design and stability for long labels in the SectionLabel component, which aimed to prevent clipping and ensure proper rendering. If you have any questions or need further clarification, feel free to ask! Happy coding! |
📦 Next.js Bundle Size Report (Gzipped Sizes)✨ No significant bundle size changes detected. 📊 Summary of Totals
|
Aamod007
left a comment
There was a problem hiding this comment.
This is an excellent feature addition! Giving users the ability to supply custom string labels directly in the URL params (while preserving backwards compatibility for boolean \label=false) adds great flexibility. The XSS sanitization and text truncation rules are exactly what we need to keep the SVGs safe and visually intact.
The implementation is very clean, and I appreciate the comprehensive unit tests!
Label Justification:
- \level:critical: Assigned based on 5 files changed across type definitions, zod validation, and SVG rendering logic.
- \quality:clean: Excellent validation schema transforms and robust test coverage for edge cases like XSS.
- \ ype:feature: Adds a brand new parameter capability for custom badge labels.
- \mentor:Aamod007: Assigned as required.
|
🎉 Congratulations @sureshsuriya! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Description
Fixes #5725
This PR adds support for a custom
labelURL parameter that allows users to customize the title displayed above the isometric grid on the CommitPulse card.Changes
Added support for
labelas a custom string while preserving the existing boolean behavior.Updated request validation to:
label=falsetofalse.label=truetotrue.Added sanitization to prevent SVG/XML injection.
Added truncation for labels longer than 40 characters with an ellipsis.
Updated both the standard and auto-theme SVG generators to render the custom label when provided.
Preserved the existing default title behavior when
labelis omitted.Added unit tests covering validation, custom label rendering, sanitization, truncation, and default behavior.
Pillar
Visual Preview
N/A – This change introduces a new URL parameter for customizing the card title. Existing behavior remains unchanged when the parameter is omitted.
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/streak?user=YOUR_USERNAME).npm run formatandnpm run lintlocally and resolved all errors (CI will fail otherwise).feat(themes): ...,fix(calculate): ...).README.mdif I added a new theme or URL parameter.