feat(badges): host premium badge artwork in R2

Aperta
#1,954 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript

Direzione di ricerca

Start with packages/api/wrangler.jsonc and compare the existing PROFILE_PHOTOS binding, then read packages/api/src/lib/storage.ts for the photo URL-import pattern. Next inspect HexStamp.tsx and the BadgeItem renderer path. Done means the opt-in artwork URL path, framed loading and error fallback, and R2 configuration are covered without changing existing inline glyph behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

When premium badges (Lifetime Achievement, named awards, decade-anniversary commemoratives, year-stamped conference attendee marks) need elaborate illustration rather than a geometric glyph, host the artwork in R2 instead of bundling it. Keeps the bundle light and lets new artwork ship without a deploy.

Requirements

  • Add a `badge-artwork` R2 prefix (or a dedicated bucket) alongside the existing `PROFILE_PHOTOS` binding in `wrangler.jsonc`.
  • Convention: artwork keyed by `{tier}/{slug}.svg` (or `.webp` for raster). Public-readable via the bucket's `r2.dev` URL or a `BADGE_ARTWORK_PUBLIC_URL` var, mirroring the photos pattern.
  • Optional `artworkUrl` field on the badge payload — when present, the renderer prefers it over the inline glyph; when absent, falls back to the existing `HexStamp` glyph for that kind.
  • Badge component renders the artwork with the same hex frame + accent ring so the visual system stays cohesive whether artwork is bundled or fetched.
  • Loading state: skeleton hex (matching the accent) while the artwork loads, fallback to inline glyph on fetch error.
  • No artwork required for any badge in Phase 1 or Phase 2 — this is a Phase 3 prerequisite for the named-award badges and a prep step for any future commemoratives.

Context

Current visual system (`HexStamp.tsx`) draws geometric primitives inline as SVG paths. Total weight is a few KB and the inline approach lets us color glyphs via the accent palette using `currentColor`. Moving the existing glyphs to R2 would increase complexity (loading states, network round-trips) without meaningful bundle savings.

R2 is the right call only when artwork is large enough to matter (50–500 KB illustrations), photographic, animated, or year-stamped per-conference. Treat it as an opt-in path for prestige badges, not a wholesale migration.

Implementation Notes

  • `R2Bucket` binding in `packages/api/wrangler.jsonc` follows the `PROFILE_PHOTOS` precedent. Add `BADGE_ARTWORK` and `BADGE_ARTWORK_PUBLIC_URL`.
  • Upload pipeline can mirror the photo URL-import path in `packages/api/src/lib/storage.ts` once admin tooling exists. For now, a one-off bash script to upload commissioned artwork is fine.
  • `BadgeItem` shape gains an optional `artworkUrl: string | null`. The renderer's hex-frame component checks it first, then falls back to the per-kind glyph.
  • Cache headers: long max-age + content-hash in the filename so updates invalidate cleanly.
Lingua principale
HTML
Stelle
33
Fork
107
Merge medio
14h 6m
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di USRSE/usrse.github.io

Tutte le issue di USRSE/usrse.github.io

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.