Skip to content

feat(profile): add "Get README Badge" dialog with Markdown/HTML copy - #223

Open
1-DARK wants to merge 1 commit into
O2sa:mainfrom
1-DARK:feat/readme-badge
Open

1-DARK wants to merge 1 commit into
O2sa:mainfrom
1-DARK:feat/readme-badge

Conversation

@1-DARK

@1-DARK 1-DARK commented Oct 6, 2026

Copy link
Copy Markdown

Summary

Adds a Get README Badge button to the developer profile page (/user/[username]). It opens a modal where developers can preview their DevImpact score badge and copy a ready-to-use snippet for their GitHub profile README. Every embedded badge links back to the user's DevImpact profile, which creates a backlink to the project.

Closes #219

What changed

  • Button: "Get README Badge" added to the action buttons in UserProfileClient, next to Compare and Copy link.
  • Modal:
    • Live badge preview (Shields.io) that updates when the style changes.
    • Three style options: flat, flat-square and score color (red, orange, yellow, green or bright green, depending on the score).
    • Copy Markdown and Copy HTML buttons with a "Copied!" confirmation that lasts 2 seconds.
    • Closes on backdrop click, the Close button and the Escape key. Page scroll is locked while it is open.
    • Rendered through a portal with role="dialog" and aria-modal.
  • Snippets: both wrap the badge image in a link to the user's profile page.
    • Markdown: [![DevImpact Score](badge-url)](profile-url)
    • HTML: <a href="profile-url"><img src="badge-url" alt="DevImpact Score" /></a>
  • Responsive fix: the hero section now stacks until lg instead of sm, so the action buttons no longer get squeezed.
  • i18n: new profile.* keys added to en.json and ar.json. Snippet inputs use dir="ltr" so URLs display correctly in RTL.

Files changed

  • src/features/developer/components/user-profile-client.tsx
  • src/locales/en.json
  • src/locales/ar.json

Notes for reviewers

  • The profile link in the snippet uses window.location.origin, so no new environment variable is needed. If you prefer a fixed production URL, I can switch it to a constant or env var.
  • The badge shows the score at the time of copying. It does not update automatically when the score changes. A dynamic badge could be a follow-up using a /api/badge/[username] endpoint with the Shields endpoint format.
  • If a Content-Security-Policy is added later, img-src must allow https://img.shields.io.

Screenshots

English Arabic
Button in profile header image image
Modal and live preview image image
Copied state image Screenshot 2026-10-07 at 5 00 10 AM

Testing

  • ✅ npm run lint passes
  • ✅ npm run build passes
  • ✅ Style switching updates the preview, the Markdown snippet and the HTML snippet
  • ✅ Copy Markdown and Copy HTML both work and show "Copied!"
  • ✅ Pasted the Markdown into a GitHub README or gist: the badge renders and links to the profile
  • ✅ Arabic layout checked (RTL, snippets stay LTR)
  • ✅ Responsive check at phone, iPad mini and desktop widths
  • ✅ Light and dark mode

Checklist

  • ✅ The referred issue is not blocked currently
  • ✅ All unit tests passed after changes were made

@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

@1-DARK is attempting to deploy a commit to the osama's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Thank you for the pull request! ✅

A maintainer will review this soon. Please be patient while we take a look. 🙌

@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
dev-impact Ready Ready Preview Oct 7, 2026 12:20am UTC

This branch was successfully deployed

1 active deployment
Preview — 3bd57371 Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Add copyable GitHub Profile README Badge generator on Developer Profile

1 participant