From 25c32dbe62ac0077ffa32959636cc7bcefc2f71e Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Sat, 15 Aug 2026 01:43:47 +0200 Subject: [PATCH] fix: derive the colophon's credits from the feed It still thanked only Game8 and hardcoded the studio list, so wiki.gg went uncredited and unmentioned in the disclaimer after being added as a source. Sources and studios are now read from the feed and the game registry, so adding either credits the right people automatically. A hardcoded credit goes stale the moment someone adds a source, and out of date is the one thing a credit must not be. Co-Authored-By: Claude Opus 5 (1M context) --- src/client/components/Colophon.tsx | 77 ++++++++++++++++++++++-------- src/shared/games.ts | 16 ++++--- 2 files changed, 65 insertions(+), 28 deletions(-) diff --git a/src/client/components/Colophon.tsx b/src/client/components/Colophon.tsx index b124da9..377943d 100644 --- a/src/client/components/Colophon.tsx +++ b/src/client/components/Colophon.tsx @@ -3,12 +3,28 @@ import type { SourceHealth } from "../../shared/feed.ts"; export const REPO_URL = "https://github.com/StereotypicalCat/gacha-event-tracker"; +/** Display name and homepage for a source host. */ +const SITES: Record = { + "game8.co": { name: "Game8", url: "https://game8.co" }, + "endfield.wiki.gg": { name: "wiki.gg", url: "https://wiki.gg" }, +}; + +function siteFor(url: string): { name: string; url: string } { + try { + const host = new URL(url).host; + return SITES[host] ?? { name: host, url: `https://${host}` }; + } catch { + return { name: url, url }; + } +} + /** * Credit, disclaimer, and where the code lives. * - * This sits at the foot of the page rather than behind an "About" link: the - * people whose work this depends on should be visible on the same screen as - * the data, not one navigation step away from it. + * Everything here is derived from the feed rather than written down, so adding + * a source or a game credits the right people automatically. A hardcoded list + * silently goes stale the moment someone adds the seventh source, and the one + * thing a credit must not be is out of date. */ export function Colophon({ sources, @@ -17,7 +33,15 @@ export function Colophon({ sources: SourceHealth[]; staleCount: number; }) { - const games = [...new Set(sources.map((s) => s.game))]; + const games = [...new Set(sources.map((s) => s.game))].map(gameMeta); + const studios = [...new Set(games.map((g) => g.studio))]; + + const sites = [...new Map(sources.map((s) => { + const site = siteFor(s.url); + return [site.name, site] as const; + })).values()]; + + const named = [...sites.map((s) => s.name), ...studios]; return (