Skip to content

feat: Add dynamic Badge & Stats Share Card generator in Contributor leaderboard#1842

Open
SamXop123 wants to merge 3 commits into
recodehive:mainfrom
SamXop123:feat/badge-share-card
Open

feat: Add dynamic Badge & Stats Share Card generator in Contributor leaderboard#1842
SamXop123 wants to merge 3 commits into
recodehive:mainfrom
SamXop123:feat/badge-share-card

Conversation

@SamXop123
Copy link
Copy Markdown

Description

This PR implements a client-side dynamic share/export card generator inside the Contributor Leaderboard.

Fixes #1839

Key Implementations:

  • Card Generator Engine (src/utils/cardGenerator.ts): Constructs a custom 1200 x 630px (Open Graph optimized) card using browser-native HTML5 Canvas. Includes Recode Hive branding, circular formatted avatar clipping, statistics breakdown columns (PRs & Points), and highlights unlocked achievement badges (graying out locked badges).
  • Dual Export Actions (BadgeModal.tsx): Adds side-by-side action buttons for contributors:
    • Download Button: Compiles the card and triggers an instant direct browser PNG file download.
    • Share Button: Triggers the native OS share dialog (via navigator.share) for social media integration.
  • Mock Fallback Bugfix (leaderboard.tsx): Fixed the dev fallback rendering bug where errors in API fetching would hide mock lists instead of rendering the mockContributors fallback array.
  • UX Improvements: Implemented fallback letter-avatars if CORS/avatar load fails, loading states for button indicators, and media-query overrides for responsive alignment.

Preview

2026-06-03.15-31-31.mp4

Output:

recodehive-testuser1-achievements

Verification Details

  • Verified local dev environment (npm run dev)
  • Executed npm run typecheck (Passed successfully with 0 errors)
  • Executed npm run build (Passed successfully with 0 errors)

Type of Change

  • New feature (e.g., new page, component, or functionality)
  • Bug fix (non-breaking change that fixes an issue)
  • UI/UX improvement (design, layout, or styling updates)
  • Performance optimization (e.g., code splitting, caching)
  • Documentation update (README, contribution guidelines, etc.)
  • Other (please specify):

  • My code follows the style guidelines of this project.
  • I have tested my changes across major browsers and devices
  • My changes do not generate new console warnings or errors .
  • I ran npm run build and attached screenshot(s) in this PR.
  • This is already assigned Issue to me, not an unassigned issue.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 3, 2026

@SamXop123 is attempting to deploy a commit to the recode Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. The estimated time for response is 5–8 hrs.

In the meantime, please provide all necessary screenshots and make sure you run - npm build run , command and provide a screenshot, a video recording, or an image of the update you made below, which helps speed up the review and assignment. If you have questions, reach out to LinkedIn. Your contributions are highly appreciated!😊

Note: I maintain the repo issue every day twice at 8:00 AM IST and 9:00 PM IST. If your PR goes stale for more than one day, you can tag and comment on this same issue by tagging @sanjay-kv.

We are here to help you on this journey of open source. Consistent 20 contributions are eligible for sponsorship 💰

🎁 check our list of amazing people we sponsored so far: GitHub Sponsorship. ✨

📚Your perks for contribution to this community 👇🏻

  1. Get free Consultation use code recode50 to get free: Mentorship for free.

  2. Get the Ebook for free use code recode at checkout: Data Science cheatsheet for Beginners.

  3. Check out this weekly Newsletter: Sanjay's Newsletter.

If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

@github-actions github-actions Bot added in-review The current changes are in review and would need approval and testing before merging level 1 10 points recode this is label for leaderboard labels Jun 3, 2026
@github-actions github-actions Bot added this to the recode:launch 3.0 milestone Jun 3, 2026
@github-actions github-actions Bot added Enhacement gssoc26 label gssoc:approved gssoc label high priority gssoc26 label level:critical gssoc label 80pts medium gssoc26 label qualiy:excepional gssoc label 1.5x labels Jun 3, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

✅ Synchronized metadata from Issue #1839:

  • Labels: level 1, recode, Enhacement, high priority, medium, level:critical, qualiy:excepional, gssoc:approved
  • Milestone: recode:launch 3.0

@SamXop123
Copy link
Copy Markdown
Author

SamXop123 commented Jun 3, 2026

Maintainers, please review the PR and just tell if u wish to have any design modifications or any improvements, i m ready to update as required.,
also, i noticed a little typo in the quality:exceptional label 😅 there is a missing 't' in both the words.

@Adez017
Copy link
Copy Markdown
Member

Adez017 commented Jun 5, 2026

Hi @SamXop123 great feature implementation to be honest and this us really good , i just had some suggestion below :

  • instead of a diamond brack near recodehive (as mention in image below ) can we our logo their?
  • The color pallete used is seem to be a dark gradient can we choose something light palette for the card .
image

Copy link
Copy Markdown
Member

@Adez017 Adez017 left a comment

Choose a reason for hiding this comment

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

few suggestions that needs to be resolved .

@SamXop123
Copy link
Copy Markdown
Author

SamXop123 commented Jun 5, 2026

few suggestions that needs to be resolved .

@Adez017 thanks for the review. Btw for the color palette, what exactly do you want as the background? Like a completely light (white) background or a lighter variant of the previous blue background ?

Is this fine ??
recodehive-testuser1-achievements (1)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 5, 2026

✅ Synchronized metadata from Issue #1839:

  • Labels: level 1, recode, Enhacement, high priority, medium, level:critical, qualiy:excepional, gssoc:approved
  • Milestone: recode:launch 3.0

@SamXop123
Copy link
Copy Markdown
Author

SamXop123 commented Jun 5, 2026

@Adez017 I have pushed the commit for this, if you liked this variant you can merge straightaway.
otherwise if you want any other color palette just mention, I would change it again to match the needful.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
recode-website Ready Ready Preview, Comment Jun 6, 2026 6:46am

@Adez017
Copy link
Copy Markdown
Member

Adez017 commented Jun 6, 2026

image Everything else looks good but can we have a little space between `Recode` and `hive` , rest things looks good atm

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 6, 2026

✅ Synchronized metadata from Issue #1839:

  • Labels: level 1, recode, Enhacement, high priority, medium, level:critical, qualiy:excepional, gssoc:approved
  • Milestone: recode:launch 3.0

@SamXop123
Copy link
Copy Markdown
Author

resolved! @Adez017

recodehive-testuser1-achievements (5)

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

Labels

Enhacement gssoc26 label gssoc:approved gssoc label high priority gssoc26 label in-review The current changes are in review and would need approval and testing before merging level:critical gssoc label 80pts level 1 10 points medium gssoc26 label qualiy:excepional gssoc label 1.5x recode this is label for leaderboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add dynamic Badge & Stats Share Card generator in Contributor Leaderboard

2 participants