Skip to content

Fix Issue #2466 GamePage image is missing logo when available #3245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/frontend/screens/Game/GamePage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export default React.memo(function GamePage(): JSX.Element | null {
art_square,
art_cover,
art_background,
art_logo,
install: { platform: installPlatform },
is_installed
} = gameInfo
Expand Down Expand Up @@ -325,7 +326,11 @@ export default React.memo(function GamePage(): JSX.Element | null {
{/* OLD DESIGN */}
{!experimentalFeatures.enableNewDesign && (
<>
<GamePicture art_square={art_square} store={runner} />
<GamePicture
art_square={art_square}
art_logo={art_logo}
store={runner}
/>
<NavLink
className="backButton"
to={backRoute}
Expand Down Expand Up @@ -394,7 +399,11 @@ export default React.memo(function GamePage(): JSX.Element | null {
<DotsMenu gameInfo={gameInfo} handleUpdate={handleUpdate} />
{!isBrowserGame && <SettingsButton gameInfo={gameInfo} />}
<div className="mainInfo">
<GamePicture art_square={art_cover} store={runner} />
<GamePicture
art_square={art_cover}
art_logo={art_logo}
store={runner}
/>
<div className="store-icon">
<StoreLogos runner={runner} />
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/frontend/screens/Game/GamePicture/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

.gamePicture > .gameLogo {
position: absolute;
bottom: 0;
width: 70%;
min-width: 140px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
}
16 changes: 15 additions & 1 deletion src/frontend/screens/Game/GamePicture/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ import fallbackImage from 'frontend/assets/heroic_card.jpg'

interface Props extends React.ImgHTMLAttributes<HTMLImageElement> {
art_square: string
art_logo?: string | undefined
store: string
}

function GamePicture({ art_square, store, className, ...props }: Props) {
function GamePicture({
art_square,
art_logo,
store,
className,
...props
}: Props) {
function getImageFormatting() {
if (art_square === 'fallback' || !art_square)
return { src: fallbackImage, fallback: fallbackImage }
Expand All @@ -34,6 +41,13 @@ function GamePicture({ art_square, store, className, ...props }: Props) {
fallback={fallback}
{...props}
/>
{art_logo && (
<CachedImage
alt="logo"
src={`${art_logo}?h=400&resize=1&w=300`}
className={`gameLogo`}
/>
)}
</div>
)
}
Expand Down