feat(customize): add dark/light preview background toggle for contribution graph - #8308
Conversation
|
@armanpanigrahi59 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 valuable feature that enhances the user interface by allowing users to preview their contributions in both dark and light modes. It aligns well with our previous decision to improve the customization options in the studio, similar to the 'Copy SVG' button feature. Great job on ensuring comprehensive test coverage as well! Looking forward to your contributions. 😊 |
📦 Next.js Bundle Size Report (Gzipped Sizes)
📊 Summary of Totals
|
…7#2425) Add a Sun/Moon toggle button to the Live Preview section of the contribution graph embed preview page (/customize). Clicking the button switches the preview container background between GitHub dark (#0d1117) and GitHub light (#ffffff), letting users instantly visualise how their isometric SVG embed will appear in both dark and light README contexts. Key design decisions: - Toggle state (previewBg) is intentionally local (useState) and is never synced to URL params, so it has zero effect on the export snippet or the API request. - The preview container background is driven by Tailwind utility classes chosen to match the exact GitHub README background colours. - Sun icon shows when the page is in dark-preview mode (click → switch to light); Moon icon shows in light-preview mode (click → switch to dark). - Button carries a descriptive �ria-label and itle that update together with the icon and label text. - All i18n keys are added to all 9 locale files (en, de, es, fr, hi, ja, ko, pt, zh); locale parity tests pass. Tests added (page.preview-bg-toggle.test.tsx, 7 cases): 1. Toggle button renders on page load. 2. Preview container initialises with data-preview-bg=dark. 3. First click switches container to data-preview-bg=light. 4. After switching to light, button shows Dark label. 5. Second click toggles back to data-preview-bg=dark. 6. Export snippet URL is not polluted by the toggle state. 7. history.replaceState is not called when toggling. Fixes: JhaSourav07#2425
889962c to
028846c
Compare
Aamod007
left a comment
There was a problem hiding this comment.
Dark/light preview background toggle for the contribution graph customizer — spans 11 files including locale updates. CI failing, please fix.
Labels: level:intermediate (11 files but mostly locale strings), quality:clean, type:feature, type:testing, mentor:Aamod007
Aamod007
left a comment
There was a problem hiding this comment.
Re-reviewing after noting the only CI failure is Vercel authorization (not code-related). All other checks (Format · Lint · Typecheck · Test, Production Build, CodeQL) pass. Approving — the Vercel deploy auth is a repo-level config issue, not a code problem.
Add a Sun/Moon toggle button to the Live Preview section of the contribution graph embed preview page (/customize). Clicking the button switches the preview container background between GitHub dark (#0d1117) and GitHub light (#ffffff), letting users instantly visualise how their isometric SVG embed will appear in both dark and light README contexts.
Key design decisions:
Tests added (page.preview-bg-toggle.test.tsx, 7 cases):
Fixes: #2425
Description
Fixes # (issue number)
Pillar
Visual Preview
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.