feat(tools): per-category embeddable badge SVG + gallery#3191
Open
0motionguy wants to merge 1 commit into
Open
feat(tools): per-category embeddable badge SVG + gallery#31910motionguy wants to merge 1 commit into
0motionguy wants to merge 1 commit into
Conversation
Extends the existing star-history SVG embed pattern (v3 deltas defensibility 2.0) to category ranking badges. README authors can embed a live "Trending in <Category>" SVG badge — every embed is free viral marketing for TrendingRepo. Files: - src/app/api/og/category-badge/[slug]/route.tsx (new) — dynamic [slug] = one of 32 category ids. Returns image/svg+xml self- contained (no external font/image refs, inline system-font stack). Reads consensus-trending + repo-categories maps; renders top-3 ranked repos + composite scores for the category. Cache-Control: s-maxage=3600, swr=86400. - src/app/api/og/category-badge/__tests__/ — vitest assertions on valid SVG XML + content-type + slug-derived category name in output. - src/app/tools/category-badges/page.tsx + loading.tsx + error.tsx (new) — gallery showing all 32 badges with markdown snippet to copy. - src/app/tools/page.tsx (modified, +7 lines) — adds Category Badges entry to CHART_TOOLS array next to Treemap and Star History. - vitest.config.ts (modified) — adds the badge route test pattern (next/server requires the vitest loader path, same as oembed/x402). No publicly stale batches: when consensus-trending is past 4h, the badge renders a "Refreshing" state instead of stale top-3. Companion PRs: C-CAT #3174 (taxonomy ids), classify #3185 (per-repo assignments), per-category-pages #3181 (HTML landing), Toolbox #241 (ULTRA harness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the star-history SVG embed pattern to category ranking badges. README authors can embed a live 'Trending in ' SVG — every embed is free viral marketing. 32 categories × 1 badge route. Companion PRs: #3174 C-CAT, #3185 classify, Toolbox #241.