Repository navigation
feat(www): social cards in the site's light theme - #7820
Conversation
β¦ogo and blues, and SVG author avatars that fall back to initials when satori can't size them Co-authored-by: alexander <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
@coderabbitai review |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared card design and assets www/src/og/card.ts, www/src/og/render.ts, www/src/og/card.test.ts |
The shared frame uses light-theme colors, a dot grid, and a wordmark. The renderer supplies the wordmark and dot-grid assets, and tests compare exported colors with theme tokens. |
Page-specific card content www/src/og/card.ts, www/src/og/card.test.ts, www/src/og/render.test.ts |
Home, documentation, and post cards use updated layouts and content formatting. New helper tests and card fixtures cover labels, titles, descriptions, sizing, and card rendering. |
SVG avatar validation www/src/og/live.ts, www/src/og/live.test.ts, www/src/og/render.test.ts |
Avatar fetching accepts SVG responses with valid dimensions and omits SVGs without them. Tests cover dimension validation and rendered PNG output. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Possibly related PRs
- trpc/trpc#7799: Implements the same light social-card redesign and SVG avatar handling in the OG card code.
- trpc/trpc#7778: Adds the website wordmark asset imported by the OG renderer.
Suggested reviewers: nick-lucas
Merge Risk: 
Minimal Β· up to 1eac0
-
The light card redesign has no identified merge-blocking issue.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 6 files.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix Β· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
β¦ize or its viewBox's ratio, falls back to initials too Co-authored-by: alexander <[email protected]>
@trpc/client
@trpc/next
@trpc/openapi
@trpc/react-query
@trpc/server
@trpc/tanstack-react-query
@trpc/upgrade
commit: |
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> Builds on [trpc#7820](trpc#7820) (light social cards), now merged. This diff is only the sponsor card. ## Why - `/sponsor`'s social card is a plain doc card: the headline and a line of text. It doesn't show who sponsors tRPC, or ask anyone to. - A shared sponsor link should show the people and companies behind tRPC, and say how to join them. ## What - **A `sponsor` card** (`www/src/og/card.ts`), in trpc#7820's light style with `main`'s logo and blues: - The wordmark, and a filled **β₯ Sponsor tRPC** button where other cards have their section pill. It's `--brand` like the site's buttons: white on it is 3.63:1, AA for 28px bold. - The page's headline, and "MIT licensed, and kept going by 20 sponsors." - **Partners** (Silver and up), by rank: each one's avatar, name and tier, such as "Silver partner". Up to 4 fit. - **The other sponsors**, most given first: a row of 12 overlapping avatars, then a count of the rest (`+5`). - `github.com/sponsors/trpc` in the link blue. - **The data** comes from `sponsors.json`, through `sponsorCard` in `www/src/sponsors.ts`, so the card follows the next sponsor sync. Partners past the fourth join the avatar row. - **Avatars** use the same fetching as post authors' (`www/src/og/live.ts`): GitHub avatars at 128px, a 4s timeout, and SVGs only if Satori can size them. One that doesn't load shows initials on the brand blue, and the card is cached for 10 minutes instead of as a page, so the next request tries again. - **Wired to `/sponsor`:** `vite.config.ts` registers the card in place of the doc card. `og:image` and `twitter:image` stay `/og/sponsor.png`. The alt text now ends with "Sponsor at github.com/sponsors/trpc." ### Before and after Before is trpc#7820. After is this PR, with live avatars.   With no avatar loaded, everyone shows initials:  ## Links - [Sponsor](https://www-git-cursor-www-og-sponsor-card-55df-trpc.vercel.app/sponsor): the [card](https://www-git-cursor-www-og-sponsor-card-55df-trpc.vercel.app/og/sponsor.png), with partners, sponsors' avatars and the Sponsor tRPC button. ## Alternatives considered - **Partner logos instead of avatars:** the site draws partners' wordmarks as React components (`partner-logos.tsx`). Each would need porting to Satori, and a new partner's logo would be missing until someone draws it. Avatars come with every sponsor. - **The whole sponsor cloud:** 20 bubbles sized by giving don't read at the size a card is shown. Two rows, with the partners named, do. - **The page's pink heart and glow:** this PR keeps to the brand blues, like the other cards. ## Testing - `www` tests pass (258). New tests cover: - `sponsorCard`: partners first by rank, with their tier; the others by what they've given; and the count adding up to every sponsor, with none twice; - the alt text; - rendering the sponsor card; - a fetch-to-render test where every avatar is an unsizable `<svg/>`, which falls back to initials; - `fetchLive` fetching each sponsor's avatar, and the 10-minute cache when one fails. - `pnpm lint`, typecheck and `oxfmt --check` pass in `www`. - `pnpm build` passes ("All 698 of trpc.io's URLs work"). - In the built `_ssr` function, `/og/sponsor.png` returns a 200 PNG. The other cards are unchanged. - The built `/sponsor` page has `og:image` and `twitter:image` at `/og/sponsor.png`, and the new alt text. - Rebased onto `main` after trpc#7820 merged: tests, lint and typecheck pass again. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-6f5c802a-e6b6-56e6-9da7-69eddc4455df?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-6f5c802a-e6b6-56e6-9da7-69eddc4455df&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7821?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png" width="162" height="28"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796224722&installation_model_id=443568&pr_number=7821&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7821&signature=56c0816fa09ca7ecebe96809f3718ee913230a9dae07e55d366f5ca2d78c75fa"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Sponsor pages now have a dedicated social-sharing card featuring partner tiers, backer avatars, and a count of additional sponsors. * The card highlights up to four partners and twelve backers, with remaining sponsors prioritized by ranking. It includes a link to the sponsor page and displays names or initials when profile images are unavailable. * **Bug Fixes** * Social-sharing images continue to render at the expected size when sponsor or author avatars lack image dimensions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <[email protected]>
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Why
og:image) are dark with a diagonal pattern. The site's default look is light: white, the home page's dot grid, and the brand blue.mainon its own. It keeps today's logo and brand colours: nothing from #7778 and no theme token changes.What
Only
www/src/og/changes.--brand-darkto--brand-light.public/img/logo-text-black.svg) at the top left.Docs,Docs Β· v10,API reference,Blog,Sponsor,MediaorSearch.@shared/ui/theme.cssand fails if the card colours drift from it.--foregroundand--muted-foreground.--brand(#398ccb, large text).--brand-dark(#2e77af, 4.8:1 on white).Interface: TRPCProcedureBuilder<β¦>.viewBoxand nowidthandheightin pixels, such as<svg/>. It was CodeRabbit's finding on feat(www): light social cards, and the site's blue with AA shadesΒ #7799.pattern.svg, the old diagonal pattern./og/<page path>.png),og:imageon the preview's own host, the live data and its timeouts, caching, and the 404 for an unknown card.Before and after
Before is
main. After is this PR. Rendered locally from the dev server, with live stars, downloads and avatars.Home
Docs: Quickstart
Post with two authors' avatars
Post by the tRPC team (SVG avatar)
API reference, with a long title (after only)
Links
Docs Β· v10.Alternatives considered
maindoesn't use that colour anywhere, so the cards use the theme's--brand-darkand--brand-lightinstead./og/and retry without avatars: that would hide other bugs. Instead, avatars satori can't draw are dropped before rendering, using satori's own sizing rule.Testing
wwwtests pass (247). New tests cover:theme.css;<svg/>falls back to initials and an SVG with aviewBoxis drawn;<svg/>avatar made satori throwmissing "viewBox".pnpm lint, typecheck andoxfmt --checkpass inwww.pnpm buildinwwwpasses. The build's old-URL check: "All 698 of trpc.io's URLs work"._ssrfunction:main;Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit