From 7573e48458dbf079085c52de441b6a0136f1080e Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 09:00:30 +0000 Subject: [PATCH] README badges: put your Codey stats on your GitHub profile /b/ (served by /api/og with kind=badge, no new function) returns an SVG badge that keeps itself up to date: best code WPM, division, runs and streak, with the player's own Kap. Two styles, a card and a shields-sized flat pill, each in dark and light. It uses only shapes and system fonts, since GitHub's image proxy blocks outside resources, and caches for half an hour so the badge catches up as you practice. Share profile now has a README badge section: a live preview, style and theme pickers, and a snippet to copy (Markdown, or HTML that follows the reader's GitHub theme). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018xNjY7412Rp5bFuw5h69yu --- api/_lib/badge.test.ts | 33 +++++++ api/_lib/badge.ts | 118 ++++++++++++++++++++++++++ api/_lib/kap-look.ts | 14 ++- api/og/[id].ts | 16 +++- src/components/ProfileShareDialog.tsx | 3 + src/components/social/ReadmeBadge.tsx | 73 ++++++++++++++++ src/lib/share-links.test.ts | 15 ++++ src/lib/share-links.ts | 30 +++++++ vercel.json | 1 + 9 files changed, 297 insertions(+), 6 deletions(-) create mode 100644 api/_lib/badge.test.ts create mode 100644 api/_lib/badge.ts create mode 100644 src/components/social/ReadmeBadge.tsx diff --git a/api/_lib/badge.test.ts b/api/_lib/badge.test.ts new file mode 100644 index 0000000..ec8fb0b --- /dev/null +++ b/api/_lib/badge.test.ts @@ -0,0 +1,33 @@ +import { describe, expect, it } from 'vitest'; +import { renderBadge, textWidth } from './badge'; +import { FLAME_TIERS } from '../../src/utils/flame-tiers'; +import type { SharedProfile } from './profile-card'; + +const profile = { userId: 'u', name: 'Nan