Feature: Add LeetCode Stats Card Generator - #8430
Conversation
Fixes JhaSourav07#6096 by preserving valid UTF-8, avoiding faulty binary text fallbacks, and adding heuristic to repair misencoded artifacts.
…owing them Moves buffer header checks outside try/catch blocks so that failures in buffer.toString (e.g. in tests mocking the method) correctly propagate to callers. Only third-party parser failures (pdf-parse, mammoth) are silently caught. Fixes the failing error-resilience test.
…bage-chars # Conflicts: # components/burnout/BurnoutRiskTable.tsx
…, and achievements types
…files to origin/main
…ypes to match origin/main
|
@pisum-sativum 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 pull request adds a new feature that generates an SVG card displaying LeetCode statistics, which enhances user engagement by providing visual feedback on their coding achievements. It also includes a robust API service and validation schema. Notably, similar past decisions have focused on enhancing accessibility and user experience through dynamic SVG elements and themed fallbacks for error handling. These considerations could be beneficial to keep in mind as we review this PR. Thank you for your contribution! |
|
🚨 Hey @pisum-sativum, the CI Pipeline is failing on this PR and it has been marked as Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run format:check # Check Prettier formatting
npm run lint # Run ESLint
npm run typecheck # TypeScript type check
npm run test # Run unit tests (Vitest)
npm run build # Verify production build passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
|
@Aamod007 @JhaSourav07 Kindly check and merge. I have done the necessary changes only the CI is failing which I am not able to solve for the time being. |
|
@JhaSourav07 Kindly check and merge this pr. |
Aamod007
left a comment
There was a problem hiding this comment.
A LeetCode stats generator is a highly requested feature! Unfortunately, the CI pipeline is currently failing (\Format · Lint · Typecheck · Test). Please fix the build and test errors so we can merge this!
|
Hi! Could you please re-run the CI pipeline to see if the recent failures resolve? Let us know if you need any help fixing the build errors! |
…iveViewer, and achievements types
|
@Aamod007 I tried to solve the CI issue but it is still failing. Kindly check and merge if possible. |
|
@Aamod007 @JhaSourav07 Can you pls check and let me know if any changes are required or not. Since I have 5 active assigned issues I cannot take up any new issues. Kindly merge as soon as possible . |
|
@Aamod007 @JhaSourav07 Can u pls check this pr and merge as soon as possible. |
|
@Aamod007 Any updates? |
Aamod007
left a comment
There was a problem hiding this comment.
Fantastic work adding the LeetCode stats card generator! The SVG rendering looks excellent, and you've done a great job providing a robust set of tests for the new API service and generator components. The fallback error handling and validation logic are well done. Thanks also for fixing the resume-parser encoding issue. Approved!
|
@Aamod007 There is a merge conflict do i need to resolve it? |
|
@Aamod007 @JhaSourav07 I have resolved the merge conflict kindly check and merge asap. |
|
@Aamod007 @JhaSourav07 pls merge this pr asap |
|
@JhaSourav07 could you please merge all the PRs I've worked on? I've been requesting this for several days now but they are still pending. I would really appreciate it if you could review and merge them as soon as possible. Thank you! |
|
If you are still working on this, please push your latest changes or leave a comment to keep it active. |
|
@JhaSourav07 pls merge |
|
@JhaSourav07 Any update? |
|
If you are still working on this, please push your latest changes or leave a comment to keep it active. |
2 similar comments
|
If you are still working on this, please push your latest changes or leave a comment to keep it active. |
|
If you are still working on this, please push your latest changes or leave a comment to keep it active. |
|
If you are still working on this, please push your latest changes or leave a comment to keep it active. |


Description
Fixes #7812
Introduced a new SVG generator module and API endpoint (
/api/leetcode) that takes a LeetCode username and fetches public profile data to display a card with problems solved (Easy, Medium, Hard) and current global ranking.Features Added
services/leetcode/api.ts): Queries LeetCode's public GraphQL endpoint for solved problem counts and user global ranking with fallback error handling.lib/validations.ts): AddedleetcodeParamsSchemasupporting theme selection, custom colors, dimensions, minification, and cache bypassing.lib/svg/leetcode.ts): Renders a premium quality SVG card featuring LeetCode branding, problem difficulty breakdown (Easy#00b8a3, Medium#ffc01e, Hard#ff375f), total solved badge, and global ranking.app/api/leetcode/route.ts): Servesimage/svg+xmlcards with security CSP headers, minification, and ETag caching (304 Not Modified).api.test.ts,leetcode.test.ts,route.test.ts) covering all success, failure, and caching scenarios.Pillar
Visual Preview
Checklist before requesting a review:
CONTRIBUTING.mdfile.localhost:3000/api/leetcode?username=YOUR_LEETCODE_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.