Skip to content

feat(widgets): size-aware block variants - #23

Merged
TheGeniusOfEternity merged 3 commits into
feat/grid-4x5from
feat/block-variants
Oct 3, 2026
Merged

TheGeniusOfEternity merged 3 commits into
feat/grid-4x5from
feat/block-variants

Conversation

@TheGeniusOfEternity

Copy link
Copy Markdown
Owner

Step 3 of the grid refactor. Stacked on #22 (merge #22 and this together).

Summary

Blocks now have purpose-built layouts per size instead of one design.

Architecture: server/src/shared/widget/blocks/ has one renderer per block type, chosen by size family (blockVariant):

Family Sizes Idea
tiny 1×1 one headline number or symbol
strip 2×1, 3×1 title + 2–3 facts in one line
wide 4×1 title + a row of facts or a compact chart
card 2×2, 3×2, 2×4 the previous design, unchanged
large 4×2+ roomy layout; falls back to card where not designed

New layouts:

  • 1×1, 2×1 and 4×1 for every data block: avatar + followers, top language % + mix bar, commits + 🔥 streak, a ~48-week compact heatmap, merged %, status emoji, solved count + difficulty bar, …
  • 4×2 for the GitHub profile (big avatar, name, bio, stats) and LeetCode (one bar per difficulty).
  • Text fits itself to any size and is centred vertically.

The full table is in docs/design/grid-and-blocks.md.

Shared parts: BigStat, SegmentBar, Avatar, fitFontSize, wrapText, plus a compact "add a username" state for small blocks.

Sizes: compact sizes added to BLOCK_SIZES; the legacy doubled sizes stay so migrated widgets remain valid. Text defaults to 2×1.

Placement: a new block that doesn't fit at its default size uses the largest smaller allowed size that does. Previously a widget with four 2×2 blocks refused a 5th block even though the limit is 8.

Fix: the layout update schema still capped saves at 5 blocks. Also pushed to #22.

Test plan

  • Showcase widgets with every block in 1×1, 2×1, 4×1, 2×2 and 4×2 rendered from live data in SVG; legend and label truncation tuned from screenshots
  • Editor: variants identical to SVG; corner-resizing a 1×1 tile to 2×2 switches to the card layout and repacks neighbours
  • blockVariants.test.tsx renders every block in every allowed size (52 cases: expected data present, no NaN/undefined); placement fallback; 8-block layout save
  • format:check, lint, typecheck, test (54 client + 177 server), build, typecheck:api

- Per-type renderers in shared/widget/blocks/ chosen by size family
  (tiny 1x1, strip 2-3x1, wide 4x1, card, large); the previous designs
  become the card variant
- New layouts: 1x1, 2x1 and 4x1 for every data block, 4x2 for the GitHub
  profile and LeetCode; text fits itself to any size
- Shared parts: BigStat, SegmentBar, Avatar, fitFontSize, wrapText;
  compact 'add a username' state for small blocks
- BLOCK_SIZES gains compact sizes (legacy sizes kept for migrated
  widgets); text defaults to 2x1; new blocks fall back to smaller sizes
  when the default does not fit
- Fix: layout updates were capped at 5 blocks
- Tests render every block in every allowed size
@vercel

vercel Bot commented Oct 3, 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 Oct 3, 2026 3:21pm UTC

@TheGeniusOfEternity
TheGeniusOfEternity marked this pull request as ready for review October 3, 2026 15:33
@TheGeniusOfEternity
TheGeniusOfEternity merged commit f1ccf38 into feat/grid-4x5 Oct 3, 2026
3 checks passed
@TheGeniusOfEternity
TheGeniusOfEternity deleted the feat/block-variants branch October 3, 2026 15:33
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