From cbbbc3effaf6a5a8ba17af5776619e2b943d017e Mon Sep 17 00:00:00 2001 From: fristyxd Date: Fri, 11 Sep 2026 06:21:54 +0300 Subject: [PATCH] Game profile: IGDB platforms, IGDB link, sparse-profile fix - Source platforms from IGDB first, fall back to Steam and detectables only when IGDB has none - Add IGDB page button next to Steam, SteamDB, Discord and ITAD - Hide the details box when a profile has no details instead of rendering it empty - ITAD lookup matches titles ignoring punctuation and marks --- components/game-profile-modal.tsx | 10 ++++++++ lib/game-profile.ts | 38 ++++++++++++++++++------------- lib/i18n/dictionaries/de.json | 1 + lib/i18n/dictionaries/en.json | 1 + lib/i18n/dictionaries/tr.json | 1 + 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/components/game-profile-modal.tsx b/components/game-profile-modal.tsx index defd306..c508b2e 100644 --- a/components/game-profile-modal.tsx +++ b/components/game-profile-modal.tsx @@ -322,6 +322,16 @@ export function GameProfileModal({ {dict.openOnSteamDb} ↗ ) : null} + {profile?.igdbUrl ? ( + + {dict.openOnIgdb} ↗ + + ) : null} ; summary?: string; storyline?: string; @@ -275,7 +277,7 @@ async function igdbQuery(token: string, endpoint: string, body: string): Prom } const IGDB_GAME_FIELDS = - "name,genres.name,summary,storyline,cover.url,artworks.url,screenshots.url," + + "name,slug,genres.name,summary,storyline,cover.url,artworks.url,screenshots.url," + "websites.url,websites.category,involved_companies.developer," + "involved_companies.publisher,involved_companies.company.name," + "platforms.abbreviation,platforms.name,first_release_date;"; @@ -491,29 +493,32 @@ export async function getGameProfile( : (steam?.publishers ?? (itadInfo?.publishers?.map((d) => d.name).filter((n): n is string => !!n) || [])); - const platforms = new Set(); + const igdbPlatforms = new Set(); for (const p of igdb?.platforms ?? []) { const label = `${p.abbreviation ?? ""} ${p.name ?? ""}`.toUpperCase(); if (/PS|PLAYSTATION/.test(label)) { - platforms.add("PlayStation"); + igdbPlatforms.add("PlayStation"); } else if (/XBOX|XONE|XSX/.test(label)) { - platforms.add("Xbox"); + igdbPlatforms.add("Xbox"); } else if (/PC|WIN|MAC|LIN/.test(label)) { - platforms.add("PC"); + igdbPlatforms.add("PC"); } else if (/SWITCH/.test(label)) { - platforms.add("Switch"); + igdbPlatforms.add("Switch"); } } - if ( - steam?.platforms && - (steam.platforms.windows || steam.platforms.mac || steam.platforms.linux) - ) { - platforms.add("PC"); - } - for (const sku of entry?.third_party_skus ?? []) { - const mapped = DISTRIBUTOR_PLATFORM[sku.distributor]; - if (mapped) { - platforms.add(mapped); + const platforms = new Set(igdbPlatforms); + if (platforms.size === 0) { + if ( + steam?.platforms && + (steam.platforms.windows || steam.platforms.mac || steam.platforms.linux) + ) { + platforms.add("PC"); + } + for (const sku of entry?.third_party_skus ?? []) { + const mapped = DISTRIBUTOR_PLATFORM[sku.distributor]; + if (mapped) { + platforms.add(mapped); + } } } @@ -588,6 +593,7 @@ export async function getGameProfile( screenshots, steamId, steamUrl: steamId ? `https://store.steampowered.com/app/${steamId}/` : null, + igdbUrl: igdb?.slug ? `https://www.igdb.com/games/${igdb.slug}` : null, steamReviews, itad: process.env.ITAD_API_KEY && (itadInfo || priceEntry) diff --git a/lib/i18n/dictionaries/de.json b/lib/i18n/dictionaries/de.json index 83821df..9043fd5 100644 --- a/lib/i18n/dictionaries/de.json +++ b/lib/i18n/dictionaries/de.json @@ -43,6 +43,7 @@ "openOnDiscord": "Discord-Profil", "openOnSteam": "Steam", "openOnSteamDb": "SteamDB", + "openOnIgdb": "IGDB", "loading": "Spieldaten werden geladen...", "loadError": "Spieldaten konnten nicht geladen werden.", "screenshots": "Screenshots", diff --git a/lib/i18n/dictionaries/en.json b/lib/i18n/dictionaries/en.json index 7ecd278..10151ae 100644 --- a/lib/i18n/dictionaries/en.json +++ b/lib/i18n/dictionaries/en.json @@ -43,6 +43,7 @@ "openOnDiscord": "Discord Profile", "openOnSteam": "Steam", "openOnSteamDb": "SteamDB", + "openOnIgdb": "IGDB", "loading": "Loading game info...", "loadError": "Couldn't load game info.", "screenshots": "Screenshots", diff --git a/lib/i18n/dictionaries/tr.json b/lib/i18n/dictionaries/tr.json index a38c23a..8fc1e28 100644 --- a/lib/i18n/dictionaries/tr.json +++ b/lib/i18n/dictionaries/tr.json @@ -43,6 +43,7 @@ "openOnDiscord": "Discord Profili", "openOnSteam": "Steam", "openOnSteamDb": "SteamDB", + "openOnIgdb": "IGDB", "loading": "Oyun bilgileri yükleniyor...", "loadError": "Oyun bilgileri yüklenemedi.", "screenshots": "Görseller",