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:
@@ -19,6 +19,22 @@ function customId(entry: GameEntry): string {
|
||||
: 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 {
|
||||
title: string;
|
||||
portrait: string;
|
||||
@@ -276,7 +292,7 @@ const GameCard: FC<GameCardProps> = ({ game, onEdit, onDelete, deleting }) => {
|
||||
variant={isCustom ? "secondary" : "outline"}
|
||||
className="bg-background/80 backdrop-blur"
|
||||
>
|
||||
{isCustom ? m.library_store_custom() : m.library_store_steam()}
|
||||
{storeLabel(game.store)}
|
||||
</Badge>
|
||||
</div>
|
||||
{isCustom && (
|
||||
|
||||
Reference in New Issue
Block a user