Skip to content

feat(site): shareable result card + one-tap share to X - #1

Open
NagaYu wants to merge 5 commits into
mainfrom
feat/shareable-result-card
Open

feat(site): shareable result card + one-tap share to X#1
NagaYu wants to merge 5 commits into
mainfrom
feat/shareable-result-card

Conversation

@NagaYu

@NagaYu NagaYu commented Jul 18, 2026

Copy link
Copy Markdown
Owner

What & why

Makes a probe result something people want to post, to drive organic spread. Adds a branded, canvas-rendered result card and a one-tap Share on X, plus a static OG image so every shared demo link unfurls a rich preview. Site-only — no src/, public API, report.ts, dist/, or quirks-DB changes; no new runtime deps; no telemetry or network calls.

Changes

  • site/share-card.js (new) — renders a ProbeResult to <canvas> at 1200×630 (social) and 1080×1080 (square). System fonts only, offline, dark theme matching --bg/--panel/--accent. Shows only ProbeResult fields (tier badge, hero matmul GFLOPS → shader-compile ms fallback, GPU vendor/arch, browser+OS, wordmark + demo URL). Same privacy stance as src/report.ts — no UA/screen/locale/fingerprinting. Includes an arcTo fallback for engines without ctx.roundRect (pre-2023).
  • site/index.html / site/main.js — card preview panel, 1200×630 / 1080×1080 size toggle, and three new buttons in the existing .actions row (reusing current styles): Download card (1200×630 PNG), Copy card image (ClipboardItem, download fallback + hint where unsupported), Share on X (intent/tweet with ≤200-char text + demo URL). renderCard() is wrapped in try/catch so a card failure can never take the probe results down with it. Existing Copy report (Markdown) and Download JSON untouched.
  • site/og.png (new) — generic 1200×630 "probe your browser's real WebGPU capability" hero (not a specific result); wired via og:image/og:title/og:description/twitter:card=summary_large_image. Absolute URL matches the live Pages path.
  • test/browser/share-card.spec.ts (new) + .github/workflows/ci.yml — Playwright smoke tests (card canvas renders non-blank at correct dims, all 3 buttons present alongside the old actions, size toggle re-renders at 1080×1080, X intent URL carries short text + demo URL). CI browser job now runs prepare-site.mjs first (same step as the Pages deploy) so /site/ has its bundle.

Testing

  • pnpm lint, pnpm typecheck, pnpm build, pnpm size all green — core bundle unchanged (4727 B gzip, budget 5120 B); site/ isn't in the library bundle.
  • Playwright 15/15 across chromium / firefox / webkit (incl. WASM-fallback engines, which still render the card).
  • Verified on a real GPU (Chromium 148 / apple metal-3): webgpu-full, 40.7 GFLOPS card. The roundRect fallback path was exercised by deleting ctx.roundRect at runtime — output is byte-identical to the native path.

Deploy / follow-up (not in this PR)

  • Merging to main triggers the Pages deploy (pages.yml) that puts the card + og.png live.
  • The X/OG rich preview can only be confirmed after deploy by sharing a real link (X fetches OG server-side and caches). Post to social only after the deploy lands — the current live site has no OG image, so a link shared pre-deploy won't unfurl the card.

🤖 Generated with Claude Code

NagaYu and others added 5 commits July 18, 2026 16:52
Renders a ProbeResult as a branded 1200×630 / 1080×1080 card entirely
on <canvas> — system fonts, no deps, offline. Shows only ProbeResult
fields (same privacy stance as src/report.ts) and builds the short
X-intent share text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds Download card / Copy card image (ClipboardItem with download
fallback) / Share on X buttons to the existing actions row, a live
card preview panel, and OG/Twitter meta pointing at the static og.png.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Generic 1200×630 'probe your browser' hero (not a specific result),
referenced by the og:image meta so every shared demo link unfurls.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Asserts the card canvas renders (non-blank, correct dimensions), all
three share buttons exist alongside the old actions, the size toggle
re-renders at 1080×1080, and the X intent URL carries short text plus
the demo URL. CI browser job now generates the site bundle first, same
as the Pages deploy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
roundRect only exists in ~2023+ engines, and this demo is exactly the
page people open in old browsers to check WebGPU support. Two guards:
an arcTo fallback path (verified pixel-identical output), and a
try/catch around card rendering so a drawing failure can never take
the probe results display down with it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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