IGDB auto-enrichment: Server-Start + Frontend auto-trigger
- Server enriched bestehende User beim Plugin-Start automatisch (fire-and-forget) - Frontend triggert IGDB-Enrichment automatisch beim Öffnen einer User-Bibliothek - Reduzierte Log-Ausgabe (kein Spam pro Cache-Hit mehr) - IGDB-Button zeigt Lade-Animation während Enrichment Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
916006e815
commit
4994d5c245
4 changed files with 68 additions and 6 deletions
|
|
@ -145,7 +145,23 @@ export default function GameLibraryTab({ data }: { data: any }) {
|
|||
const resp = await fetch(`/api/game-library/user/${steamId}`);
|
||||
if (resp.ok) {
|
||||
const d = await resp.json();
|
||||
setUserGames(d.games || d);
|
||||
const games: SteamGame[] = d.games || d;
|
||||
setUserGames(games);
|
||||
|
||||
// Auto-enrich with IGDB if many games lack data
|
||||
const unenriched = games.filter(g => !g.igdb).length;
|
||||
if (unenriched > 0) {
|
||||
setEnriching(steamId);
|
||||
fetch(`/api/game-library/igdb/enrich/${steamId}`)
|
||||
.then(r => r.ok ? r.json() : null)
|
||||
.then(() => fetch(`/api/game-library/user/${steamId}`))
|
||||
.then(r => r.ok ? r.json() : null)
|
||||
.then(d2 => {
|
||||
if (d2) setUserGames(d2.games || d2);
|
||||
})
|
||||
.catch(() => {})
|
||||
.finally(() => setEnriching(null));
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
/* silent */
|
||||
|
|
@ -439,10 +455,10 @@ export default function GameLibraryTab({ data }: { data: any }) {
|
|||
↻
|
||||
</button>
|
||||
<button
|
||||
className="gl-enrich-btn"
|
||||
className={`gl-enrich-btn ${enriching === selectedUser ? 'enriching' : ''}`}
|
||||
onClick={() => enrichUser(selectedUser!)}
|
||||
disabled={enriching === selectedUser}
|
||||
title="Mit IGDB-Daten anreichern"
|
||||
title={enriching === selectedUser ? 'IGDB-Daten werden geladen...' : 'Mit IGDB-Daten anreichern (erneut)'}
|
||||
>
|
||||
{enriching === selectedUser ? '\u23F3' : '\uD83C\uDF10'} IGDB
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue