Skip to content

feat: add optional 3D isometric month headers and weekday labels#800

Open
Sahitya3105 wants to merge 3 commits into
JhaSourav07:mainfrom
Sahitya3105:main
Open

feat: add optional 3D isometric month headers and weekday labels#800
Sahitya3105 wants to merge 3 commits into
JhaSourav07:mainfrom
Sahitya3105:main

Conversation

@Sahitya3105
Copy link
Copy Markdown

@Sahitya3105 Sahitya3105 commented May 27, 2026

Description

Fixes #792

This PR implements optional 3D isometric month headers and day-of-week labels (Mon, Wed, Fri) flat on the isometric grid floor.

Key changes:

  • Added labels (boolean) and labelColor (hex) to the validation schema and BadgeParams types.
  • Designed a volumetric 3D offset projection to map month transitions dynamically inside the visible 14-week window.
  • Placed weekday labels flat along the far-left coordinate bounds (i = -1.2) to ensure zero visual obstruction.
  • Aligned month names along the front-left baseline bounds (j = 7.2) to keep text fully visible.
  • Supported seamless static colors and prefers-color-scheme auto-theme variable injections (var(--cp-text)).
  • Included comprehensive test coverage under lib/svg/generator.test.ts.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • ⚙️ Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

(Rendered optional text labels below the front edge and Mon/Wed/Fri tags flat along the left edge when labels=true is requested)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_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.
image image

Copilot AI review requested due to automatic review settings May 27, 2026 19:13
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 27, 2026

@Sahitya3105 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

👋 Hey @Sahitya3105, welcome to CommitPulse! 🎉

Thanks for opening your first pull request — this is a big deal and we appreciate the effort!

While you wait for a review, please double-check:

  • ✅ You've read the CONTRIBUTING.md checklist
  • npm run lint, npm run format, and npm run test all pass locally
  • ✅ Your PR has a visual preview if it touches any SVG output
  • 💬 You've joined our Discord for faster PR feedback

A maintainer will review your PR shortly. Hang tight! 🚀

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds optional month/weekday “isometric” labels to the streak SVG, with an API/query parameter to enable them and a customizable label color.

Changes:

  • Extend BadgeParams with labels and labelColor
  • Parse/validate labels + labelColor for the streak API route
  • Render SVG labels (static + auto-theme) and add generator tests

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
types/index.ts Adds new badge parameters for enabling labels and customizing label color
lib/validations.ts Parses labels and sanitizes labelColor from query params
lib/svg/generator.ts Implements label rendering and hooks it into both SVG modes
lib/svg/generator.test.ts Adds tests for label rendering + color behavior
app/api/streak/route.ts Wires parsed params into the SVG generation request flow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/svg/generator.ts Outdated
Comment on lines +245 to +246
const tx = s(300 + (label.col - 7.2) * 16 + 8);
const ty = s(120 + (label.col + 7.2) * 9 + 20) + Math.round(20 * sf);
Comment thread lib/svg/generator.ts Outdated
Comment on lines +258 to +259
const tx = s(300 + (-1.2 - day.row) * 16);
const ty = s(120 + (-1.2 + day.row) * 9 + 20) + Math.round(20 * sf);
Comment thread lib/svg/generator.ts Outdated
const tx = s(300 + (label.col - 7.2) * 16 + 8);
const ty = s(120 + (label.col + 7.2) * 9 + 20) + Math.round(20 * sf);
elements += `
<text x="${tx}" y="${ty}" text-anchor="middle" fill="${labelColorHex}" fill-opacity="0.6" font-family="&quot;Roboto&quot;, sans-serif" font-size="${Math.round(10 * sf)}px" font-weight="400" letter-spacing="1px">${label.text}</text>`;
Comment thread lib/svg/generator.ts Outdated
const tx = s(300 + (-1.2 - day.row) * 16);
const ty = s(120 + (-1.2 + day.row) * 9 + 20) + Math.round(20 * sf);
elements += `
<text x="${tx}" y="${ty}" text-anchor="end" fill="${labelColorHex}" fill-opacity="0.6" font-family="&quot;Roboto&quot;, sans-serif" font-size="${Math.round(10 * sf)}px" font-weight="400" letter-spacing="1px">${day.text}</text>`;
Comment thread lib/svg/generator.test.ts Outdated
Comment on lines +448 to +455
it('does not render labels when labels parameter is absent or false', () => {
const svg = generateSVG(
mockStats,
{ user: 'avi', labels: false } as unknown as BadgeParams,
mockCalendar
);
expect(svg).not.toContain('class="isometric-labels"');
});
@github-actions github-actions Bot added the type:feature New features, additions, or enhancements label May 27, 2026
@JhaSourav07
Copy link
Copy Markdown
Owner

@Sahitya3105

Attach visual preview
video or screenshot for review

@Sahitya3105
Copy link
Copy Markdown
Author

@Sahitya3105

Attach visual preview video or screenshot for review

This is a backend SVG generation feature — the output is an API response. To preview it locally, run npm run dev and visit:

localhost:3000/api/streak?user=YOUR_USERNAME&labels=true for Issue #792
I was unable to attach a screenshot as I don't have a live GitHub token configured locally to fetch real contribution data for the SVG render. Happy to add one if you can share a test token or suggest a mock approach.

@JhaSourav07
Copy link
Copy Markdown
Owner

@Sahitya3105

you can generate you own token from developer setting ?

@github-actions github-actions Bot added the needs-rebase This PR has merge conflicts and needs a rebase. label May 28, 2026
@github-actions
Copy link
Copy Markdown

⚠️ Hey @Sahitya3105, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

1 similar comment
@github-actions
Copy link
Copy Markdown

⚠️ Hey @Sahitya3105, this PR has merge conflicts with the main branch.

Please pull the latest changes and resolve the conflicts so we can review it!

git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-lease

Once resolved, the needs-rebase label will be removed automatically on the next check. 🙌

@Sahitya3105
Copy link
Copy Markdown
Author

@JhaSourav07 conflicts removes and preview images added

@github-actions github-actions Bot removed the needs-rebase This PR has merge conflicts and needs a rebase. label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New features, additions, or enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add optional 3D isometric month headers and weekday labels

3 participants