Skip to content

Feature: Add LeetCode Stats Card Generator - #8430

Open
pisum-sativum wants to merge 25 commits into
JhaSourav07:mainfrom
pisum-sativum:feat/add-leetcode-stats-card-7812
Open

Feature: Add LeetCode Stats Card Generator#8430
pisum-sativum wants to merge 25 commits into
JhaSourav07:mainfrom
pisum-sativum:feat/add-leetcode-stats-card-7812

Conversation

@pisum-sativum

Copy link
Copy Markdown
Contributor

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

  • API Service (services/leetcode/api.ts): Queries LeetCode's public GraphQL endpoint for solved problem counts and user global ranking with fallback error handling.
  • Validation Schema (lib/validations.ts): Added leetcodeParamsSchema supporting theme selection, custom colors, dimensions, minification, and cache bypassing.
  • SVG Generator (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.
  • API Route Endpoint (app/api/leetcode/route.ts): Serves image/svg+xml cards with security CSP headers, minification, and ETag caching (304 Not Modified).
  • Unit Tests: Full test suite (api.test.ts, leetcode.test.ts, route.test.ts) covering all success, failure, and caching scenarios.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (New Feature — LeetCode Stats Card Generator)

Visual Preview

leetcode_preview

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/leetcode?username=YOUR_LEETCODE_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • 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.
  • I have starred the repo.
  • I have made sure that I have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

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
Copilot AI review requested due to automatic review settings July 28, 2026 08:13
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@retenta-bot

retenta-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

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!

@retenta-bot retenta-bot Bot changed the title Feat/add leetcode stats card 7812 Feature: Add LeetCode Stats Card Generator Jul 28, 2026
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Hey @pisum-sativum, the CI Pipeline is failing on this PR and it has been marked as status:blocked.

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 passes

2. Auto-fix common issues:

npm run format         # Auto-fix formatting with Prettier
npm run lint -- --fix  # Auto-fix lint errors where possible

3. Check the full failure log here:
👉 View CI Run

Once you push a fix and the CI passes, the status:blocked label will be removed automatically. 💪

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@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.

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 Kindly check and merge this pr.

@Aamod007 Aamod007 added level:advanced Complex contributions involving architecture, optimization, or significant feature work type:feature New features, additions, or enhancements mentor:Aamod007 labels Jul 31, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@Aamod007

Copy link
Copy Markdown
Collaborator

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!

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@Aamod007 I tried to solve the CI issue but it is still failing. Kindly check and merge if possible.

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@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 .
image

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@Aamod007 @JhaSourav07 Can u pls check this pr and merge as soon as possible.

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@Aamod007 Any updates?

@Aamod007 Aamod007 added quality:exceptional Outstanding contribution with exceptional implementation quality, testing. type:bug Something isn't working as expected labels Aug 6, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@Aamod007 There is a merge conflict do i need to resolve it?

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@Aamod007 @JhaSourav07 I have resolved the merge conflict kindly check and merge asap.

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@Aamod007 @JhaSourav07 pls merge this pr asap
image

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@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!

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @pisum-sativum, this pull request has been inactive for 3 days. It will be automatically closed in 2 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 pls merge

@pisum-sativum

Copy link
Copy Markdown
Contributor Author

@JhaSourav07 Any update?

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @pisum-sativum, this pull request has been inactive for 3 days. It will be automatically closed in 2 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

2 similar comments
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @pisum-sativum, this pull request has been inactive for 3 days. It will be automatically closed in 2 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @pisum-sativum, this pull request has been inactive for 3 days. It will be automatically closed in 2 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Hey @pisum-sativum, this pull request has been inactive for 4 days. It will be automatically closed in 1 days if no further activity occurs.

If you are still working on this, please push your latest changes or leave a comment to keep it active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:advanced Complex contributions involving architecture, optimization, or significant feature work mentor:Aamod007 quality:exceptional Outstanding contribution with exceptional implementation quality, testing. status:blocked This PR is blocked due to a failing CI check. type:bug Something isn't working as expected type:feature New features, additions, or enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add LeetCode Stats Card

3 participants