Skip to content

Fix card artwork everywhere, constant PayPal link, v1.7.1 and the Top 100 page - #24

Merged
DLinacre merged 6 commits into
mainfrom
arena/56a343dd-pokeguru
Nov 14, 2026
Merged

DLinacre merged 6 commits into
mainfrom
arena/56a343dd-pokeguru

Conversation

@DLinacre

Copy link
Copy Markdown
Owner

What this fixes

1. Card artwork (all surfaces, including the booster simulator)

Root cause. Three separate problems were stacking up:

  1. URL construction was duplicated and wrong. packPools.ts appended /low.webp to a TCGdex asset base that can already carry an extension (…/016.webp), producing …/016.webp/low.webp. Each component also had its own fallback chain — some had none at all (PackCard), so a package reveal had a single, un-retried <img>.
  2. Missing artwork was treated as a broken image. The TCGdex search API legitimately omits image for some cards (confirmed: tk-sm-r-22 returns {"id":"tk-sm-r-22","localId":"22","name":"Drowzee"} with no image key). Those cards produced imageBase === undefined and rendered “Image unavailable” everywhere, including the “More cards” grid.
  3. The service worker was in the artwork path. It cached opaque/error image responses into a 250-entry cache shared with JSON, and on a miss/failure could answer an <img> request with a 503 application/json body — which the browser renders as a broken image. That is why artwork broke for users whose cache had filled rather than failing from the start.

Fix.

  • src/services/cardImages.ts — the single resolver. Normalises any shape (…/016, …/016.webp, …/016/low.webp) to one asset base, refuses to invent a URL for artwork the provider never published, and returns ordered derivatives (low.webp → low.png → high.webp → high.png, reversed for full-size art).
  • src/components/Cards/CardArtwork.tsx — the single artwork component, used by the grid, card page, preview modal, vault, scanner results, header suggestions and the booster simulator. It walks the derivative chain, retries on a different format, resets on card change, and distinguishes “No artwork” (provider published none) from “Artwork unavailable” (load failed, with a retry). A bare broken <img> can no longer appear.
  • The simulator now stores the asset base instead of a hand-built URL (old saved pulls still resolve through the resolver).
  • The service worker no longer intercepts assets.tcgdex.net or any image request, and only caches complete basic responses; quota errors are swallowed. Bumping the version invalidates the poisoned caches.

2. Buy Me a Pack

Always https://paypal.me/dlinacre16, new tab, rel="noopener noreferrer", identical in header/footer/About. VITE_BUY_ME_A_PACK_URL and the “not configured” state are gone.

3. Version

package.json 1.7.0 → 1.7.1 (+ lockfile), injected as __APP_VERSION__ and shown in the footer and About page. One source of truth, no invented build numbers.

4. Top 100 (/top-100)

Ranked by Cardmarket trend, one printing per card, GBP with the EUR source figure, marketplace update date and FX rate date. Cardmarket has no public leaderboard and the search API carries no prices, so the page builds a bounded, cached, resumable price index from the rarities that hold expensive raw cards — it never pads the list, never estimates a value, and always shows how much of the candidate pool has been priced. Filters (name/set/number, rarity, era) and four sorts. Linked from the desktop nav, mobile nav and footer.

Verification (live, on the deployment of this branch)

  • sw.js serves the new worker (isMediaRequest, media bypass) — cache invalidation is live.
  • Card page sv06.5-016: hero art loads; “More Drowzee cards” now shows real art for ex6-32, xy3-35, me06-043, base1-49, xy12-49, and “No artwork” for tk-sm-r-22 (the card with no image field).
  • Search grid in a real browser: tile <img src="https://assets.tcgdex.net/en/xy/xy12/49/low.webp" width="245"> (previously 0×0).
  • /top-100: row 1 = “Mega Charizard X ex — Phantasmal Flames #125 · Special illustration rare · Holofoil · 13 Nov 2026 · £472.97 / €566.04”.
  • Footer: PokeGuru v1.7.1; nav: Search Sets Packs Top 100 Wiki Vault Scan; About: Buy me a pack → https://paypal.me/dlinacre16.

Tests

191 passing (npm test), plus npm run typecheck, npm run lint, npm run build. New coverage: image resolver (extension normalisation, junk rejection, ordering, dedupe), CardArtwork states (fall-through, retry, no-artwork vs failure, card change), booster reveal artwork, top-100 service (ranking, storage, coverage, discovery) and the /top-100 route + nav link.

DLinacre and others added 6 commits November 14, 2026 18:36
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
…ching artwork

- add src/services/cardImages.ts as the single resolver: normalises TCGdex
  asset bases (strips a duplicate extension/quality suffix), rejects
  non-TCGdex URLs instead of inventing them, and returns ordered
  derivatives (low.webp -> low.png -> high.webp -> high.png, reversed for
  full-size art)
- add CardArtwork: one component for every image surface, walks the
  derivative chain, distinguishes 'no artwork published' from 'failed to
  load' (with retry) and never renders a bare broken image
- wire it into CardTile, PackCard (booster simulator), PullSummary,
  CardPreviewModal, CardDetailPage, CollectionPage, ScannerPage and the
  header suggestions
- packPools no longer appends /low.webp itself (that produced
  .../016.webp/low.webp); saved pulls keep working through the resolver
- service worker: artwork is never intercepted, and only complete basic
  responses are cached, so an opaque/error response can no longer be
  replayed to an <img>
- remove the temporary diagnostic page
- Buy Me a Pack now always links to https://paypal.me/dlinacre16
- version 1.7.1

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
- /top-100 ranks cards by Cardmarket trend, one printing per card, GBP with
  the EUR source figure, marketplace + FX dates, coverage/progress reporting
  and an honest empty state; filters (name/set, rarity, era) and four sorts
- the price index is built from a bounded, resumable, cached candidate pool
  (the rarities that hold expensive raw cards) rather than fetching the whole
  catalogue on every visit, and it never pads the list or invents a value
- nav (desktop + mobile) and footer entry points
- version from package.json shown in the footer and About page via
  __APP_VERSION__ (single source of truth)
- README/RELEASE_NOTES document the artwork resolver, the worker change, the
  Top 100 method and the constant PayPal link
- tests: cardImages resolver, CardArtwork states, pack reveal artwork, top-100
  service, top-100 route + nav link (190 tests)

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Rows appear as cards are priced (every 25) instead of only when the pass
finishes, so a first visit shows results immediately.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Discovery ran one rarity page at a time (~30 sequential requests before any
row could appear). It now runs four at a time and reassembles them in rarity
order, so a first visit reaches the ranking much sooner. Adds a discovery test.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Twenty-five consecutive detail failures abort the pass, keep everything priced
so far and tell the user, instead of spending the whole budget on errors.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@DLinacre
DLinacre merged commit b15c3f4 into main Nov 14, 2026
2 checks passed
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