Skip to content

Commit 39d7b76

Browse files
authored
fix game card fallback image (#1317)
1 parent d6cc159 commit 39d7b76

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hyperplay",
3-
"version": "0.29.0",
3+
"version": "0.29.1",
44
"private": true,
55
"main": "build/main/main.js",
66
"homepage": "./",

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ type Props = {
99
store: string
1010
}
1111

12-
function GamePicture({ art_square, store }: Props) {
13-
function getImageFormatting() {
14-
if (art_square === 'fallback' || !art_square)
15-
return { src: fallbackImage, fallback: fallbackImage }
16-
if (store === 'legendary') {
17-
return {
18-
src: `${art_square}?h=800&resize=1&w=600`,
19-
fallback: `${art_square}?h=400&resize=1&w=300`
20-
}
21-
} else {
22-
return { src: art_square, fallback: 'fallback' }
12+
export function getImageFormattingForArtSquare({ art_square, store }: Props) {
13+
if (art_square === 'fallback' || !art_square)
14+
return { src: fallbackImage, fallback: fallbackImage }
15+
if (store === 'legendary') {
16+
return {
17+
src: `${art_square}?h=800&resize=1&w=600`,
18+
fallback: `${art_square}?h=400&resize=1&w=300`
2319
}
20+
} else {
21+
return { src: art_square, fallback: 'fallback' }
2422
}
23+
}
2524

26-
const { src, fallback } = getImageFormatting()
25+
function GamePicture(props: Props) {
26+
const { src, fallback } = getImageFormattingForArtSquare(props)
2727

2828
return (
2929
<div className="gamePicture">

src/frontend/screens/Library/components/GameCard/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { useGetDownloadStatusText } from 'frontend/hooks/useGetDownloadStatusTex
2727
import libraryState from 'frontend/state/libraryState'
2828
import DMQueueState from 'frontend/state/DMQueueState'
2929
import authState from 'frontend/state/authState'
30+
import { getImageFormattingForArtSquare } from 'frontend/screens/Game/GamePicture'
3031

3132
interface Card {
3233
buttonClick: () => void
@@ -338,7 +339,12 @@ const GameCard = ({
338339
<HpGameCard
339340
key={appName}
340341
title={gameInfo.title}
341-
imageUrl={gameInfo.art_square}
342+
imageUrl={
343+
getImageFormattingForArtSquare({
344+
art_square: gameInfo.art_square,
345+
store: gameInfo.runner
346+
}).src
347+
}
342348
favorited={favorited}
343349
onFavoriteClick={handleClickStopBubbling(() => {
344350
if (!favorited) {

0 commit comments

Comments
 (0)