Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

[UI] game page redesign (#6172)

Bili Silva26b0272caf15
diff --git a/public/locales/en/gamepage.json b/public/locales/en/gamepage.json
index e0ef87ae3..bfb62e743 100644
--- a/public/locales/en/gamepage.json
+++ b/public/locales/en/gamepage.json
@@ -142,6 +142,7 @@
"game": {
"about": "About",
"achievements": "Achievements",
+ "backgroundAlt": "{{title}} artwork",
"branch": {
"disabled": "Disabled",
"password": "Set private channel password",
@@ -154,22 +155,28 @@
"version": "Version"
},
"changelogFor": "Changelog for {{gameTitle}}",
- "details": "Game details",
+ "coverAlt": "{{title}} cover art",
+ "detailsSection": "Details",
"dlcs": "DLC's",
"downloadSize": "Download Size",
"extra_info": "Extra",
"firstPlayed": "First played",
"getting-download-size": "Getting download size",
"getting-install-size": "Getting install size",
+ "heroicLogoAlt": "Heroic Games Launcher logo",
"hoursPlayedShort": "{{hours}} hours",
- "install_info": "Installation info",
+ "info": "Info",
+ "installation": "Installation",
"installSize": "Install Size",
"language": "Language",
"lastPlayed": "Last played",
+ "logoAlt": "{{title}} logo",
"modify": "Modify installation",
"neverPlayed": "Never",
"platform": "Select Platform Version to Install",
"requirements": "System requirements",
+ "screenshotAlt": "{{title}} screenshot {{index}}",
+ "screenshots": "Screenshots",
"tabs": "Game information",
"totalPlayed": "Time played"
},
@@ -210,6 +217,7 @@
"installedPlatform": "Installed platform",
"path": "Install Path",
"protondb-compatibility-info": "Proton Compatibility Tier",
+ "scoreNotAvailable": "Not available",
"size": "Size",
"steamdeck": {
"playable": "Playable",
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index 4a9f85a95..99fc866fa 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -248,6 +248,14 @@
"close": "Close",
"continue": "Continue"
},
+ "carousel": {
+ "pause": "Pause slideshow",
+ "play": "Play slideshow",
+ "position": "{{index}} of {{total}}",
+ "roleDescription": "carousel",
+ "show": "Show image {{index}}",
+ "slide": "slide"
+ },
"categories-manager": {
"add": "Add",
"add-placeholder": "Add new category",
diff --git a/src/backend/storeManagers/gog/games.ts b/src/backend/storeManagers/gog/games.ts
index c77f67d25..be34cf890 100644
--- a/src/backend/storeManagers/gog/games.ts
+++ b/src/backend/storeManagers/gog/games.ts
@@ -78,6 +78,7 @@ import { t } from 'i18next'
import { dialog } from 'electron'
import { showDialogBoxModalAuto } from '../../dialog/dialog'
import { sendFrontendMessage } from '../../ipc'
+import { getGogScreenshots } from '../storeManagerCommon/screenshots'
import { Game, RemoveArgs } from 'common/types/game_manager'
import {
getWineFlagsArray,
@@ -170,7 +171,8 @@ export default class GOGGame implements Game {
reqs,
releaseDate,
storeUrl: gogStoreUrl,
- changelog: productInfo?.data.changelog
+ changelog: productInfo?.data.changelog,
+ screenshots: getGogScreenshots(gamesData)
}
return extra
}
diff --git a/src/backend/storeManagers/legendary/games.ts b/src/backend/storeManagers/legendary/games.ts
index 79a6fc80d..991630bd8 100644
--- a/src/backend/storeManagers/legendary/games.ts
+++ b/src/backend/storeManagers/legendary/games.ts
@@ -75,6 +75,7 @@ import { mkdirSync } from 'fs'
import { configStore } from 'backend/constants/key_value_stores'
import { epicRedistPath, legendaryInstalled } from './constants'
import { formatEpicTags } from './tags'
+import { getEpicScreenshots } from '../storeManagerCommon/screenshots'
import { isCLINoGui, isMac, isWindows } from 'backend/constants/environment'
import { fakeEpicExePath } from 'backend/constants/paths'
@@ -192,7 +193,8 @@ export default class LegendaryGame implements Game {
reqs: about.data.requirements.systems[0].details,
releaseDate: about.data.meta.releaseDate?.substring(0, 19),
genres: formatEpicTags(about.data.meta?.tags),
- storeUrl: `https://www.epicgames.com/store/product/${slug}`
+ storeUrl: `https://www.epicgames.com/store/product/${slug}`,
+ screenshots: getEpicScreenshots(about.data.carousel)
}
} else {
return null
diff --git a/src/backend/storeManagers/nile/games.ts b/src/backend/storeManagers/nile/games.ts
index 347f0b70c..34d7b165b 100644
--- a/src/backend/storeManagers/nile/games.ts
+++ b/src/backend/storeManagers/nile/games.ts
@@ -104,7 +104,8 @@ export default class NileGameManager implements Game {
}
: undefined,
releaseDate: info?.extra?.releaseDate,
- genres: info?.extra?.genres
+ genres: info?.extra?.genres,
+ screenshots: info?.extra?.screenshots
}
}
diff --git a/src/backend/storeManagers/nile/library.ts b/src/backend/storeManagers/nile/library.ts
index 566ed2b82..3152de74e 100644
--- a/src/backend/storeManagers/nile/library.ts
+++ b/src/backend/storeManagers/nile/library.ts
@@ -35,6 +35,7 @@ import type {
RunnerBackupPaths
} from 'common/types/game_manager'
import { BACKUP_PATHS } from 'backend/importExport/constants'
+import { getUrlScreenshots } from '../storeManagerCommon/screenshots'
export default class NileLibraryManager implements LibraryManager {
private installedGames: Map<string, NileInstallMetadataInfo> = new Map()
@@ -90,7 +91,8 @@ export default class NileLibraryManager implements LibraryManager {
releaseDate,
backgroundUrl1,
backgroundUrl2,
- logoUrl
+ logoUrl,
+ screenshots
},
iconUrl
} = productDetail
@@ -125,7 +127,8 @@ export default class NileLibraryManager implements LibraryManager {
extra: {
reqs: [],
genres,
- releaseDate
+ releaseDate,
+ screenshots: getUrlScreenshots(screenshots)
},
is_linux_native: false,
is_mac_native: false
diff --git a/src/backend/storeManagers/steam/games.ts b/src/backend/storeManagers/steam/games.ts
index 8b6196aeb..703e19c5e 100644
--- a/src/backend/storeManagers/steam/games.ts
+++ b/src/backend/storeManagers/steam/games.ts
@@ -66,6 +66,7 @@ import {
steamRunningMessage
} from './utils'
import { buildReqs, stripSteamMarkup, toInstallPlatforms } from './store_info'
+import { fetchSteamScreenshots } from './store_screenshots'
import {
installLanguageArgs,
isSteamLanguageName,
@@ -351,10 +352,13 @@ export default class SteamGame implements Game {
return steamCall(
async () => {
- const [details] = await fetchAureliaInfo([this.id], {
- extended: true,
- language: steamLang
- })
+ const [[details], screenshots] = await Promise.all([
+ fetchAureliaInfo([this.id], {
+ extended: true,
+ language: steamLang
+ }),
+ fetchSteamScreenshots(this.id)
+ ])
if (!details) {
return empty
}
@@ -386,7 +390,8 @@ export default class SteamGame implements Game {
typeof ext.metacritic === 'number'
? String(ext.metacritic)
: undefined,
- platforms: toInstallPlatforms(details.platforms)
+ platforms: toInstallPlatforms(details.platforms),
+ screenshots
}
extraInfoStore.set(cacheKey, extraInfo)
diff --git a/src/backend/storeManagers/steam/store_screenshots.ts b/src/backend/storeManagers/steam/store_screenshots.ts
new file mode 100644
index 000000000..99b59c1bc
--- /dev/null
+++ b/src/backend/storeManagers/steam/store_screenshots.ts
@@ -0,0 +1,31 @@
+import type { GameScreenshot } from 'common/types'
+import { logWarning, LogPrefix } from 'backend/logger'
+import { axiosClient } from 'backend/utils'
+import { getSteamScreenshots } from '../storeManagerCommon/screenshots'
+
+const STEAM_APP_ID = /^\d+$/
+
+type AppDetailsResponse = Record<
+ string,
+ { data?: { screenshots?: unknown } } | undefined
+>
+
+export async function fetchSteamScreenshots(
+ appId: string
+): Promise<GameScreenshot[]> {
+ if (!STEAM_APP_ID.test(appId)) return []
+
+ try {
+ const { data } = await axiosClient.get<AppDetailsResponse | null>(
+ 'https://store.steampowered.com/api/appdetails',
+ { params: { appids: appId, filters: 'screenshots' } }
+ )
+ return getSteamScreenshots(data?.[appId]?.data?.screenshots)
+ } catch (error) {
+ logWarning(
+ ['Unable to get Steam screenshots for', appId, error],
+ LogPrefix.Steam
+ )
+ return []
+ }
+}
diff --git a/src/backend/storeManagers/storeManagerCommon/__tests__/screenshots.test.ts b/src/backend/storeManagers/storeManagerCommon/__tests__/screenshots.test.ts
new file mode 100644
index 000000000..cd6d06d90
--- /dev/null
+++ b/src/backend/storeManagers/storeManagerCommon/__tests__/screenshots.test.ts
@@ -0,0 +1,147 @@
+import {
+ MAX_SCREENSHOTS,
+ buildScreenshots,
+ getEpicScreenshots,
+ getGogScreenshots,
+ getSteamScreenshots,
+ getUrlScreenshots,
+ isSafeImageUrl
+} from '../screenshots'
+
+describe('isSafeImageUrl', () => {
+ it('accepts https URLs only', () => {
+ expect(isSafeImageUrl('https://cdn.example.com/a.jpg')).toBe(true)
+ expect(isSafeImageUrl('http://cdn.example.com/a.jpg')).toBe(false)
+ expect(isSafeImageUrl('file:///etc/passwd')).toBe(false)
+ expect(isSafeImageUrl('javascript:alert(1)')).toBe(false)
+ expect(isSafeImageUrl('not a url')).toBe(false)
+ expect(isSafeImageUrl(undefined)).toBe(false)
+ expect(isSafeImageUrl(42)).toBe(false)
+ })
+})
+
+describe('buildScreenshots', () => {
+ it('drops unsafe and duplicated entries and keeps safe thumbnails', () => {
+ expect(
+ buildScreenshots([
+ { full: 'https://a/1.jpg', thumbnail: 'https://a/1-small.jpg' },
+ { full: 'https://a/1.jpg' },
+ { full: 'file:///secret.jpg' },
+ { full: 'https://a/2.jpg', thumbnail: 'javascript:alert(1)' }
+ ])
+ ).toEqual([
+ { full: 'https://a/1.jpg', thumbnail: 'https://a/1-small.jpg' },
+ { full: 'https://a/2.jpg' }
+ ])
+ })
+
+ it(`keeps at most ${MAX_SCREENSHOTS} screenshots`, () => {
+ const candidates = Array.from({ length: 30 }, (_, index) => ({
+ full: `https://a/${index}.jpg`
+ }))
+ expect(buildScreenshots(candidates)).toHaveLength(MAX_SCREENSHOTS)
+ })
+})
+
+describe('getGogScreenshots', () => {
+ it('fills the formatter template with full and thumbnail sizes', () => {
+ const gamesData = {
+ _embedded: {
+ screenshots: [
+ {
+ _links: {
+ self: {
+ href: 'https://images.gog-statics.com/abc_{formatter}.jpg'
+ }
+ }
+ },
+ { _links: { self: { href: 'https://images.gog-statics.com/x.jpg' } } }
+ ]
+ }
+ }
+
+ expect(getGogScreenshots(gamesData)).toEqual([
+ {
+ full: 'https://images.gog-statics.com/abc_1600.jpg',
+ thumbnail:
+ 'https://images.gog-statics.com/abc_product_card_screenshot_748.jpg'
+ }
+ ])
+ })
+
+ it('returns an empty list for missing or malformed data', () => {
+ expect(getGogScreenshots(null)).toEqual([])
+ expect(getGogScreenshots({ _embedded: { screenshots: 'oops' } })).toEqual(
+ []
+ )
+ })
+})
+
+describe('getEpicScreenshots', () => {
+ it('prefers still images over trailer thumbnails', () => {
+ const carousel = {
+ items: [
+ { image: {}, video: { recipes: '{}' } },
+ {
+ image: { src: 'https://cdn2.unrealengine.com/trailer.jpg' },
+ video: { recipes: '{}' }
+ },
+ { image: { src: 'https://cdn2.unrealengine.com/still.jpg' } }
+ ]
+ }
+
+ expect(getEpicScreenshots(carousel)).toEqual([
+ { full: 'https://cdn2.unrealengine.com/still.jpg' }
+ ])
+ })
+
+ it('falls back to trailer thumbnails when there are no stills', () => {
+ const carousel = {
+ items: [
+ {
+ image: { src: 'https://cdn2.unrealengine.com/trailer.jpg' },
+ video: { recipes: '{}' }
+ }
+ ]
+ }
+
+ expect(getEpicScreenshots(carousel)).toEqual([
+ { full: 'https://cdn2.unrealengine.com/trailer.jpg' }
+ ])
+ })
+
+ it('returns an empty list without a carousel', () => {
+ expect(getEpicScreenshots(undefined)).toEqual([])
+ })
+})
+
+describe('getSteamScreenshots', () => {
+ it('maps full and thumbnail paths', () => {
+ expect(
+ getSteamScreenshots([
+ {
+ id: 0,
+ path_thumbnail: 'https://shared.steamstatic.com/ss.600x338.jpg',
+ path_full: 'https://shared.steamstatic.com/ss.1920x1080.jpg'
+ }
+ ])
+ ).toEqual([
+ {
+ full: 'https://shared.steamstatic.com/ss.1920x1080.jpg',
+ thumbnail: 'https://shared.steamstatic.com/ss.600x338.jpg'
+ }
+ ])
+ })
+})
+
+describe('getUrlScreenshots', () => {
+ it('maps plain URL lists', () => {
+ expect(
+ getUrlScreenshots(['https://m.media-amazon.com/a.jpg', 'bad'])
+ ).toEqual([{ full: 'https://m.media-amazon.com/a.jpg' }])
+ })
+
+ it('returns an empty list for non arrays', () => {
+ expect(getUrlScreenshots(undefined)).toEqual([])
+ })
+})
diff --git a/src/backend/storeManagers/storeManagerCommon/screenshots.ts b/src/backend/storeManagers/storeManagerCommon/screenshots.ts
new file mode 100644
index 000000000..42e98d8ad
--- /dev/null
+++ b/src/backend/storeManagers/storeManagerCommon/screenshots.ts
@@ -0,0 +1,87 @@
+import { GameScreenshot } from 'common/types'
+
+export const MAX_SCREENSHOTS = 12
+
+const GOG_FULL_FORMATTER = '1600'
+const GOG_THUMBNAIL_FORMATTER = 'product_card_screenshot_748'
+
+interface ScreenshotCandidate {
+ full?: unknown
+ thumbnail?: unknown
+}
+
+export function isSafeImageUrl(url: unknown): url is string {
+ if (typeof url !== 'string') return false
+ try {
+ return new URL(url).protocol === 'https:'
+ } catch {
+ return false
+ }
+}
+
+export function buildScreenshots(
+ candidates: ScreenshotCandidate[]
+): GameScreenshot[] {
+ const seen = new Set<string>()
+ const screenshots: GameScreenshot[] = []
+
+ for (const { full, thumbnail } of candidates) {
+ if (!isSafeImageUrl(full) || seen.has(full)) continue
+ seen.add(full)
+ screenshots.push(isSafeImageUrl(thumbnail) ? { full, thumbnail } : { full })
+ if (screenshots.length === MAX_SCREENSHOTS) break
+ }
+
+ return screenshots
+}
+
+function asArray(value: unknown): unknown[] {
+ return Array.isArray(value) ? value : []
+}
+
+function asRecord(value: unknown): Record<string, unknown> {
+ return value && typeof value === 'object'
+ ? (value as Record<string, unknown>)
+ : {}
+}
+
+export function getGogScreenshots(gamesData: unknown): GameScreenshot[] {
+ const embedded = asRecord(asRecord(gamesData)._embedded)
+
+ return buildScreenshots(
+ asArray(embedded.screenshots).map((entry) => {
+ const href = asRecord(asRecord(asRecord(entry)._links).self).href
+ if (typeof href !== 'string' || !href.includes('{formatter}')) return {}
+ return {
+ full: href.replace('{formatter}', GOG_FULL_FORMATTER),
+ thumbnail: href.replace('{formatter}', GOG_THUMBNAIL_FORMATTER)
+ }
+ })
+ )
+}
+
+export function getEpicScreenshots(carousel: unknown): GameScreenshot[] {
+ const items = asArray(asRecord(carousel).items).map(asRecord)
+ const withImage = items.filter(
+ (item) => typeof asRecord(item.image).src === 'string'
+ )
+ const stills = withImage.filter((item) => !asRecord(item.video).recipes)
+ const source = stills.length > 0 ? stills : withImage
+
+ return buildScreenshots(
+ source.map((item) => ({ full: asRecord(item.image).src }))
+ )
+}
+
+export function getSteamScreenshots(screenshots: unknown): GameScreenshot[] {
+ return buildScreenshots(
+ asArray(screenshots).map((entry) => {
+ const { path_full, path_thumbnail } = asRecord(entry)
+ return { full: path_full, thumbnail: path_thumbnail }
+ })
+ )
+}
+
+export function getUrlScreenshots(urls: unknown): GameScreenshot[] {
+ return buildScreenshots(asArray(urls).map((full) => ({ full })))
+}
diff --git a/src/common/types.ts b/src/common/types.ts
index d7c9074f2..deeddc68a 100644
--- a/src/common/types.ts
+++ b/src/common/types.ts
@@ -204,6 +204,12 @@ export interface ExtraInfo {
cover?: string
score?: string
platforms?: InstallPlatform[]
+ screenshots?: GameScreenshot[]
+}
+
+export interface GameScreenshot {
+ full: string
+ thumbnail?: string
}
export type GameConfigVersion = 'auto' | 'v0' | 'v0.1'
diff --git a/src/frontend/components/UI/Alert/index.css b/src/frontend/components/UI/Alert/index.css
index e08702767..ae5d7c3c6 100644
--- a/src/frontend/components/UI/Alert/index.css
+++ b/src/frontend/components/UI/Alert/index.css
@@ -6,7 +6,7 @@
gap: var(--space-sm-fixed);
width: 100%;
padding: var(--space-md-fixed) var(--space-md-fixed);
- border-radius: var(--radius-sm);
+ border-radius: var(--radius-none);
background: color-mix(in oklab, var(--alert-tone) 14%, var(--panel-base));
font-family: var(--primary-font-family);
font-size: var(--body-md);
@@ -38,6 +38,11 @@
color: var(--text-neutral-muted);
}
+.Alert__message a {
+ color: var(--text-neutral);
+ text-decoration: underline;
+}
+
.Alert__actions {
display: flex;
align-items: center;
diff --git a/src/frontend/components/UI/Anticheat/index.tsx b/src/frontend/components/UI/Anticheat/index.tsx
index 1a524761f..7baf104c3 100644
--- a/src/frontend/components/UI/Anticheat/index.tsx
+++ b/src/frontend/components/UI/Anticheat/index.tsx
@@ -98,7 +98,7 @@ export default function Anticheat({ anticheatInfo }: Props) {
)}
</p>
)}
- <DetailList items={items} />
+ <DetailList layout="inline" items={items} />
</Alert>
)
}
diff --git a/src/frontend/components/UI/BackButton/index.css b/src/frontend/components/UI/BackButton/index.css
index 1597a93ff..fa5247e58 100644
--- a/src/frontend/components/UI/BackButton/index.css
+++ b/src/frontend/components/UI/BackButton/index.css
@@ -18,6 +18,13 @@
color 150ms ease;
}
+.BackButton--iconOnly {
+ justify-content: center;
+ width: 44px;
+ padding: 0;
+ flex-shrink: 0;
+}
+
.BackButton:hover,
.BackButton:focus-visible {
background: var(--background-lighter, #1a2030);
diff --git a/src/frontend/components/UI/BackButton/index.stories.tsx b/src/frontend/components/UI/BackButton/index.stories.tsx
index 541d27722..fa7c200f6 100644
--- a/src/frontend/components/UI/BackButton/index.stories.tsx
+++ b/src/frontend/components/UI/BackButton/index.stories.tsx
@@ -18,6 +18,15 @@ type Story = StoryObj<typeof meta>
export const Default: Story = {}
+export const IconOnly: Story = {
+ args: { iconOnly: true },
+ play: async ({ canvas }) => {
+ const link = canvas.getByRole('link', { name: 'Back to library' })
+ await expect(link).toHaveAttribute('href', '/')
+ await expect(canvas.queryByText('Back to library')).not.toBeInTheDocument()
+ }
+}
+
export const LinksToTheTarget: Story = {
play: async ({ canvas }) => {
await expect(
diff --git a/src/frontend/components/UI/BackButton/index.tsx b/src/frontend/components/UI/BackButton/index.tsx
index 2cbb6388b..6ca24f2f4 100644
--- a/src/frontend/components/UI/BackButton/index.tsx
+++ b/src/frontend/components/UI/BackButton/index.tsx
@@ -7,18 +7,29 @@ import './index.css'
interface BackButtonProps {
to: string
label: string
+ iconOnly?: boolean
className?: string
}
-export default function BackButton({ to, label, className }: BackButtonProps) {
+export default function BackButton({
+ to,
+ label,
+ iconOnly = false,
+ className
+}: BackButtonProps) {
return (
<NavLink
to={to}
title={label}
- className={classNames('BackButton', className)}
+ aria-label={iconOnly ? label : undefined}
+ className={classNames(
+ 'BackButton',
+ { 'BackButton--iconOnly': iconOnly },
+ className
+ )}
>
<Icon glyph={ArrowLeft} size="md" />
- <span className="BackButton__label">{label}</span>
+ {!iconOnly && <span className="BackButton__label">{label}</span>}
</NavLink>
)
}
diff --git a/src/frontend/components/UI/Carousel/index.css b/src/frontend/components/UI/Carousel/index.css
new file mode 100644
index 000000000..7ffb168cc
--- /dev/null
+++ b/src/frontend/components/UI/Carousel/index.css
@@ -0,0 +1,134 @@
+.Carousel {
+ --carousel-gap: var(--space-xs-fixed);
+ --carousel-visible-thumbnails: 5;
+
+ display: flex;
+ flex-direction: column;
+ gap: var(--carousel-gap);
+ min-width: 0;
+}
+
+.Carousel__stage {
+ position: relative;
+ aspect-ratio: 16 / 9;
+ overflow: hidden;
+ border-radius: var(--radius-sm);
+ background: var(--color-neutral-950);
+}
+
+.Carousel__slides,
+.Carousel__slide {
+ position: absolute;
+ inset: 0;
+}
+
+.Carousel__slide {
+ animation: Carousel-fade-in 300ms ease;
+}
+
+.Carousel__image,
+.Carousel__thumbnailImage {
+ display: block;
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.Carousel__image--contain {
+ object-fit: contain;
+}
+
+.Carousel__badge {
+ position: absolute;
+ z-index: 1;
+ inset-block-start: var(--space-sm-fixed);
+ inset-inline-end: var(--space-sm-fixed);
+ display: flex;
+}
+
+.Carousel__controls {
+ position: absolute;
+ z-index: 1;
+ inset-block-end: var(--space-sm-fixed);
+ inset-inline-end: var(--space-sm-fixed);
+ display: flex;
+ gap: var(--space-2xs-fixed);
+}
+
+.Carousel__thumbnails {
+ display: grid;
+ grid-auto-flow: column;
+ grid-auto-columns: calc(
+ (100% - (var(--carousel-visible-thumbnails) - 1) * var(--carousel-gap)) /
+ var(--carousel-visible-thumbnails)
+ );
+ gap: var(--carousel-gap);
+ overflow-x: auto;
+ scroll-behavior: smooth;
+ scrollbar-width: none;
+}
+
+.Carousel__thumbnails::-webkit-scrollbar {
+ display: none;
+}
+
+.Carousel__thumbnail {
+ position: relative;
+ aspect-ratio: 16 / 9;
+ overflow: hidden;
+ padding: 0;
+ border: 2px solid transparent;
+ border-radius: var(--radius-sm);
+ background: var(--color-neutral-950);
+ cursor: pointer;
+ opacity: 0.7;
+ transition:
+ opacity 150ms ease,
+ border-color 150ms ease;
+}
+
+.Carousel__thumbnail:hover,
+.Carousel__thumbnail:focus-visible,
+.Carousel__thumbnail--active {
+ opacity: 1;
+}
+
+.Carousel__thumbnail--active {
+ border-color: var(--accent);
+}
+
+.Carousel__thumbnail:focus-visible {
+ outline-offset: -3px;
+}
+
+@keyframes Carousel-fade-in {
+ from {
+ opacity: 0;
+ }
+
+ to {
+ opacity: 1;
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .Carousel__slide {
+ animation: none;
+ }
+
+ .Carousel__thumbnails {
+ scroll-behavior: auto;
+ }
+}
+
+.Carousel__placeholder {
+ position: absolute;
+ inset: 0;
+ display: grid;
+ place-items: center;
+}
+
+.Carousel__placeholder > svg {
+ width: auto;
+ height: 45%;
+}
diff --git a/src/frontend/components/UI/Carousel/index.stories.tsx b/src/frontend/components/UI/Carousel/index.stories.tsx
new file mode 100644
index 000000000..7c3b65ab6
--- /dev/null
+++ b/src/frontend/components/UI/Carousel/index.stories.tsx
@@ -0,0 +1,224 @@
+import { useEffect, useState } from 'react'
+import { expect } from 'storybook/test'
+import type { Meta, StoryObj } from '@storybook/react-vite'
+import heroicCard from 'frontend/assets/heroic_card.jpg'
+import HeroicIcon from 'frontend/assets/heroic-icon.svg?react'
+
+import StoreBadge from '../StoreBadge'
+import Carousel, { type CarouselImage } from '.'
+
+const HUES = [190, 280, 20, 140, 330, 45]
+
+function placeholder(index: number) {
+ const hue = HUES[index % HUES.length]
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900"><defs><linearGradient id="g" x1="0" x2="1" y1="0" y2="1"><stop offset="0" stop-color="hsl(${hue} 70% 45%)"/><stop offset="1" stop-color="hsl(${hue + 40} 70% 20%)"/></linearGradient></defs><rect width="1600" height="900" fill="url(#g)"/><text x="800" y="480" font-family="sans-serif" font-size="96" fill="white" text-anchor="middle">Screenshot ${index + 1}</text></svg>`
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`
+}
+
+const screenshots: CarouselImage[] = Array.from({ length: 8 }, (_, index) => ({
+ src: placeholder(index),
+ alt: `Example game screenshot ${index + 1}`
+}))
+
+const meta = {
+ title: 'Media/Carousel',
+ component: Carousel,
+ args: {
+ images: screenshots,
+ label: 'Example game screenshots'
+ },
+ render: (args) => (
+ <div style={{ maxWidth: '34rem' }}>
+ <Carousel {...args} />
+ </div>
+ )
+} satisfies Meta<typeof Carousel>
+
+export default meta
+
+type Story = StoryObj<typeof meta>
+
+export const Default: Story = {}
+
+export const WithoutAutoplay: Story = {
+ args: { autoplayInterval: 0 }
+}
+
+export const FewImages: Story = {
+ args: { images: screenshots.slice(0, 3) }
+}
+
+export const SingleImage: Story = {
+ args: { images: screenshots.slice(0, 1) }
+}
+
+export const WithBadge: Story = {
+ args: {
+ badge: <StoreBadge runner="legendary" title="Epic Games" />
+ },
+ play: async ({ canvas }) => {
+ await expect(
+ canvas.getByRole('img', { name: 'Epic Games' })
+ ).toBeInTheDocument()
+ }
+}
+
+export const FallbackArtwork: Story = {
+ args: {
+ images: [
+ { src: heroicCard, alt: 'Heroic Games Launcher logo', fit: 'contain' }
+ ]
+ }
+}
+
+export const SelectingAThumbnailShowsThatImage: Story = {
+ args: { autoplayInterval: 0 },
+ play: async ({ canvas, userEvent }) => {
+ const third = canvas.getByRole('button', { name: 'Show image 3' })
+ await userEvent.click(third)
+
+ await expect(third).toHaveAttribute('aria-current', 'true')
+ await expect(
+ canvas.getByRole('group', { name: '3 of 8' })
+ ).toBeInTheDocument()
+ await expect(
+ canvas.getByRole('img', { name: 'Example game screenshot 3' })
+ ).toBeInTheDocument()
+ }
+}
+
+export const ClickingAThumbnailKeepsTheSlideshowPlaying: Story = {
+ args: { autoplayInterval: 300 },
+ play: async ({ canvas, userEvent }) => {
+ await userEvent.hover(canvas.getByRole('group', { name: '1 of 8' }))
+ await userEvent.click(canvas.getByRole('button', { name: 'Show image 3' }))
+
+ await expect(
+ await canvas.findByRole('group', { name: '4 of 8' }, { timeout: 2000 })
+ ).toBeInTheDocument()
+ await expect(
+ canvas.getByRole('button', { name: 'Pause slideshow' })
+ ).toBeInTheDocument()
+ }
+}
+
+export const PauseStopsTheSlideshow: Story = {
+ play: async ({ canvas, userEvent }) => {
+ const pause = canvas.getByRole('button', { name: 'Pause slideshow' })
+ await userEvent.click(pause)
+
+ await expect(
+ canvas.getByRole('button', { name: 'Play slideshow' })
+ ).toBeInTheDocument()
+ }
+}
+
+export const SingleImageHasNoControls: Story = {
+ args: { images: screenshots.slice(0, 1) },
+ play: async ({ canvas }) => {
+ await expect(canvas.queryAllByRole('button')).toHaveLength(0)
+ }
+}
+
+function LateScreenshots() {
+ const [images, setImages] = useState(screenshots.slice(0, 1))
+
+ useEffect(() => {
+ const timer = window.setTimeout(() => setImages(screenshots), 50)
+ return () => window.clearTimeout(timer)
+ }, [])
+
+ return (
+ <div style={{ maxWidth: '34rem' }}>
+ <Carousel
+ images={images}
+ label="Example game screenshots"
+ autoplayInterval={300}
+ />
+ </div>
+ )
+}
+
+export const StartsPlayingWhenMoreImagesArrive: Story = {
+ render: () => <LateScreenshots />,
+ play: async ({ canvas }) => {
+ await expect(
+ await canvas.findByRole('button', { name: 'Pause slideshow' })
+ ).toBeInTheDocument()
+ await expect(
+ await canvas.findByRole('group', { name: '2 of 8' }, { timeout: 2000 })
+ ).toBeInTheDocument()
+ }
+}
+
+export const KeyboardFocusHoldsTheCurrentImage: Story = {
+ args: { autoplayInterval: 300 },
+ play: async ({ canvas, userEvent }) => {
+ await userEvent.tab()
+ await expect(
+ canvas.getByRole('button', { name: 'Pause slideshow' })
+ ).toHaveFocus()
+
+ await new Promise((resolve) => window.setTimeout(resolve, 900))
+ await expect(
+ canvas.getByRole('group', { name: '1 of 8' })
+ ).toBeInTheDocument()
+ }
+}
+
+export const OnlyFiveThumbnailsShow: Story = {
+ args: { autoplayInterval: 0 },
+ play: async ({ canvasElement }) => {
+ const list = canvasElement.querySelector('.Carousel__thumbnails')
+ const thumbnails = canvasElement.querySelectorAll('.Carousel__thumbnail')
+ const listRight = list!.getBoundingClientRect().right
+ const stageRight = canvasElement
+ .querySelector('.Carousel__stage')!
+ .getBoundingClientRect().right
+
+ await expect(listRight).toBeCloseTo(stageRight, 0)
+ await expect(
+ thumbnails[4].getBoundingClientRect().right
+ ).toBeLessThanOrEqual(listRight + 0.5)
+ await expect(
+ thumbnails[5].getBoundingClientRect().left
+ ).toBeGreaterThanOrEqual(listRight)
+ }
+}
+
+export const EmptyWithPlaceholder: Story = {
+ args: {
+ images: [],
+ placeholder: (
+ <HeroicIcon role="img" aria-label="Heroic Games Launcher logo" />
+ ),
+ badge: <StoreBadge runner="sideload" title="Sideloaded" />
+ },
+ play: async ({ canvas }) => {
+ await expect(
+ canvas.getByRole('img', { name: 'Heroic Games Launcher logo' })
+ ).toBeInTheDocument()
+ await expect(canvas.queryAllByRole('button')).toHaveLength(0)
+ }
+}
+
+export const BrokenImageShowsPlaceholder: Story = {
+ args: {
+ autoplayInterval: 0,
+ images: [
+ { src: 'data:image/png;base64,broken', alt: 'Broken screenshot' },
+ ...screenshots.slice(1, 3)
+ ],
+ placeholder: (
+ <HeroicIcon role="img" aria-label="Heroic Games Launcher logo" />
+ )
+ },
+ play: async ({ canvas }) => {
+ await expect(
+ await canvas.findByRole('img', { name: 'Heroic Games Launcher logo' })
+ ).toBeInTheDocument()
+ await expect(
+ canvas.queryByRole('img', { name: 'Broken screenshot' })
+ ).not.toBeInTheDocument()
+ }
+}
diff --git a/src/frontend/components/UI/Carousel/index.tsx b/src/frontend/components/UI/Carousel/index.tsx
new file mode 100644
index 000000000..b6f4edfa1
--- /dev/null
+++ b/src/frontend/components/UI/Carousel/index.tsx
@@ -0,0 +1,223 @@
+import { ReactNode, useEffect, useRef, useState } from 'react'
+import classNames from 'classnames'
+import { useTranslation } from 'react-i18next'
+import { Pause, Play } from 'lucide-react'
+import Button from '../Button'
+import CachedImage from '../CachedImage'
+import Icon from '../Icon'
+import './index.css'
+
+export interface CarouselImage {
+ src: string
+ alt: string
+ thumbnail?: string
+ fit?: 'cover' | 'contain'
+}
+
+interface CarouselProps {
+ images: CarouselImage[]
+ label: string
+ autoplayInterval?: number
+ badge?: ReactNode
+ placeholder?: ReactNode
+ className?: string
+}
+
+const DEFAULT_AUTOPLAY_INTERVAL = 6000
+
+const Carousel = ({
+ images,
+ label,
+ autoplayInterval = DEFAULT_AUTOPLAY_INTERVAL,
+ badge,
+ placeholder,
+ className
+}: CarouselProps) => {
+ const { t } = useTranslation()
+ const total = images.length
+ const hasMany = total > 1
+ const canAutoplay = hasMany && autoplayInterval > 0
+
+ const [current, setCurrent] = useState(0)
+ const [isPausedByUser, setIsPausedByUser] = useState(false)
+ const [hasKeyboardFocus, setHasKeyboardFocus] = useState(false)
+ const [failedSources, setFailedSources] = useState<ReadonlySet<string>>(
+ () => new Set()
+ )
+ const thumbnailsRef = useRef<HTMLDivElement>(null)
+ const lastInputRef = useRef<'keyboard' | 'pointer'>('pointer')
+
+ const activeIndex = current < total ? current : 0
+ const isPlaying = canAutoplay && !isPausedByUser
+ const isRotating = isPlaying && !hasKeyboardFocus
+
+ useEffect(() => {
+ const onKeyDown = () => {
+ lastInputRef.current = 'keyboard'
+ }
+ const onPointerDown = () => {
+ lastInputRef.current = 'pointer'
+ }
+ window.addEventListener('keydown', onKeyDown, true)
+ window.addEventListener('pointerdown', onPointerDown, true)
+ return () => {
+ window.removeEventListener('keydown', onKeyDown, true)
+ window.removeEventListener('pointerdown', onPointerDown, true)
+ }
+ }, [])
+
+ useEffect(() => {
+ if (!isRotating) return
+ const timer = window.setTimeout(
+ () => setCurrent((index) => (index + 1) % total),
+ autoplayInterval
+ )
+ return () => window.clearTimeout(timer)
+ }, [isRotating, activeIndex, total, autoplayInterval])
+
+ useEffect(() => {
+ const list = thumbnailsRef.current
+ const thumbnail = list?.children[activeIndex] as HTMLElement | undefined
+ if (!list || !thumbnail) return
+ const start = thumbnail.offsetLeft - list.offsetLeft
+ const end = start + thumbnail.offsetWidth
+ if (start < list.scrollLeft) {
+ list.scrollTo({ left: start })
+ } else if (end > list.scrollLeft + list.clientWidth) {
+ list.scrollTo({ left: end - list.clientWidth })
+ }
+ }, [activeIndex])
+
+ const markFailed =
+ (src: string) => (event: React.SyntheticEvent<HTMLImageElement>) => {
+ if (event.currentTarget.getAttribute('src')?.startsWith('imagecache:')) {
+ return
+ }
+ setFailedSources((previous) => new Set(previous).add(src))
+ }
+
+ const showsPlaceholder = (src: string) =>
+ Boolean(placeholder) && failedSources.has(src)
+
+ if (total === 0) {
+ if (!placeholder) return null
+ return (
+ <section className={classNames('Carousel', className)} aria-label={label}>
+ <div className="Carousel__stage">
+ {badge && <div className="Carousel__badge">{badge}</div>}
+ <div className="Carousel__placeholder">{placeholder}</div>
+ </div>
+ </section>
+ )
+ }
+
+ const image = images[activeIndex]
+
+ const handleFocus = () => {
+ setHasKeyboardFocus(lastInputRef.current === 'keyboard')
+ }
+
+ const handleBlur = (event: React.FocusEvent<HTMLElement>) => {
+ if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {
+ setHasKeyboardFocus(false)
+ }
+ }
+
+ const playLabel = isPlaying
+ ? t('carousel.pause', 'Pause slideshow')
+ : t('carousel.play', 'Play slideshow')
+
+ return (
+ <section
+ className={classNames('Carousel', className)}
+ aria-roledescription={t('carousel.roleDescription', 'carousel')}
+ aria-label={label}
+ onFocus={handleFocus}
+ onBlur={handleBlur}
+ >
+ <div className="Carousel__stage">
+ {badge && <div className="Carousel__badge">{badge}</div>}
+ {canAutoplay && (
+ <div className="Carousel__controls">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="Carousel__control"
+ aria-label={playLabel}
+ title={playLabel}
+ onClick={() => setIsPausedByUser((paused) => !paused)}
+ icon={<Icon glyph={isPlaying ? Pause : Play} size="sm" />}
+ />
+ </div>
+ )}
+
+ <div
+ className="Carousel__slides"
+ aria-live={isRotating ? 'off' : 'polite'}
+ aria-atomic="true"
+ >
+ <div
+ key={image.src}
+ role="group"
+ aria-roledescription={t('carousel.slide', 'slide')}
+ aria-label={t('carousel.position', '{{index}} of {{total}}', {
+ index: activeIndex + 1,
+ total
+ })}
+ className="Carousel__slide"
+ >
+ {showsPlaceholder(image.src) ? (
+ <div className="Carousel__placeholder">{placeholder}</div>
+ ) : (
+ <CachedImage
+ src={image.src}
+ alt={image.alt}
+ loading="eager"
+ onError={markFailed(image.src)}
+ className={classNames('Carousel__image', {
+ 'Carousel__image--contain': image.fit === 'contain'
+ })}
+ />
+ )}
+ </div>
+ </div>
+ </div>
+
+ {hasMany && (
+ <div className="Carousel__thumbnails" ref={thumbnailsRef}>
+ {images.map((item, index) => (
+ <button
+ key={item.src}
+ type="button"
+ className={classNames('Carousel__thumbnail', {
+ 'Carousel__thumbnail--active': index === activeIndex
+ })}
+ aria-label={t('carousel.show', 'Show image {{index}}', {
+ index: index + 1
+ })}
+ aria-current={index === activeIndex ? 'true' : undefined}
+ onClick={() => setCurrent(index)}
+ >
+ {showsPlaceholder(item.thumbnail ?? item.src) ? (
+ <div className="Carousel__placeholder" aria-hidden="true">
+ {placeholder}
+ </div>
+ ) : (
+ <CachedImage
+ src={item.thumbnail ?? item.src}
+ alt=""
+ onError={markFailed(item.thumbnail ?? item.src)}
+ className={classNames('Carousel__thumbnailImage', {
+ 'Carousel__image--contain': item.fit === 'contain'
+ })}
+ />
+ )}
+ </button>
+ ))}
+ </div>
+ )}
+ </section>
+ )
+}
+
+export default Carousel
diff --git a/src/frontend/components/UI/DetailList/index.css b/src/frontend/components/UI/DetailList/index.css
index d8bb58164..b4982dfd4 100644
--- a/src/frontend/components/UI/DetailList/index.css
+++ b/src/frontend/components/UI/DetailList/index.css
@@ -91,3 +91,25 @@
overflow-wrap: anywhere;
transition: color 150ms ease;
}
+
+.DetailList--inline .DetailList__row {
+ grid-template-areas: 'icon label value';
+ grid-template-columns: auto fit-content(50%) minmax(0, 1fr);
+ align-items: baseline;
+ column-gap: var(--space-md-fixed);
+ padding-block: var(--space-sm-fixed);
+}
+
+.DetailList--inline:not(.DetailList--withIcons) .DetailList__row {
+ grid-template-areas: 'label value';
+ grid-template-columns: fit-content(50%) minmax(0, 1fr);
+}
+
+.DetailList--inline .DetailList__value {
+ text-align: end;
+}
+
+.DetailList--inline.DetailList--cols-1 .DetailList__row:last-child {
+ border-bottom: 1px solid var(--panel-divider, var(--divider));
+ padding-bottom: var(--space-sm-fixed);
+}
diff --git a/src/frontend/components/UI/DetailList/index.stories.tsx b/src/frontend/components/UI/DetailList/index.stories.tsx
index b2b0559d4..725e63953 100644
--- a/src/frontend/components/UI/DetailList/index.stories.tsx
+++ b/src/frontend/components/UI/DetailList/index.stories.tsx
@@ -45,6 +45,17 @@ export const WithoutIcons: Story = {
}
}
+export const Inline: Story = {
+ args: { layout: 'inline' }
+}
+
+export const InlineWithoutIcons: Story = {
+ args: {
+ layout: 'inline',
+ items: items.map(({ label, value }) => ({ label, value }))
+ }
+}
+
export const ClickableRow: Story = {
args: {
items: [
diff --git a/src/frontend/components/UI/DetailList/index.tsx b/src/frontend/components/UI/DetailList/index.tsx
index e6f29ccb8..6ee4fb305 100644
--- a/src/frontend/components/UI/DetailList/index.tsx
+++ b/src/frontend/components/UI/DetailList/index.tsx
@@ -15,12 +15,14 @@ export interface DetailItem {
interface DetailListProps {
items: DetailItem[]
columns?: 1 | 2
+ layout?: 'stacked' | 'inline'
className?: string
}
export default function DetailList({
items,
columns = 1,
+ layout = 'stacked',
className
}: DetailListProps) {
if (!items.length) {
@@ -34,6 +36,7 @@ export default function DetailList({
className={classNames(
'DetailList',
`DetailList--cols-${columns}`,
+ `DetailList--${layout}`,
className,
{
'DetailList--withIcons': hasIcons
diff --git a/src/frontend/components/UI/GameActionButton/index.tsx b/src/frontend/components/UI/GameActionButton/index.tsx
index e234d4776..94747602a 100644
--- a/src/frontend/components/UI/GameActionButton/index.tsx
+++ b/src/frontend/components/UI/GameActionButton/index.tsx
@@ -34,8 +34,8 @@ const ACTIONS: Record<GameAction, ActionStyle> = {
play: { glyph: Play, variant: 'primary', legacyClass: 'playIcon' },
install: { glyph: Download, variant: 'secondary', legacyClass: 'downIcon' },
update: { glyph: RefreshCw, variant: 'ghost', legacyClass: 'updateIcon' },
- stop: { glyph: Square, variant: 'danger', legacyClass: 'cancelIcon' },
- cancel: { glyph: X, variant: 'danger', legacyClass: 'cancelIcon' },
+ stop: { glyph: Square, variant: 'dangerSubtle', legacyClass: 'cancelIcon' },
+ cancel: { glyph: X, variant: 'dangerSubtle', legacyClass: 'cancelIcon' },
queue: { glyph: CircleMinus, variant: 'danger', legacyClass: 'queueIcon' },
unavailable: {
glyph: Ban,
diff --git a/src/frontend/components/UI/Score/index.tsx b/src/frontend/components/UI/Score/index.tsx
index a7a9a882a..f2b604dc7 100644
--- a/src/frontend/components/UI/Score/index.tsx
+++ b/src/frontend/components/UI/Score/index.tsx
@@ -43,14 +43,27 @@ export default function Score({
})}
>
<span className="Score__label">{label}</span>
- <span
- className={classNames(
- 'Score__value',
- `Score__value--${toneFor(value)}`
- )}
- >
- {value ?? '?'}
- </span>
+ <ScoreValue value={value} />
</Element>
)
}
+
+export function ScoreValue({
+ value,
+ className
+}: {
+ value?: string | null
+ className?: string
+}) {
+ return (
+ <span
+ className={classNames(
+ 'Score__value',
+ `Score__value--${toneFor(value)}`,
+ className
+ )}
+ >
+ {value ?? '?'}
+ </span>
+ )
+}
diff --git a/src/frontend/components/UI/index.tsx b/src/frontend/components/UI/index.tsx
index cd89d3b91..3939895b3 100644
--- a/src/frontend/components/UI/index.tsx
+++ b/src/frontend/components/UI/index.tsx
@@ -10,6 +10,7 @@ export { default as UpdateComponent } from './UpdateComponent'
export { default as SvgButton } from './SvgButton'
export { default as ControllerHints } from './ControllerHints'
export { default as CachedImage } from './CachedImage'
+export { default as Carousel } from './Carousel'
export { default as OfflineMessage } from './OfflineMessage'
export { default as PathSelectionBox } from './PathSelectionBox'
export { default as Winetricks } from './Winetricks'
@@ -43,6 +44,7 @@ export { default as SettingRow } from './SettingRow'
export { default as SpecCard } from './SpecCard'
export { default as Skeleton } from './Skeleton'
export { default as SettingsCard } from './SettingsCard'
+// ts-prune-ignore-next
export { default as Score } from './Score'
export { default as StatCard } from './StatCard'
export { default as Tabs } from './Tabs'
diff --git a/src/frontend/screens/Game/GamePage/components/CompatibilityInfo.tsx b/src/frontend/screens/Game/GamePage/components/CompatibilityInfo.tsx
index f601c6f08..59a8be166 100644
--- a/src/frontend/screens/Game/GamePage/components/CompatibilityInfo.tsx
+++ b/src/frontend/screens/Game/GamePage/components/CompatibilityInfo.tsx
@@ -82,7 +82,7 @@ const CompatibilityInfo = ({ gameInfo }: Props) => {
return (
<Panel tone="glass" className="compatibilityInfo">
- <DetailList items={items} />
+ <DetailList layout="inline" items={items} />
</Panel>
)
}
diff --git a/src/frontend/screens/Game/GamePage/components/DownloadSizeInfo.tsx b/src/frontend/screens/Game/GamePage/components/DownloadSizeInfo.tsx
index 0c7bb10a3..fdf2fb507 100644
--- a/src/frontend/screens/Game/GamePage/components/DownloadSizeInfo.tsx
+++ b/src/frontend/screens/Game/GamePage/components/DownloadSizeInfo.tsx
@@ -29,6 +29,7 @@ const DownloadSizeInfo = ({ gameInfo }: Props) => {
return (
<div className="downloadSizeInfo">
<DetailList
+ layout="inline"
items={[
{
glyph: Package,
@@ -65,7 +66,7 @@ const DownloadSizeInfo = ({ gameInfo }: Props) => {
return (
<div className="downloadSizeInfo">
- <DetailList items={items} columns={2} />
+ <DetailList layout="inline" items={items} columns={2} />
</div>
)
}
diff --git a/src/frontend/screens/Game/GamePage/components/GameDetails.tsx b/src/frontend/screens/Game/GamePage/components/GameDetails.tsx
index 3635ef98c..7e2c67336 100644
--- a/src/frontend/screens/Game/GamePage/components/GameDetails.tsx
+++ b/src/frontend/screens/Game/GamePage/components/GameDetails.tsx
@@ -1,28 +1,27 @@
import { useContext } from 'react'
import { useTranslation } from 'react-i18next'
import { GameInfo } from 'common/types'
-import { DetailList, StoreBadge } from 'frontend/components/UI'
+import { DetailList } from 'frontend/components/UI'
import type { DetailItem } from 'frontend/components/UI/DetailList'
import { getIntlLocale } from 'frontend/helpers'
import { getReleaseDate } from 'frontend/helpers/releaseDate'
import GameContext from '../../GameContext'
+import { usePlayStats } from './GameStats'
interface Props {
gameInfo: GameInfo
+ showPlayStats: boolean
+ achievementPercentage?: number
}
-const STORE_NAMES: Record<string, string> = {
- legendary: 'Epic Games',
- gog: 'GOG',
- nile: 'Amazon Games',
- zoom: 'ZOOM',
- itchio: 'itch.io',
- sideload: 'Sideloaded'
-}
-
-const GameDetails = ({ gameInfo }: Props) => {
+const GameDetails = ({
+ gameInfo,
+ showPlayStats,
+ achievementPercentage
+}: Props) => {
const { t, i18n } = useTranslation('gamepage')
- const { gameExtraInfo, runner, wikiInfo, is } = useContext(GameContext)
+ const playStats = usePlayStats(gameInfo, achievementPercentage)
+ const { gameExtraInfo, wikiInfo, is } = useContext(GameContext)
const releaseDate = getReleaseDate(
wikiInfo?.pcgamingwiki?.releaseDate,
@@ -55,15 +54,16 @@ const GameDetails = ({ gameInfo }: Props) => {
})
}
+ if (showPlayStats) {
+ items.push(...playStats)
+ }
+
return (
- <section className="gameDetails">
- <div className="gameDetails__header">
- <h3 className="gameDetails__title">
- {t('game.details', 'Game details')}
- </h3>
- <StoreBadge runner={runner} title={STORE_NAMES[runner] ?? runner} />
- </div>
- <DetailList items={items} />
+ <section className="gameDetails gamePage__infoColumn">
+ <h3 className="gamePage__infoTitle">
+ {t('game.detailsSection', 'Details')}
+ </h3>
+ <DetailList layout="inline" items={items} />
</section>
)
}
diff --git a/src/frontend/screens/Game/GamePage/components/GameMedia.tsx b/src/frontend/screens/Game/GamePage/components/GameMedia.tsx
new file mode 100644
index 000000000..35282351e
--- /dev/null
+++ b/src/frontend/screens/Game/GamePage/components/GameMedia.tsx
@@ -0,0 +1,92 @@
+import { useContext, useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { GameInfo } from 'common/types'
+import { Carousel, StoreBadge } from 'frontend/components/UI'
+import type { CarouselImage } from 'frontend/components/UI/Carousel'
+import HeroicIcon from 'frontend/assets/heroic-icon.svg?react'
+import GameContext from '../../GameContext'
+
+interface Props {
+ gameInfo: GameInfo
+}
+
+const STORE_NAMES: Record<string, string> = {
+ legendary: 'Epic Games',
+ gog: 'GOG',
+ nile: 'Amazon Games',
+ zoom: 'ZOOM',
+ itchio: 'itch.io',
+ sideload: 'Sideloaded'
+}
+
+const GameMedia = ({ gameInfo }: Props) => {
+ const { t } = useTranslation('gamepage')
+ const { gameExtraInfo, runner } = useContext(GameContext)
+
+ const title = gameInfo.overrides?.title || gameInfo.title
+ const screenshots = gameExtraInfo?.screenshots
+ const background = gameExtraInfo?.background || gameInfo.art_background
+ const cover =
+ gameInfo.overrides?.art_cover || gameInfo.art_cover || gameExtraInfo?.cover
+ const logo = gameInfo.art_logo
+
+ const images = useMemo<CarouselImage[]>(() => {
+ if (screenshots?.length) {
+ return screenshots.map(({ full, thumbnail }, index) => ({
+ src: full,
+ thumbnail,
+ alt: t('game.screenshotAlt', '{{title}} screenshot {{index}}', {
+ title,
+ index: index + 1
+ })
+ }))
+ }
+
+ const artwork: CarouselImage[] = []
+ const addArtwork = (image: Omit<CarouselImage, 'src'>, src?: string) => {
+ if (src && !artwork.some((item) => item.src === src)) {
+ artwork.push({ ...image, src })
+ }
+ }
+
+ addArtwork(
+ { alt: t('game.backgroundAlt', '{{title}} artwork', { title }) },
+ background
+ )
+ addArtwork(
+ {
+ alt: t('game.coverAlt', '{{title}} cover art', { title }),
+ fit: 'contain'
+ },
+ cover
+ )
+ addArtwork(
+ {
+ alt: t('game.logoAlt', '{{title}} logo', { title }),
+ fit: 'contain'
+ },
+ logo
+ )
+
+ return artwork
+ }, [screenshots, background, cover, logo, title, t])
+
+ return (
+ <Carousel
+ className="gamePage__media"
+ images={images}
+ label={t('game.screenshots', 'Screenshots')}
+ placeholder={
+ <HeroicIcon
+ role="img"
+ aria-label={t('game.heroicLogoAlt', 'Heroic Games Launcher logo')}
+ />
+ }
+ badge={
+ <StoreBadge runner={runner} title={STORE_NAMES[runner] ?? runner} />
+ }
+ />
+ )
+}
+
+export default GameMedia
diff --git a/src/frontend/screens/Game/GamePage/components/GameStats.tsx b/src/frontend/screens/Game/GamePage/components/GameStats.tsx
index 6e3a0d616..06ff62c19 100644
--- a/src/frontend/screens/Game/GamePage/components/GameStats.tsx
+++ b/src/frontend/screens/Game/GamePage/components/GameStats.tsx
@@ -1,14 +1,9 @@
import { useTranslation } from 'react-i18next'
-import { Clock, MonitorPlay } from 'lucide-react'
import { GameInfo } from 'common/types'
-import { StatCard } from 'frontend/components/UI'
+import type { DetailItem } from 'frontend/components/UI/DetailList'
import { hasPlaytime } from 'frontend/hooks/hasPlaytime'
import { getIntlLocale } from 'frontend/helpers'
-interface Props {
- gameInfo: GameInfo
-}
-
const DIVISIONS: { amount: number; unit: Intl.RelativeTimeFormatUnit }[] = [
{ amount: 60, unit: 'second' },
{ amount: 60, unit: 'minute' },
@@ -33,7 +28,10 @@ function formatRelative(date: Date, locale: string) {
return formatter.format(Math.round(duration), 'year')
}
-const GameStats = ({ gameInfo }: Props) => {
+export function usePlayStats(
+ gameInfo: GameInfo,
+ achievementPercentage?: number
+): DetailItem[] {
const { t, i18n } = useTranslation('gamepage')
const { totalPlayed, firstPlayed, lastPlayed } = hasPlaytime(gameInfo)
const locale = getIntlLocale(i18n.language)
@@ -49,35 +47,36 @@ const GameStats = ({ gameInfo }: Props) => {
).format(firstPlayedDate)}`
: undefined
- return (
- <div className="gameStats">
- <StatCard
- surface="none"
- glyph={Clock}
- label={t('game.totalPlayed', 'Time played')}
- value={t('game.hoursPlayedShort', '{{hours}} hours', { hours })}
- title={firstPlayedTitle}
- />
- <StatCard
- surface="none"
- glyph={MonitorPlay}
- label={t('game.lastPlayed', 'Last played')}
- value={
- lastPlayedDate && !Number.isNaN(lastPlayedDate.getTime())
- ? formatRelative(lastPlayedDate, locale)
- : t('game.neverPlayed', 'Never')
- }
- title={
- lastPlayedDate && !Number.isNaN(lastPlayedDate.getTime())
- ? new Intl.DateTimeFormat(locale, {
- dateStyle: 'medium',
- timeStyle: 'short'
- }).format(lastPlayedDate)
- : undefined
- }
- />
- </div>
- )
-}
+ const items: DetailItem[] = [
+ {
+ label: t('game.totalPlayed', 'Time played'),
+ value: t('game.hoursPlayedShort', '{{hours}} hours', { hours }),
+ title: firstPlayedTitle
+ },
+ {
+ label: t('game.lastPlayed', 'Last played'),
+ value:
+ lastPlayedDate && !Number.isNaN(lastPlayedDate.getTime())
+ ? formatRelative(lastPlayedDate, locale)
+ : t('game.neverPlayed', 'Never'),
+ title:
+ lastPlayedDate && !Number.isNaN(lastPlayedDate.getTime())
+ ? new Intl.DateTimeFormat(locale, {
+ dateStyle: 'medium',
+ timeStyle: 'short'
+ }).format(lastPlayedDate)
+ : undefined
+ }
+ ]
-export default GameStats
+ if (achievementPercentage !== undefined) {
+ items.push({
+ label: t('game.achievements', 'Achievements'),
+ value: new Intl.NumberFormat(locale, { style: 'percent' }).format(
+ achievementPercentage / 100
+ )
+ })
+ }
+
+ return items
+}
diff --git a/src/frontend/screens/Game/GamePage/components/InstalledInfo.tsx b/src/frontend/screens/Game/GamePage/components/InstalledInfo.tsx
index d03e7edce..d5a2c99a5 100644
--- a/src/frontend/screens/Game/GamePage/components/InstalledInfo.tsx
+++ b/src/frontend/screens/Game/GamePage/components/InstalledInfo.tsx
@@ -52,7 +52,7 @@ const InstalledInfo = ({ gameInfo }: Props) => {
return (
<div className="installationInfo">
- <DetailList items={items} columns={2} />
+ <DetailList layout="inline" items={items} columns={2} />
</div>
)
}
@@ -151,7 +151,7 @@ const InstalledInfo = ({ gameInfo }: Props) => {
return (
<div className="installationInfo">
- <DetailList items={items} columns={2} />
+ <DetailList layout="inline" items={items} columns={2} />
{cloudSave.menu}
</div>
)
diff --git a/src/frontend/screens/Game/GamePage/components/MainButton.tsx b/src/frontend/screens/Game/GamePage/components/MainButton.tsx
index fd433226b..1d7fd4095 100644
--- a/src/frontend/screens/Game/GamePage/components/MainButton.tsx
+++ b/src/frontend/screens/Game/GamePage/components/MainButton.tsx
@@ -139,7 +139,7 @@ const MainButton = ({ gameInfo, handlePlay, handleInstall }: Props) => {
return {
glyph: X,
label: t('button.queue.remove', 'Remove from Queue'),
- variant: 'danger',
+ variant: 'dangerSubtle',
legacyClass: 'queueIcon'
}
}
@@ -147,7 +147,7 @@ const MainButton = ({ gameInfo, handlePlay, handleInstall }: Props) => {
return {
glyph: Pause,
label: t('button.cancel'),
- variant: 'danger',
+ variant: 'dangerSubtle',
legacyClass: 'cancelIcon'
}
}
diff --git a/src/frontend/screens/Game/GamePage/components/Scores.tsx b/src/frontend/screens/Game/GamePage/components/Scores.tsx
index fc6ace357..13f6d7596 100644
--- a/src/frontend/screens/Game/GamePage/components/Scores.tsx
+++ b/src/frontend/screens/Game/GamePage/components/Scores.tsx
@@ -1,9 +1,10 @@
import { useContext } from 'react'
import { useTranslation } from 'react-i18next'
-import { Gamepad2 } from 'lucide-react'
import { GameInfo } from 'common/types'
import { createNewWindow } from 'frontend/helpers'
-import { Icon, Score } from 'frontend/components/UI'
+import { DetailList } from 'frontend/components/UI'
+import type { DetailItem } from 'frontend/components/UI/DetailList'
+import { ScoreValue } from 'frontend/components/UI/Score'
import GameContext from '../../GameContext'
interface Props {
@@ -12,89 +13,90 @@ interface Props {
const Scores = ({ gameInfo }: Props) => {
const { t } = useTranslation('gamepage')
- const { wikiInfo } = useContext(GameContext)
+ const { wikiInfo, gameExtraInfo, runner, is } = useContext(GameContext)
const pcgamingwiki = wikiInfo?.pcgamingwiki
const applegamingwiki = wikiInfo?.applegamingwiki
const { metacritic, opencritic, igdb } = pcgamingwiki ?? {}
+ const metacriticScore = metacritic?.score || gameExtraInfo?.score
- const hasScores =
- metacritic?.score ||
- opencritic?.score ||
- igdb?.score ||
- applegamingwiki?.crossoverRating
+ const title = gameInfo.overrides?.title || gameInfo.title
+ const clickToOpen = t('info.clickToOpen', 'Click to open')
+
+ const items: DetailItem[] = []
- if (!hasScores) {
- return null
+ if (opencritic?.score) {
+ items.push({
+ label: 'Open Critic',
+ value: <ScoreValue value={opencritic.score} />,
+ title: clickToOpen,
+ onClick: () =>
+ createNewWindow(
+ opencritic.urlid
+ ? `https://opencritic.com/game/${opencritic.urlid}`
+ : `https://opencritic.com/search?criteria=${title}`
+ )
+ })
}
- const title = gameInfo.overrides?.title || gameInfo.title
+ if (metacriticScore) {
+ items.push({
+ label: 'MetaCritic',
+ value: <ScoreValue value={metacriticScore} />,
+ title: clickToOpen,
+ onClick: () =>
+ createNewWindow(
+ metacritic?.urlid
+ ? `https://www.metacritic.com/game/pc/${metacritic.urlid}`
+ : `https://www.metacritic.com/search/all/${title}/results`
+ )
+ })
+ }
+
+ if (igdb?.score) {
+ items.push({
+ label: 'IGDB',
+ value: <ScoreValue value={igdb.score} />,
+ title: clickToOpen,
+ onClick: () =>
+ createNewWindow(
+ igdb.urlid
+ ? `https://www.igdb.com/games/${igdb.urlid}`
+ : `https://www.igdb.com/search?type=1&q=${title}`
+ )
+ })
+ }
+
+ if (applegamingwiki?.crossoverRating) {
+ items.push({
+ label: 'AppleGamingWiki',
+ value: <ScoreValue value={applegamingwiki.crossoverRating} />,
+ title: clickToOpen,
+ onClick: () =>
+ createNewWindow(
+ applegamingwiki.crossoverLink
+ ? `https://www.codeweavers.com/compatibility/crossover/${applegamingwiki.crossoverLink}`
+ : `https://www.codeweavers.com/compatibility?name=${title}&search=app#results`
+ )
+ })
+ }
+
+ const notAvailable = t('info.scoreNotAvailable', 'Not available')
+ const emptyItems: DetailItem[] = [
+ { label: 'Open Critic', value: notAvailable },
+ { label: 'MetaCritic', value: notAvailable }
+ ]
+ if (is.mac && runner !== 'steam') {
+ emptyItems.push({ label: 'AppleGamingWiki', value: notAvailable })
+ }
return (
- <section className="gameScores">
- <h3 className="gameScores__title">
- <Icon glyph={Gamepad2} size="md" />
+ <section className="gameScores gamePage__infoColumn">
+ <h3 className="gamePage__infoTitle">
{t('info.game-scores', 'Game Scores')}
</h3>
- <div className="gameScores__list">
- {opencritic?.score && (
- <Score
- label="Open Critic"
- value={opencritic.score}
- title={t('info.clickToOpen', 'Click to open')}
- onClick={() =>
- createNewWindow(
- opencritic.urlid
- ? `https://opencritic.com/game/${opencritic.urlid}`
- : `https://opencritic.com/search?criteria=${title}`
- )
- }
- />
- )}
- {metacritic?.score && (
- <Score
- label="MetaCritic"
- value={metacritic.score}
- title={t('info.clickToOpen', 'Click to open')}
- onClick={() =>
- createNewWindow(
- metacritic.urlid
- ? `https://www.metacritic.com/game/pc/${metacritic.urlid}`
- : `https://www.metacritic.com/search/all/${title}/results`
- )
- }
- />
- )}
- {igdb?.score && (
- <Score
- label="IGDB"
- value={igdb.score}
- title={t('info.clickToOpen', 'Click to open')}
- onClick={() =>
- createNewWindow(
- metacritic?.urlid
- ? `https://www.igdb.com/games/${metacritic.urlid}`
- : `https://www.igdb.com/search?type=1&q=${title}`
- )
- }
- />
- )}
- {applegamingwiki?.crossoverRating && (
- <Score
- label="AppleGamingWiki"
- value={applegamingwiki.crossoverRating}
- title={t('info.clickToOpen', 'Click to open')}
- onClick={() =>
- createNewWindow(
- applegamingwiki.crossoverLink
- ? `https://www.codeweavers.com/compatibility/crossover/${applegamingwiki.crossoverLink}`
- : `https://www.codeweavers.com/compatibility?name=${title}&search=app#results`
- )
- }
- />
- )}
- </div>
+ <DetailList layout="inline" items={items.length ? items : emptyItems} />
</section>
)
}
diff --git a/src/frontend/screens/Game/GamePage/components/index.tsx b/src/frontend/screens/Game/GamePage/components/index.tsx
index 3fe36fcba..ec2c3cc75 100644
--- a/src/frontend/screens/Game/GamePage/components/index.tsx
+++ b/src/frontend/screens/Game/GamePage/components/index.tsx
@@ -5,7 +5,7 @@ export { default as DownloadSizeInfo } from './DownloadSizeInfo'
export { default as GameActions } from './GameActions'
export { default as GameBadges } from './GameBadges'
export { default as GameDetails } from './GameDetails'
-export { default as GameStats } from './GameStats'
+export { default as GameMedia } from './GameMedia'
export { default as GameStatus } from './GameStatus'
export { default as HLTB } from './HLTB'
export { default as InstalledInfo } from './InstalledInfo'
diff --git a/src/frontend/screens/Game/GamePage/index.css b/src/frontend/screens/Game/GamePage/index.css
index 4df8e3264..2039eb3ab 100644
--- a/src/frontend/screens/Game/GamePage/index.css
+++ b/src/frontend/screens/Game/GamePage/index.css
@@ -1,18 +1,24 @@
.gameConfigContainer {
--game-page-gutter: clamp(16px, 4vw, 48px);
--game-page-max-width: 1280px;
- --game-panel-opacity: 55%;
+ --game-panel-opacity-dark: 0.55;
+ --game-panel-opacity-light: 0.8;
--game-panel-blur: var(--blur-light);
position: relative;
+ height: 100vh;
+ overflow: hidden;
+ isolation: isolate;
+}
+
+.gamePage__scroller {
display: flex;
flex-direction: column;
gap: 24px;
- min-height: 100%;
+ height: 100%;
padding: var(--game-page-gutter);
overflow-y: auto;
overflow-x: hidden;
- isolation: isolate;
}
.gameConfigContainer:has(.UpdateComponent) {
@@ -20,17 +26,17 @@
}
.gameConfigContainer .backgroundImage {
- position: fixed;
+ position: absolute;
z-index: -2;
inset: 0;
- height: 100vh;
+ height: 100%;
width: 100%;
object-fit: cover;
object-position: center top;
}
.gamePage__scrim {
- position: fixed;
+ position: absolute;
z-index: -1;
inset: 0;
background:
@@ -40,23 +46,30 @@
rgba(6, 10, 15, 0.52) 55%,
rgba(6, 10, 15, 0.8) 100%
),
- linear-gradient(90deg, rgba(6, 10, 15, 0.42), transparent 72%);
+ linear-gradient(
+ 90deg,
+ rgba(6, 10, 15, 0.72) 0%,
+ rgba(6, 10, 15, 0.55) 50%,
+ transparent 85%
+ );
pointer-events: none;
}
-.topRowWrapper {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: var(--space-sm);
- width: 100%;
- max-width: var(--game-page-max-width);
- margin: 0 auto;
- z-index: 2;
+.gamePage__scroller::-webkit-scrollbar-thumb {
+ border-color: rgba(6, 10, 15, 0.55);
+ background: color-mix(in oklab, var(--ink-on-overlay) 70%, transparent);
+ background-clip: padding-box;
}
-.App.frameless:not(.fullscreen) .topRowWrapper {
- margin-right: var(--overlay-controls-width);
+.gamePage__scroller::-webkit-scrollbar-thumb:hover {
+ background: color-mix(in oklab, var(--ink-on-overlay) 90%, transparent);
+ background-clip: padding-box;
+}
+
+.gamePage__back {
+ position: relative;
+ z-index: 2;
+ align-self: flex-start;
}
.gamePage__content {
@@ -69,23 +82,44 @@
padding-block-end: var(--space-xl);
}
-.gameConfigContainer .gamePage__hero,
.gameConfigContainer .gamePage__tabs {
- background: color-mix(
- in oklab,
- var(--panel-surface) var(--game-panel-opacity),
- transparent
+ background: oklch(
+ from var(--panel-surface) l c h /
+ clamp(
+ var(--game-panel-opacity-dark),
+ calc(var(--game-panel-opacity-dark) + (l - 0.5) * 0.9),
+ var(--game-panel-opacity-light)
+ )
);
backdrop-filter: blur(var(--game-panel-blur));
}
.gamePage__hero {
+ --hero-ink: var(--ink-on-overlay);
+ --hero-ink-soft: color-mix(
+ in oklab,
+ var(--ink-on-overlay) 88%,
+ var(--color-neutral-300)
+ );
+ --hero-ink-muted: color-mix(in oklab, var(--ink-on-overlay) 78%, transparent);
+
position: relative;
z-index: 2;
display: grid;
- grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
- align-items: start;
- gap: 32px;
+ grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
+ align-items: center;
+ gap: var(--space-3xl-fixed);
+ padding-block: var(--space-xl-fixed);
+}
+
+.gamePage__hero .aboutGame {
+ max-width: 72ch;
+}
+
+.gamePage__hero .aboutGame .summary {
+ gap: var(--space-xs-fixed);
+ color: var(--hero-ink-soft);
+ text-shadow: 0 1px 2px rgba(6, 10, 15, 0.6);
}
.gamePage__heroMain {
@@ -102,7 +136,7 @@
font-weight: var(--bold);
line-height: 1.05;
letter-spacing: -0.02em;
- color: var(--on-panel, var(--text-default));
+ color: var(--hero-ink);
text-align: start;
overflow-wrap: anywhere;
}
@@ -190,82 +224,52 @@
margin-block-end: 8px;
}
+.gameStatus .installProgress .ProgressBar__value {
+ color: var(--hero-ink);
+}
+
.gameStatus__label {
margin: 0;
font-size: var(--body-sm);
- color: var(--on-panel-muted, var(--text-secondary));
+ color: var(--hero-ink-muted);
}
.gameStatus__label--busy {
- color: var(--on-panel-muted, var(--text-secondary));
+ color: var(--hero-ink-muted);
}
.gameStatus__label a {
color: inherit;
}
-.gamePage__heroAside {
- display: flex;
- flex-direction: column;
- align-self: center;
- gap: 16px;
+.gamePage__media {
min-width: 0;
}
-.gameStats {
+.gamePage__infoColumns {
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
- gap: 32px;
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
+ align-items: start;
+ gap: var(--space-xl-fixed) var(--space-3xl-fixed);
}
-.gameScores {
+.gamePage__infoColumn {
display: flex;
flex-direction: column;
- align-items: flex-start;
- gap: 12px;
- width: 100%;
- container-type: inline-size;
- container-name: gameScores;
+ min-width: 0;
}
-.gameScores__title {
- display: inline-flex;
- align-items: center;
- gap: 8px;
- margin: 0;
- font-size: var(--title-sm);
- font-weight: var(--semibold);
+.gamePage__infoTitle {
+ margin: 0 0 var(--space-md-fixed);
+ font-size: var(--title-md);
+ font-weight: var(--bold);
color: var(--on-panel, var(--text-default));
+ text-align: start;
}
-.gameScores__title svg {
- color: var(--text-brand);
-}
-
-.gameScores__list {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- justify-content: flex-start;
- gap: 8px 16px;
-}
-
-.gameScores__list > *:not(:last-child)::after {
- content: '•';
- margin-inline-start: 16px;
- color: var(--text-faint, var(--text-secondary));
-}
-
-@container gameScores (max-width: 380px) {
- .gameScores__list {
- flex-direction: column;
- gap: 8px;
- }
-
- .gameScores__list > *:not(:last-child)::after {
- content: none;
- margin-inline-start: 0;
- }
+.gameScores .Score__value {
+ font-size: inherit;
+ line-height: inherit;
}
.gamePage__tabs {
@@ -276,28 +280,18 @@
gap: 24px;
}
+.gameConfigContainer .gamePage__tabs.Panel--padding-lg {
+ padding-block-start: var(--space-md-fixed);
+}
+
.gamePage__tabs > [role='tabpanel']:empty {
display: none;
}
.overviewTab > div {
- display: grid;
- grid-template-columns: minmax(0, 1.8fr) minmax(280px, 1fr);
- align-items: stretch;
- gap: 32px;
- min-height: 260px;
-}
-
-.overviewTab__main {
display: flex;
flex-direction: column;
- align-items: flex-start;
- gap: 24px;
- min-width: 0;
-}
-
-.overviewTab__main .aboutGame {
- flex: 1;
+ gap: var(--space-2xl-fixed);
}
.aboutGame .summary {
@@ -315,22 +309,6 @@
margin: 0;
}
-.gameDetails__header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12px;
- margin-block-end: 16px;
-}
-
-.gameDetails__title {
- margin: 0;
- font-size: var(--title-md);
- font-weight: var(--bold);
- color: var(--on-panel, var(--text-default));
- text-align: start;
-}
-
.infoTab > div {
display: flex;
flex-direction: column;
@@ -445,29 +423,16 @@
}
.gameConfigContainer .anticheatInfo {
- max-width: none;
+ max-width: 72ch;
margin: 0;
}
-.overviewTab__main .reportProblem {
- margin-block-start: auto;
-}
-
-.gameConfigContainer .wikiLink {
- display: flex;
- align-items: center;
- gap: 8px;
+.overviewTab .reportProblem {
align-self: flex-start;
- margin: 0;
- padding: 10px 16px;
- border-radius: var(--radius-sm);
- background: var(--status-warning);
- color: #000;
}
-.gameConfigContainer .wikiLink a {
- color: #000;
- text-decoration: underline;
+.gameConfigContainer .wikiLink {
+ align-self: stretch;
}
.game-actions {
@@ -526,10 +491,14 @@
}
@container main-content (max-width: 1100px) {
- .gamePage__hero,
- .overviewTab > div {
+ .gamePage__hero {
grid-template-columns: minmax(0, 1fr);
}
+
+ .gamePage__media {
+ width: 100%;
+ max-width: 640px;
+ }
}
@container main-content (max-width: 700px) {
diff --git a/src/frontend/screens/Game/GamePage/index.tsx b/src/frontend/screens/Game/GamePage/index.tsx
index f601e14dc..3deef588f 100644
--- a/src/frontend/screens/Game/GamePage/index.tsx
+++ b/src/frontend/screens/Game/GamePage/index.tsx
@@ -8,14 +8,13 @@ import React, {
useState
} from 'react'
-import { Info } from 'lucide-react'
-
import { getGameInfo, getInstallInfo, sendKill } from 'frontend/helpers'
import { launch, updateGame, install } from 'frontend/helpers/library'
import { Link, useLocation, useParams } from 'react-router-dom'
import { Trans, useTranslation } from 'react-i18next'
import ContextProvider from 'frontend/state/ContextProvider'
import {
+ Alert,
BackButton,
CachedImage,
Panel,
@@ -51,7 +50,7 @@ import {
GameActions,
GameBadges,
GameDetails,
- GameStats,
+ GameMedia,
GameStatus,
HLTB,
InstalledInfo,
@@ -426,10 +425,10 @@ export default React.memo(function GamePage(): JSX.Element | null {
) ?? []
const tabs: TabItem<GameTab>[] = [
- { value: 'overview', label: t('game.about', 'About') },
+ { value: 'overview', label: t('game.info', 'Info') },
{
value: 'info',
- label: t('game.install_info', 'Installation info')
+ label: t('game.installation', 'Installation')
}
]
@@ -440,7 +439,7 @@ export default React.memo(function GamePage(): JSX.Element | null {
if (hasAchievements) {
tabs.push({
value: 'achievements',
- label: `${t('game.achievements', 'Achievements')} · ${achievementPercentage}%`
+ label: t('game.achievements', 'Achievements')
})
}
@@ -462,15 +461,12 @@ export default React.memo(function GamePage(): JSX.Element | null {
let wikiLink = <></>
if (knownFixes && knownFixes.wikiLink) {
wikiLink = (
- <p className="wikiLink">
- <Info />
- <span>
- <Trans key="wikiLink" i18n={i18n}>
- Important information about this game, read this:&nbsp;
- <Link to={knownFixes.wikiLink}>Open page</Link>
- </Trans>
- </span>
- </p>
+ <Alert variant="warning" className="wikiLink">
+ <Trans key="wikiLink" i18n={i18n}>
+ Important information about this game, read this:&nbsp;
+ <Link to={knownFixes.wikiLink}>Open page</Link>
+ </Trans>
+ </Alert>
)
}
@@ -494,97 +490,108 @@ export default React.memo(function GamePage(): JSX.Element | null {
)}
<div className="gamePage__scrim" />
- <div className="topRowWrapper">
+ <div className="gamePage__scroller">
<BackButton
+ className="gamePage__back"
to={backRoute}
label={t('button.backToLibrary', 'Back to library')}
+ iconOnly
/>
- </div>
- <div className="gamePage__content">
- {runner === 'steam' && (
- <SteamLoginBanner appName={appName} failures={steamFailures} />
- )}
- <Panel tone="glass" padding="lg" className="gamePage__hero">
- <div className="gamePage__heroMain">
- <h1 className="gamePage__title">{title}</h1>
- <GameBadges gameInfo={gameInfo} genres={genres} />
-
- <GameActions
- gameInfo={gameInfo}
- handlePlay={handlePlay}
- handleInstall={handleInstall}
- handleUpdate={handleUpdate}
- hasUpdate={hasUpdate}
+ <div className="gamePage__content">
+ {runner === 'steam' && (
+ <SteamLoginBanner
+ appName={appName}
+ failures={steamFailures}
/>
+ )}
+ <section className="gamePage__hero">
+ <div className="gamePage__heroMain">
+ <h1 className="gamePage__title">{title}</h1>
+ <GameBadges gameInfo={gameInfo} genres={genres} />
+ <Description />
- <GameStatus gameInfo={gameInfo} progress={progress} />
- <LaunchOptionSelector showTitle={false} />
- {wikiLink}
- </div>
-
- {!notInstallable && (
- <div className="gamePage__heroAside">
- <GameStats gameInfo={gameInfo} />
+ <GameActions
+ gameInfo={gameInfo}
+ handlePlay={handlePlay}
+ handleInstall={handleInstall}
+ handleUpdate={handleUpdate}
+ hasUpdate={hasUpdate}
+ />
+
+ <GameStatus gameInfo={gameInfo} progress={progress} />
+ <LaunchOptionSelector showTitle={false} />
+ {wikiLink}
</div>
- )}
- </Panel>
-
- <Panel tone="glass" padding="lg" className="gamePage__tabs">
- <Tabs
- items={tabs}
- value={activeTab}
- onChange={setCurrentTab}
- aria-label={t('game.tabs', 'Game information')}
- />
- <TabPanel
- value={activeTab}
- index="overview"
- className="overviewTab"
- >
- <div className="overviewTab__main">
- <Description />
- <Scores gameInfo={gameInfo} />
+ <GameMedia gameInfo={gameInfo} />
+ </section>
+
+ <Panel tone="glass" padding="lg" className="gamePage__tabs">
+ <Tabs
+ items={tabs}
+ value={activeTab}
+ onChange={setCurrentTab}
+ aria-label={t('game.tabs', 'Game information')}
+ />
+
+ <TabPanel
+ value={activeTab}
+ index="overview"
+ className="overviewTab"
+ >
+ <div className="gamePage__infoColumns">
+ <GameDetails
+ gameInfo={gameInfo}
+ showPlayStats={!notInstallable}
+ achievementPercentage={
+ hasAchievements ? achievementPercentage : undefined
+ }
+ />
+ <Scores gameInfo={gameInfo} />
+ </div>
<ReportIssue gameInfo={gameInfo} />
- </div>
- <GameDetails gameInfo={gameInfo} />
- </TabPanel>
-
- <TabPanel value={activeTab} index="info" className="infoTab">
- <DownloadSizeInfo gameInfo={gameInfo} />
- <InstalledInfo gameInfo={gameInfo} />
- </TabPanel>
-
- <TabPanel value={activeTab} index="dlcs" className="dlcsTab">
- <Panel tone="glass" className="installationInfo">
- <DlcList dlcs={dlcs} onChange={() => loadDlcs()} />
- </Panel>
- </TabPanel>
-
- <TabPanel
- value={activeTab}
- index="achievements"
- className="achievementsTab"
- >
- <Achievements achievements={achievements} />
- </TabPanel>
-
- <TabPanel value={activeTab} index="extra" className="extraTab">
- <HLTB />
- <CompatibilityInfo gameInfo={gameInfo} />
- </TabPanel>
-
- <TabPanel
- value={activeTab}
- index="requirements"
- className="requirementsTab"
- >
- <Requirements />
- </TabPanel>
- </Panel>
-
- <Anticheat anticheatInfo={anticheatInfo} />
+ </TabPanel>
+
+ <TabPanel value={activeTab} index="info" className="infoTab">
+ <DownloadSizeInfo gameInfo={gameInfo} />
+ <InstalledInfo gameInfo={gameInfo} />
+ </TabPanel>
+
+ <TabPanel value={activeTab} index="dlcs" className="dlcsTab">
+ <Panel tone="glass" className="installationInfo">
+ <DlcList dlcs={dlcs} onChange={() => loadDlcs()} />
+ </Panel>
+ </TabPanel>
+
+ <TabPanel
+ value={activeTab}
+ index="achievements"
+ className="achievementsTab"
+ >
+ <Achievements achievements={achievements} />
+ </TabPanel>
+
+ <TabPanel
+ value={activeTab}
+ index="extra"
+ className="extraTab"
+ >
+ <HLTB />
+ <CompatibilityInfo gameInfo={gameInfo} />
+ </TabPanel>
+
+ <TabPanel
+ value={activeTab}
+ index="requirements"
+ className="requirementsTab"
+ >
+ <Requirements />
+ </TabPanel>
+ </Panel>
+
+ <Anticheat anticheatInfo={anticheatInfo} />
+ </div>
</div>
</div>
</GameContext.Provider>
diff --git a/src/frontend/screens/Game/GameRequirements/index.tsx b/src/frontend/screens/Game/GameRequirements/index.tsx
index db93ecc19..df31ac19b 100644
--- a/src/frontend/screens/Game/GameRequirements/index.tsx
+++ b/src/frontend/screens/Game/GameRequirements/index.tsx
@@ -84,6 +84,7 @@ function GameRequirements({ reqs }: Props) {
>
<h3 className="gameRequirements__title">{t('specs.minimum')}</h3>
<DetailList
+ layout="inline"
items={toItems(specs, 'minimum')}
className="gameRequirements__list"
/>
@@ -96,6 +97,7 @@ function GameRequirements({ reqs }: Props) {
>
<h3 className="gameRequirements__title">{t('specs.recommended')}</h3>
<DetailList
+ layout="inline"
items={toItems(specs, 'recommended')}
className="gameRequirements__list"
/>
diff --git a/src/frontend/themes.scss b/src/frontend/themes.scss
index a9d52a854..f21ad8e2c 100644
--- a/src/frontend/themes.scss
+++ b/src/frontend/themes.scss
@@ -781,10 +781,10 @@ body.candy-light {
}
body.vampyria {
- --accent: #e01f45;
+ --accent: #fc425b;
--logo-ink: #000000;
--accent-overlay: #ff4d6e;
- --navbar-accent: #e01f45;
+ --navbar-accent: #fc425b;
--background: #1a0608;
--body-background: var(--background);
--background-darker: var(--body-background);
@@ -800,7 +800,7 @@ body.vampyria {
--input-background: #2a080e;
--modal-background: var(--body-background);
--modal-border: #3a0c14;
- --primary: #e01f45;
+ --primary: #fc425b;
--primary-hover: #ff4d6e;
--success: #5fcf84;
--success-hover: #7ddc9b;