Skip to content

Commit 177d480

Browse files
authored
Fix Issue #2466 GamePage image is missing logo when available (#3245)
* Add logo support in GamePage and GamePicture In GamePage component, add logo variable and pass it to GamePicture component. In GamePicture component, add logo parameter; add logo element (same as the CachedImage logo element in GameCard) There was no need to add CSS, since there was already CSS for logo in GamePicture that positions it at the bottom center. * Rename 'logo' variables to 'art_logo' Purpose of this is to maintain naming consistency with other variables, such as 'art_cover' or other 'art_...' * Clean up unnecessary code * Update logo CSS to look like library's logo
1 parent 630e523 commit 177d480

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

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

+11-2
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ export default React.memo(function GamePage(): JSX.Element | null {
238238
art_square,
239239
art_cover,
240240
art_background,
241+
art_logo,
241242
install: { platform: installPlatform },
242243
is_installed
243244
} = gameInfo
@@ -332,7 +333,11 @@ export default React.memo(function GamePage(): JSX.Element | null {
332333
{/* OLD DESIGN */}
333334
{!experimentalFeatures.enableNewDesign && (
334335
<>
335-
<GamePicture art_square={art_square} store={runner} />
336+
<GamePicture
337+
art_square={art_square}
338+
art_logo={art_logo}
339+
store={runner}
340+
/>
336341
<NavLink
337342
className="backButton"
338343
to={backRoute}
@@ -401,7 +406,11 @@ export default React.memo(function GamePage(): JSX.Element | null {
401406
<DotsMenu gameInfo={gameInfo} handleUpdate={handleUpdate} />
402407
{!isBrowserGame && <SettingsButton gameInfo={gameInfo} />}
403408
<div className="mainInfo">
404-
<GamePicture art_square={art_cover} store={runner} />
409+
<GamePicture
410+
art_square={art_cover}
411+
art_logo={art_logo}
412+
store={runner}
413+
/>
405414
<div className="store-icon">
406415
<StoreLogos runner={runner} />
407416
</div>

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535

3636
.gamePicture > .gameLogo {
3737
position: absolute;
38-
bottom: 0;
39-
width: 70%;
40-
min-width: 140px;
38+
top: 50%;
39+
left: 50%;
40+
transform: translate(-50%, -50%);
41+
width: 50%;
4142
}

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ import fallbackImage from 'frontend/assets/heroic_card.jpg'
66

77
interface Props extends React.ImgHTMLAttributes<HTMLImageElement> {
88
art_square: string
9+
art_logo?: string | undefined
910
store: string
1011
}
1112

12-
function GamePicture({ art_square, store, className, ...props }: Props) {
13+
function GamePicture({
14+
art_square,
15+
art_logo,
16+
store,
17+
className,
18+
...props
19+
}: Props) {
1320
function getImageFormatting() {
1421
if (art_square === 'fallback' || !art_square)
1522
return { src: fallbackImage, fallback: fallbackImage }
@@ -34,6 +41,13 @@ function GamePicture({ art_square, store, className, ...props }: Props) {
3441
fallback={fallback}
3542
{...props}
3643
/>
44+
{art_logo && (
45+
<CachedImage
46+
alt="logo"
47+
src={`${art_logo}?h=400&resize=1&w=300`}
48+
className={`gameLogo`}
49+
/>
50+
)}
3751
</div>
3852
)
3953
}

0 commit comments

Comments
 (0)