Skip to content

feat(widgets): GitHub activity, pull request and status blocks - #20

Merged
TheGeniusOfEternity merged 1 commit into
mainfrom
feat/github-blocks
Oct 3, 2026
Merged

TheGeniusOfEternity merged 1 commit into
mainfrom
feat/github-blocks

Conversation

@TheGeniusOfEternity

Copy link
Copy Markdown
Owner

Summary

Three new GitHub blocks (plus a "GitHub Activity" preset), implemented in both renderers from the shared geometry per the add-block-type / widget-render-parity skills.

Block Shows Options
github-commits Commits this year, current streak (through yesterday if today is empty), best streak, contribution heatmap Streaks, heatmap
github-prs Total / merged / open, bar + two-column breakdown (merged / open / closed %) Breakdown
github-status Status emoji, message (up to 3 lines), "Busy" chip; "No status set" otherwise —
  • Size-aware heatmap: the number of weeks comes from the block's content width (heatmapWeeks): 17 weeks in a 1-column block, 39 in a full-width one. It's the first step toward "block variants for different sizes".
  • Data: GitHub GraphQL (one cached query per block), which always requires GITHUB_TOKEN. Without it the block shows "Add GITHUB_TOKEN on the server to show this block"; unknown users show "GitHub profile not found". Custom image emoji in statuses are dropped (they can't render as text).
  • Text parity fix: SVG truncation used a flat 0.56em glyph width, which underestimated Cyrillic, bold digits and %. The new shared estimateTextWidth uses per-character-class widths calibrated in the browser ("Смёрджено" estimate 61px vs measured 61.4px). It now drives SVG truncation, the title/meta row (the title keeps its width and the meta shrinks, like the HTML flex row) and full-vs-compact stat numbers. I also shortened the Russian "merged" label to «Слито».

Test plan

  • Live data for a real account: iframe and SVG match (heatmap weeks, stats, PR breakdown, status emoji); in the editor the new blocks appear in the library and the toggles work
  • Server: GraphQL mapping (levels, streaks, closed PRs, emoji parsing), missing user/token errors, SVG output for all three blocks (heatmap cell count, breakdown, busy chip), width estimate calibration
  • Client: heatmap weeks by width (17 / 39), toggles, PR percentages, status and empty states
  • format:check, lint, typecheck, test (53 client + 62 server), build, typecheck:api

Before deploying: make sure GITHUB_TOKEN is set in Vercel (a fine-grained token with public read access is enough).

- github-commits: commits this year, current/best streak, contribution
  heatmap sized to the block width (17 weeks at 1 column, 39 at 2)
- github-prs: total/merged/open with a merged/open/closed breakdown
- github-status: status emoji, message and busy flag
- GraphQL fetchers with caching and clear errors (no token, not found);
  'GitHub Activity' preset; editor toggles and library glyphs
- Shared estimateTextWidth (per-character-class, calibrated to the widget
  font) drives SVG truncation, title/meta layout and stat formatting so
  SVG cuts text where the HTML canvas does
@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
widgecode Ignored Ignored Preview Sep 29, 2026 7:34pm UTC

@TheGeniusOfEternity
TheGeniusOfEternity merged commit 447a147 into main Oct 3, 2026
3 checks passed
@TheGeniusOfEternity
TheGeniusOfEternity deleted the feat/github-blocks branch October 3, 2026 14:23
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.

1 participant