fix(web): library badge shows the actual store, not always "Steam"

The GameCard badge hard-coded steam-vs-custom, so any non-Steam non-custom store
rendered with the "Steam" label. Add storeLabel(store): steam/custom keep their
localized strings, every other store is shown as a capitalized proper noun — so the
new Lutris/Heroic providers (and future ones) surface correctly with no per-store
translation. tsc --noEmit clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-26 07:22:28 +00:00
parent 5f8c6b6147
commit 203ad8069d
+17 -1
View File
@@ -19,6 +19,22 @@ function customId(entry: GameEntry): string {
: entry.id; : entry.id;
} }
/**
* Display label for a store badge. Steam and custom keep their localized strings; every other store
* (lutris, heroic, epic, …) is a proper noun shown capitalized, so new providers surface correctly
* without a translation per store.
*/
function storeLabel(store: string): string {
switch (store) {
case "custom":
return m.library_store_custom();
case "steam":
return m.library_store_steam();
default:
return store.charAt(0).toUpperCase() + store.slice(1);
}
}
interface FormState { interface FormState {
title: string; title: string;
portrait: string; portrait: string;
@@ -276,7 +292,7 @@ const GameCard: FC<GameCardProps> = ({ game, onEdit, onDelete, deleting }) => {
variant={isCustom ? "secondary" : "outline"} variant={isCustom ? "secondary" : "outline"}
className="bg-background/80 backdrop-blur" className="bg-background/80 backdrop-blur"
> >
{isCustom ? m.library_store_custom() : m.library_store_steam()} {storeLabel(game.store)}
</Badge> </Badge>
</div> </div>
{isCustom && ( {isCustom && (