Skip to content

Fix stray line in the Contributions icon - #147

Merged
jldeen merged 1 commit into
mainfrom
jldeen-fix-contributions-icon
Aug 18, 2026
Merged

Fix stray line in the Contributions icon#147
jldeen merged 1 commit into
mainfrom
jldeen-fix-contributions-icon

Conversation

@jldeen

@jldeen jldeen commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #146 — spotted on the merged download.

Symptom

The Contributions icon had a stray line hanging off the bottom-left of the cube.

Contributions row before and after, zoomed

Root cause

Icon.tsx case 'stack' held a hand-edited copy of Primer's package-16 octicon, and the edit had mangled it. The final subpath was a leftover sliver:

M2.5 13.677v-2.3L6.5 13.8v2.3Z

It runs to y = 16.1, past the bottom of the 0 0 16 16 viewBox — that's the stray line. The same edit also truncated the cube's right vertical edge, dropped its bottom-right face entirely, and pushed the left edge out to x = 0.378 while the right stopped at x = 15, so the glyph sat visibly off-center.

Rendering the shipped path next to the upstream icon makes it obvious — the middle panel is that leftover subpath on its own:

Shipped path, stray subpath in isolation, and official package-16

Measured geometry (viewBox is 0 0 16 16):

bbox
before [0.378, 0.156 → 15.000, 16.100] overflows the bottom, asymmetric
after [1.000, 0.156 → 15.000, 15.844] in bounds, symmetric

Fix

Restore the upstream Primer package-16 path — the cube this design already intended. One line of path data.

The icon keeps its stack key, so the single call site in DevemonCard.tsx is untouched and nothing else on the card moves. I checked: this path was defined once and used once, so there was nothing else to update.

Tests

Artwork that escapes its viewBox is silently clipped by the renderer, which is exactly why this shipped unnoticed and why eyeballing it isn't good enough. tests/icon-geometry.spec.ts measures the real rendered geometry instead:

  1. card icons stay inside their viewBox — walks every <svg> the card renders, takes each path's actual getBBox(), and fails if any of it falls outside the declared viewBox. Catches this whole class of defect, not just this one icon.
  2. contributions icon is a closed, centered cube — pins the cube to a single path, horizontally symmetric within 0.05, and not hanging below the box.

Both were confirmed to fail against the old path before being committed. The first reports it precisely:

Contributions: [0.38, 0.16 -> 15.00, 16.10] outside [0, 0 -> 16, 16]

I also swept all 17 icons in Icon.tsx for the same defect — stack was the only one affected, and the rest are clean.

Validation

  • npm run check — 0 errors, 0 warnings
  • npm run build — clean
  • npx playwright test12/12 passing (10 existing + 2 new)
  • Visually confirmed in both the live render and a real download:
Downloaded card with the corrected Contributions icon

Fixes: #59

The Contributions stat used a hand-edited copy of the `package-16` octicon
that had been mangled. Its final subpath —

  M2.5 13.677v-2.3L6.5 13.8v2.3Z

was a leftover sliver running to y=16.1, past the bottom of the 16x16
viewBox, so it rendered as a stray line poking out from under the cube. The
same edit had truncated the cube's right edge and dropped its bottom-right
face, and shifted the left edge to x=0.378 while the right stopped at x=15,
leaving the glyph visibly off-center.

Measured geometry before: [0.378, 0.156 -> 15.000, 16.100]
                   after: [1.000, 0.156 -> 15.000, 15.844]

Restore the upstream Primer `package-16` path, which is the cube this
design already intended. The icon keeps its `stack` name, so no call sites
change and nothing else about the card moves.

Artwork that escapes its viewBox gets silently clipped, which is why this
shipped unnoticed, so the new tests measure the real rendered geometry of
every icon on the card rather than eyeballing it: one asserts no icon
strays outside the box it declares, the other pins the Contributions cube
to a single path, horizontally symmetric and within bounds. Both fail
against the old path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3a633ff9-3c7e-4499-825f-af5baab48b1c
@jldeen
jldeen requested a review from Damovisa as a code owner August 18, 2026 01:45
Copilot AI balanced review requested due to automatic review settings August 18, 2026 01:45

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.

Pull request overview

Restores the Contributions cube icon and adds geometry regression coverage.

Changes:

  • Replaces the malformed icon path with Primer’s package-16 path.
  • Adds Playwright checks for viewBox bounds, centering, and overflow.
Show a summary per file
File Description
src/components/ui/Icon.tsx Corrects the Contributions icon geometry.
tests/icon-geometry.spec.ts Adds icon geometry regression tests.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@jldeen
jldeen merged commit e7bcc57 into main Aug 18, 2026
9 of 10 checks passed
@jldeen
jldeen deleted the jldeen-fix-contributions-icon branch August 18, 2026 01:51
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.

Button misalignment after download

2 participants