feat(badges): host premium badge artwork in R2

オープン
#1,954 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
HTML
スター
33
フォーク
107
平均マージ
14時間 6分
マージ済み PR(30日)
19

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

USRSE/usrse.github.io のほかの issue

USRSE/usrse.github.io の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。