Skip to content

Commit 440b2cd

Browse files
committed
ui: add fallback images for Steam game art
1 parent 3ce9513 commit 440b2cd

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/backend/storeManagers/steam/library.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,21 @@ export async function refresh(): Promise<null> {
130130
continue
131131
}
132132

133+
let artSquare = `${steamDBBaseURL}/${steamGame.appid}/library_600x900.jpg`
134+
let artCover = `${steamDBBaseURL}/${steamGame.appid}/header.jpg`
135+
136+
try {
137+
await axios.head(artSquare)
138+
} catch (e) {
139+
artSquare = 'fallback'
140+
artCover = 'fallback'
141+
}
142+
133143
const newGameObject: GameInfo = {
134144
app_name: steamGame.appid.toString(),
135145
runner: 'steam',
136-
art_square: `${steamDBBaseURL}/${steamGame.appid}/library_600x900.jpg`,
137-
art_cover: `${steamDBBaseURL}/${steamGame.appid}/header.jpg`,
146+
art_square: artSquare,
147+
art_cover: artCover,
138148
canRunOffline: false,
139149
title: steamGame.name,
140150
is_installed: false,
258 KB
Loading

src/frontend/screens/Game/GamePicture/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ import { CachedImage } from 'frontend/components/UI'
33

44
import './index.css'
55
import fallbackImage from 'frontend/assets/fallback_card.jpg'
6+
import steamFallBackImage from 'frontend/assets/steam-fallback-card.png'
67

78
type Props = {
89
art_square: string
910
store: string
1011
}
1112

1213
export function getImageFormattingForArtSquare({ art_square, store }: Props) {
14+
const isSteam = store === 'steam'
1315
if (art_square === 'fallback' || !art_square)
14-
return { src: fallbackImage, fallback: fallbackImage }
16+
return {
17+
src: isSteam ? steamFallBackImage : fallbackImage,
18+
fallback: fallbackImage
19+
}
1520
if (store === 'legendary') {
1621
return {
1722
src: `${art_square}?h=800&resize=1&w=600`,

0 commit comments

Comments
 (0)