From 2f8fdb755b50b66314eb6506484e2e8b77b79882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gremaud?= Date: Fri, 16 Oct 2026 02:41:01 +0200 Subject: [PATCH] feat(games): show games in library mode also --- .../migrations/0011_game_library_image.py | 18 ++++++++ polylan_submitter/games/models.py | 2 + polylan_submitter/games/schemas.py | 9 ++++ polylan_submitter/src/Games.vue | 21 +++++++-- polylan_submitter/src/api/types.gen.ts | 4 ++ .../src/components/SteamLibraryCard.vue | 44 +++++++++++++++++++ polylan_submitter/src/locales/en.json | 3 +- 7 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 polylan_submitter/games/migrations/0011_game_library_image.py create mode 100644 polylan_submitter/src/components/SteamLibraryCard.vue diff --git a/polylan_submitter/games/migrations/0011_game_library_image.py b/polylan_submitter/games/migrations/0011_game_library_image.py new file mode 100644 index 0000000..09347e1 --- /dev/null +++ b/polylan_submitter/games/migrations/0011_game_library_image.py @@ -0,0 +1,18 @@ +# Generated by Django 6.0.5 on 2026-10-16 00:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("games", "0010_game_steam_store_info"), + ] + + operations = [ + migrations.AddField( + model_name="game", + name="library_image", + field=models.URLField(blank=True, default="", max_length=500), + ), + ] diff --git a/polylan_submitter/games/models.py b/polylan_submitter/games/models.py index 87d7358..7ef1d7b 100644 --- a/polylan_submitter/games/models.py +++ b/polylan_submitter/games/models.py @@ -15,6 +15,8 @@ class Game(models.Model): custom_path = models.BooleanField(default=False) image = models.URLField(null=True, blank=True) description = models.TextField(blank=True, default="") + # Vertical (600x900) cover for games/showcase, empty = Steam's library capsule + library_image = models.URLField(max_length=500, blank=True, default="") # Steam store info, refreshed in the background (see games.tasks). # Prices are in cents, in steam_currency. diff --git a/polylan_submitter/games/schemas.py b/polylan_submitter/games/schemas.py index ae3c2b0..e0a25ee 100644 --- a/polylan_submitter/games/schemas.py +++ b/polylan_submitter/games/schemas.py @@ -25,6 +25,7 @@ class SteamGameOut(Schema): steam_app_id: int store_url: str header_image: str + library_image: str short_description: str is_free: bool currency: str @@ -44,6 +45,14 @@ class SteamGameOut(Schema): or f"https://cdn.akamai.steamstatic.com/steam/apps/{obj.steam_app_id}/header.jpg" ) + @staticmethod + def resolve_library_image(obj) -> str: + # Vertical capsule, like in the Steam library + return ( + obj.library_image + or f"https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/{obj.steam_app_id}/library_600x900.jpg" + ) + @staticmethod def resolve_short_description(obj) -> str: return obj.steam_short_description diff --git a/polylan_submitter/src/Games.vue b/polylan_submitter/src/Games.vue index 57fd276..7def697 100644 --- a/polylan_submitter/src/Games.vue +++ b/polylan_submitter/src/Games.vue @@ -1,9 +1,10 @@ + + + + diff --git a/polylan_submitter/src/locales/en.json b/polylan_submitter/src/locales/en.json index f866715..903982d 100644 --- a/polylan_submitter/src/locales/en.json +++ b/polylan_submitter/src/locales/en.json @@ -76,7 +76,8 @@ "buy": "Buy {game}", "free": "Free to Play", "viewOnSteam": "View on Steam", - "play": "Play" + "play": "Play", + "showPrices": "Show prices" }, "clock": { "pageTitle": "Beat the Clock",