Skip to content

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

[UI] Install dialog with tabs for components, DLCs and Wine (#6205)

Flávio Fearnbfd99de08329
diff --git a/public/locales/en/gamepage.json b/public/locales/en/gamepage.json
index 2ded88ecd..d0c868030 100644
--- a/public/locales/en/gamepage.json
+++ b/public/locales/en/gamepage.json
@@ -242,6 +242,9 @@
"ok": "Ok",
"title": "Anticheat Broken/Denied"
},
+ "components": {
+ "required": "Required"
+ },
"disk-space-left": "Space Available",
"flatpak-path-not-writtable": "Error: Sandbox access not granted to this path, data loss will occur.",
"free": "free",
@@ -252,6 +255,13 @@
"space-after-install": "After Install",
"steam-no-libraries": "No Steam library folders found — add a drive in Steam first.",
"steam-path": "Install Path (Steam library)",
+ "tabs": {
+ "ariaLabel": "Install sections",
+ "components": "Components",
+ "dlcs": "DLCs",
+ "installation": "Installation",
+ "wine": "Wine"
+ },
"wineprefix": "WinePrefix",
"wineversion": "Wine version"
},
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index 250394064..4684bf26a 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -969,6 +969,16 @@
"message": "Wine uses what is called a WINEPREFIX to encapsulate windows applications. This prefix contains the Wine configuration files and a reproduction of the file hierarchy of C: (the main disk on a windows OS). In this reproduction of the C: drive, your game save files and dependencies installed via winetricks are stored."
}
},
+ "install": {
+ "anticheat": {
+ "details": "Details",
+ "hideDetails": "Hide details"
+ },
+ "dlc": {
+ "selectAllDescription": "Select every DLC available for this game.",
+ "title": "Select to install"
+ }
+ },
"label": {
"loading": "Loading"
},
@@ -1994,16 +2004,19 @@
},
"zoom": {
"collections": {
- "back": "Back",
"changePlatform": "Change platform",
+ "close": "Close",
"description": "This product includes more than one file. Pick what you want to install.",
"extrasGroup": "Extras",
"extrasSummary_one": "{{count}} files · {{size}}",
"extrasSummary_other": "{{count}} files · {{size}}",
"gameGroup": "Game files",
+ "loadError": "Could not load the files.",
+ "loading": "Loading files…",
"noBuild": "No game files are available for this platform.",
"noBuildHint": "Choose another platform to see its files.",
"noFiles": "This product has no files to install.",
+ "retry": "Try again",
"selectedTotal": "Selected: {{size}}",
"selectOne": "Select at least one game file to continue.",
"title": "Select files to install"
diff --git a/src/common/__tests__/zoomFiles.test.ts b/src/common/__tests__/zoomFiles.test.ts
new file mode 100644
index 000000000..5cf6d9156
--- /dev/null
+++ b/src/common/__tests__/zoomFiles.test.ts
@@ -0,0 +1,21 @@
+import { canInstallZoomSelection } from '../zoomFiles'
+
+const files = {
+ game: [{ id: 'game-a' }],
+ extras: [{ id: 'extra-a' }]
+} as unknown as Parameters<typeof canInstallZoomSelection>[0]
+
+describe('canInstallZoomSelection', () => {
+ it('requires a loaded fetch without an error', () => {
+ expect(canInstallZoomSelection(files, ['game-a'], null, true)).toBe(true)
+ expect(canInstallZoomSelection(files, ['game-a'], null, false)).toBe(false)
+ expect(canInstallZoomSelection(files, ['game-a'], 'failed', true)).toBe(
+ false
+ )
+ })
+
+ it('requires a selected game file', () => {
+ expect(canInstallZoomSelection(files, ['extra-a'], null, true)).toBe(false)
+ expect(canInstallZoomSelection(files, [], null, true)).toBe(false)
+ })
+})
diff --git a/src/common/zoomFiles.ts b/src/common/zoomFiles.ts
index 904c12536..d0b575248 100644
--- a/src/common/zoomFiles.ts
+++ b/src/common/zoomFiles.ts
@@ -87,3 +87,15 @@ export function zoomSelectionDefaults(
return files.game.map((file) => file.id)
}
+
+// The install modal may keep the previous file list around while a reload
+// fails. Only allow install when the current fetch succeeded and the list has
+// a selected game file.
+export function canInstallZoomSelection(
+ files: ZoomFileGroups,
+ selectedIds: string[],
+ error: string | null | undefined,
+ loaded: boolean
+): boolean {
+ return loaded && !error && hasSelectedGameFile(files, selectedIds)
+}
diff --git a/src/frontend/components/UI/Anticheat/index.scss b/src/frontend/components/UI/Anticheat/index.scss
index 7a27e349e..aedb42dd7 100644
--- a/src/frontend/components/UI/Anticheat/index.scss
+++ b/src/frontend/components/UI/Anticheat/index.scss
@@ -10,3 +10,19 @@
.anticheatInfo .DetailList {
margin-top: var(--space-2xs);
}
+
+.anticheatInfo--compact {
+ padding-block: var(--space-sm);
+}
+
+.anticheatInfo--compact .anticheatInfo__summary {
+ display: block;
+}
+
+.anticheatInfo__detailsToggle {
+ margin-top: var(--space-xs);
+}
+
+.anticheatInfo__details {
+ margin-top: var(--space-sm);
+}
diff --git a/src/frontend/components/UI/Anticheat/index.stories.tsx b/src/frontend/components/UI/Anticheat/index.stories.tsx
index d97259d01..2d2a13de1 100644
--- a/src/frontend/components/UI/Anticheat/index.stories.tsx
+++ b/src/frontend/components/UI/Anticheat/index.stories.tsx
@@ -63,6 +63,20 @@ export const NothingWhenUnknown: Story = {
}
}
+export const CompactExpandedShowsOneNotice: Story = {
+ args: {
+ compact: true,
+ anticheatInfo: { ...base, status: 'Broken' }
+ },
+ play: async ({ canvas, userEvent }) => {
+ await userEvent.click(canvas.getByRole('button', { name: 'Details' }))
+
+ await expect(
+ canvas.getAllByText(/Multiplayer features may not work/)
+ ).toHaveLength(1)
+ }
+}
+
export const UsesTheAlertComponent: Story = {
play: async ({ canvasElement }) => {
await expect(canvasElement.querySelector('.Alert')).not.toBeNull()
diff --git a/src/frontend/components/UI/Anticheat/index.tsx b/src/frontend/components/UI/Anticheat/index.tsx
index 7baf104c3..5c803ca08 100644
--- a/src/frontend/components/UI/Anticheat/index.tsx
+++ b/src/frontend/components/UI/Anticheat/index.tsx
@@ -1,14 +1,16 @@
-import { MouseEvent, useContext } from 'react'
+import { MouseEvent, useContext, useId, useState } from 'react'
import { AntiCheatInfo } from 'common/types'
import { createNewWindow } from 'frontend/helpers'
import { useTranslation } from 'react-i18next'
import ContextProvider from 'frontend/state/ContextProvider'
import './index.scss'
import Alert from '../Alert'
+import Button from '../Button'
import DetailList from '../DetailList'
type Props = {
anticheatInfo: AntiCheatInfo | null
+ compact?: boolean
}
const awacyUrl = 'https://areweanticheatyet.com/'
@@ -21,9 +23,11 @@ const VARIANTS = {
Denied: 'error'
} as const
-export default function Anticheat({ anticheatInfo }: Props) {
+export default function Anticheat({ anticheatInfo, compact = false }: Props) {
const { t } = useTranslation()
const { platform } = useContext(ContextProvider)
+ const [expanded, setExpanded] = useState(!compact)
+ const detailsId = useId()
if (!anticheatInfo) {
return null
@@ -84,12 +88,8 @@ export default function Anticheat({ anticheatInfo }: Props) {
})
}
- return (
- <Alert
- className="anticheatInfo"
- title={t('anticheat.title', 'This game includes anticheat software')}
- variant={variant}
- >
+ const body = (
+ <>
{mayNotWork && (
<p className="anticheatInfo__note">
{t(
@@ -99,6 +99,53 @@ export default function Anticheat({ anticheatInfo }: Props) {
</p>
)}
<DetailList layout="inline" items={items} />
+ </>
+ )
+
+ if (compact) {
+ return (
+ <Alert
+ className="anticheatInfo anticheatInfo--compact"
+ title={t('anticheat.title', 'This game includes anticheat software')}
+ variant={variant}
+ >
+ {mayNotWork && !expanded && (
+ <span className="anticheatInfo__summary">
+ {t(
+ 'anticheat.multiplayer_may_not_work',
+ 'Multiplayer features may not work due to denied or broken anticheat support.'
+ )}
+ </span>
+ )}
+ <Button
+ variant="link"
+ className="anticheatInfo__detailsToggle"
+ aria-expanded={expanded}
+ aria-controls={detailsId}
+ onClick={() => setExpanded((value) => !value)}
+ >
+ {expanded
+ ? t('install.anticheat.hideDetails', 'Hide details')
+ : t('install.anticheat.details', 'Details')}
+ </Button>
+ <div
+ id={detailsId}
+ className="anticheatInfo__details"
+ hidden={!expanded}
+ >
+ {body}
+ </div>
+ </Alert>
+ )
+ }
+
+ return (
+ <Alert
+ className="anticheatInfo"
+ title={t('anticheat.title', 'This game includes anticheat software')}
+ variant={variant}
+ >
+ {body}
</Alert>
)
}
diff --git a/src/frontend/components/UI/Modal/components/ModalHeader.tsx b/src/frontend/components/UI/Modal/components/ModalHeader.tsx
index 79fc5bc30..5daa50bed 100644
--- a/src/frontend/components/UI/Modal/components/ModalHeader.tsx
+++ b/src/frontend/components/UI/Modal/components/ModalHeader.tsx
@@ -4,13 +4,16 @@ import classNames from 'classnames'
interface ModalHeaderProps {
children: ReactNode
className?: string
+ meta?: ReactNode
}
export const ModalHeader: React.FC<ModalHeaderProps> = ({
children,
- className
+ className,
+ meta
}) => (
<header className={classNames('Modal__header', className)}>
<h2 className="Modal__title">{children}</h2>
+ {meta && <div className="Modal__meta">{meta}</div>}
</header>
)
diff --git a/src/frontend/components/UI/Modal/index.css b/src/frontend/components/UI/Modal/index.css
index 67de9e1df..be4c21262 100644
--- a/src/frontend/components/UI/Modal/index.css
+++ b/src/frontend/components/UI/Modal/index.css
@@ -51,11 +51,23 @@
}
.Modal__header {
+ display: flex;
flex: 0 0 auto;
+ flex-wrap: wrap;
+ align-items: baseline;
+ gap: var(--space-sm) var(--space-md);
padding: var(--modal-padding-block) calc(var(--modal-padding-inline) + 24px) 0
var(--modal-padding-inline);
}
+.Modal__meta {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: var(--space-sm);
+ margin-inline-start: auto;
+}
+
.Modal__title {
margin: 0;
font-size: var(--text-xl);
diff --git a/src/frontend/components/UI/TabPanel/__tests__/TabPanel.test.tsx b/src/frontend/components/UI/TabPanel/__tests__/TabPanel.test.tsx
new file mode 100644
index 000000000..dfb1ffbf2
--- /dev/null
+++ b/src/frontend/components/UI/TabPanel/__tests__/TabPanel.test.tsx
@@ -0,0 +1,28 @@
+/**
+ * @jest-environment jsdom
+ */
+import { render, screen } from '@testing-library/react'
+import TabPanel from '..'
+
+describe('TabPanel keepMounted', () => {
+ it('keeps hidden children mounted when requested', () => {
+ const { container } = render(
+ <TabPanel value="one" index="two" keepMounted>
+ <button>Hidden control</button>
+ </TabPanel>
+ )
+
+ expect(screen.getByText('Hidden control')).toBeTruthy()
+ expect(container.firstElementChild?.hasAttribute('hidden')).toBe(true)
+ })
+
+ it('does not mount hidden children by default', () => {
+ render(
+ <TabPanel value="one" index="two">
+ <button>Hidden control</button>
+ </TabPanel>
+ )
+
+ expect(screen.queryByText('Hidden control')).toBeNull()
+ })
+})
diff --git a/src/frontend/components/UI/TabPanel/index.stories.tsx b/src/frontend/components/UI/TabPanel/index.stories.tsx
index 558dda66c..1aaa4ed15 100644
--- a/src/frontend/components/UI/TabPanel/index.stories.tsx
+++ b/src/frontend/components/UI/TabPanel/index.stories.tsx
@@ -32,7 +32,9 @@ export const Selected: Story = {}
export const NotSelected: Story = {
args: { value: 'wine' },
play: async ({ canvas }) => {
- await expect(canvas.getByRole('tabpanel')).toBeEmptyDOMElement()
+ const panel = canvas.getByRole('tabpanel', { hidden: true })
+ await expect(panel).toHaveAttribute('hidden')
+ await expect(panel).toBeEmptyDOMElement()
}
}
diff --git a/src/frontend/components/UI/TabPanel/index.tsx b/src/frontend/components/UI/TabPanel/index.tsx
index b4ba26525..1fe67059a 100644
--- a/src/frontend/components/UI/TabPanel/index.tsx
+++ b/src/frontend/components/UI/TabPanel/index.tsx
@@ -4,19 +4,36 @@ type TabPanelProps = HTMLProps<HTMLDivElement> & {
children?: React.ReactNode
index: string
value: string
+ // Must match the idPrefix passed to the Tabs that controls this panel.
+ idPrefix?: string
+ // Keep the children mounted while the panel is hidden, for panels whose
+ // children initialize state needed by the dialog.
+ keepMounted?: boolean
}
function TabPanel(props: Readonly<TabPanelProps>) {
- const { children, value, index, ...other } = props
+ const {
+ children,
+ value,
+ index,
+ idPrefix = 'tab',
+ keepMounted = false,
+ ...other
+ } = props
return (
<div
role="tabpanel"
- id={`tabpanel-${index}`}
- aria-labelledby={`tab-${index}`}
+ id={`${idPrefix}panel-${index}`}
+ aria-labelledby={`${idPrefix}-${index}`}
+ hidden={value !== index}
{...other}
>
- {value === index && <div>{children}</div>}
+ {keepMounted ? (
+ <div hidden={value !== index}>{children}</div>
+ ) : (
+ value === index && <div>{children}</div>
+ )}
</div>
)
}
diff --git a/src/frontend/components/UI/Tabs/__tests__/Tabs.test.tsx b/src/frontend/components/UI/Tabs/__tests__/Tabs.test.tsx
new file mode 100644
index 000000000..74bf6f816
--- /dev/null
+++ b/src/frontend/components/UI/Tabs/__tests__/Tabs.test.tsx
@@ -0,0 +1,89 @@
+/**
+ * @jest-environment jsdom
+ */
+import { fireEvent, render, screen } from '@testing-library/react'
+import Tabs from '..'
+
+jest.mock('../index.css', () => ({}))
+jest.mock('../../Icon/index.css', () => ({}))
+
+const items = [
+ { value: 'one', label: 'One' },
+ { value: 'two', label: 'Two' },
+ { value: 'three', label: 'Three' }
+]
+
+describe('Tabs keyboard navigation', () => {
+ it('moves focus and activates with arrows in auto mode', () => {
+ const onChange = jest.fn()
+ render(
+ <Tabs items={items} value="one" onChange={onChange} idPrefix="test" />
+ )
+
+ const first = screen.getByRole('tab', { name: 'One' })
+ const second = screen.getByRole('tab', { name: 'Two' })
+
+ expect(first.getAttribute('tabindex')).toBe('0')
+ expect(second.getAttribute('tabindex')).toBe('-1')
+ expect(first.getAttribute('id')).toBe('test-one')
+ expect(first.getAttribute('aria-controls')).toBe('testpanel-one')
+
+ fireEvent.keyDown(first, { key: 'ArrowRight' })
+ fireEvent.keyDown(second, { key: 'ArrowRight' })
+
+ expect(onChange).toHaveBeenLastCalledWith('three')
+ expect(document.activeElement).toBe(
+ screen.getByRole('tab', { name: 'Three' })
+ )
+
+ fireEvent.keyDown(screen.getByRole('tab', { name: 'Three' }), {
+ key: 'ArrowLeft'
+ })
+
+ expect(onChange).toHaveBeenLastCalledWith('two')
+ expect(document.activeElement).toBe(second)
+ })
+
+ it('supports Home and End', () => {
+ const onChange = jest.fn()
+ render(
+ <Tabs items={items} value="two" onChange={onChange} idPrefix="test" />
+ )
+
+ const middle = screen.getByRole('tab', { name: 'Two' })
+ const last = screen.getByRole('tab', { name: 'Three' })
+
+ fireEvent.keyDown(middle, { key: 'End' })
+ expect(onChange).toHaveBeenLastCalledWith('three')
+ expect(document.activeElement).toBe(last)
+
+ fireEvent.keyDown(last, { key: 'Home' })
+ expect(onChange).toHaveBeenLastCalledWith('one')
+ })
+
+ it('only moves focus in manual mode', () => {
+ const onChange = jest.fn()
+ render(
+ <Tabs
+ items={items}
+ value="one"
+ onChange={onChange}
+ idPrefix="test"
+ activation="manual"
+ />
+ )
+
+ const first = screen.getByRole('tab', { name: 'One' })
+ const second = screen.getByRole('tab', { name: 'Two' })
+ const third = screen.getByRole('tab', { name: 'Three' })
+
+ fireEvent.keyDown(first, { key: 'ArrowRight' })
+ fireEvent.keyDown(second, { key: 'ArrowRight' })
+
+ expect(onChange).not.toHaveBeenCalled()
+ expect(document.activeElement).toBe(third)
+
+ fireEvent.keyDown(third, { key: 'ArrowLeft' })
+ expect(document.activeElement).toBe(second)
+ })
+})
diff --git a/src/frontend/components/UI/Tabs/index.tsx b/src/frontend/components/UI/Tabs/index.tsx
index 530d4849d..1d718614f 100644
--- a/src/frontend/components/UI/Tabs/index.tsx
+++ b/src/frontend/components/UI/Tabs/index.tsx
@@ -1,3 +1,4 @@
+import { KeyboardEvent, useRef } from 'react'
import type { LucideIcon } from 'lucide-react'
import classNames from 'classnames'
import Icon from '../Icon'
@@ -9,12 +10,18 @@ export interface TabItem<T extends string> {
glyph?: LucideIcon
}
+type TabActivation = 'auto' | 'manual'
+
interface TabsProps<T extends string> {
items: TabItem<T>[]
value: T
onChange: (value: T) => void
className?: string
'aria-label'?: string
+ // Prefix for the tab and tabpanel ids. The default keeps the historical ids.
+ idPrefix?: string
+ // `auto` activates a tab when arrowing to it; `manual` only moves focus.
+ activation?: TabActivation
}
export default function Tabs<T extends string>({
@@ -22,31 +29,89 @@ export default function Tabs<T extends string>({
value,
onChange,
className,
+ idPrefix = 'tab',
+ activation = 'auto',
'aria-label': ariaLabel
}: TabsProps<T>) {
+ const tabsRef = useRef<Array<HTMLButtonElement | null>>([])
+
+ const focusTab = (index: number) => {
+ const next = items[index]
+ if (!next) return
+
+ tabsRef.current[index]?.focus()
+ if (activation === 'auto') {
+ onChange(next.value)
+ }
+ }
+
+ const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
+ // In manual mode `value` does not follow focus, so start from the tab that
+ // actually has focus. The event target and selected value are fallbacks.
+ const focused = tabsRef.current.findIndex(
+ (tab) => tab === document.activeElement
+ )
+ const target = (event.target as HTMLElement).closest('[role="tab"]')
+ const targetIndex = tabsRef.current.findIndex((tab) => tab === target)
+ const selected = items.findIndex((item) => item.value === value)
+ const current =
+ focused !== -1 ? focused : targetIndex !== -1 ? targetIndex : selected
+ if (current === -1) return
+
+ let next = current
+ switch (event.key) {
+ case 'ArrowRight':
+ next = (current + 1) % items.length
+ break
+ case 'ArrowLeft':
+ next = (current - 1 + items.length) % items.length
+ break
+ case 'Home':
+ next = 0
+ break
+ case 'End':
+ next = items.length - 1
+ break
+ default:
+ return
+ }
+
+ event.preventDefault()
+ focusTab(next)
+ }
+
return (
<div
className={classNames('Tabs', 'scrollbar--none', className)}
role="tablist"
aria-label={ariaLabel}
+ onKeyDown={onKeyDown}
>
- {items.map((item) => (
- <button
- key={item.value}
- type="button"
- role="tab"
- id={`tab-${item.value}`}
- aria-selected={item.value === value}
- aria-controls={`tabpanel-${item.value}`}
- className={classNames('Tabs__tab', {
- 'Tabs__tab--active': item.value === value
- })}
- onClick={() => onChange(item.value)}
- >
- {item.glyph && <Icon glyph={item.glyph} size="sm" />}
- {item.label}
- </button>
- ))}
+ {items.map((item, index) => {
+ const selected = item.value === value
+
+ return (
+ <button
+ key={item.value}
+ ref={(element) => {
+ tabsRef.current[index] = element
+ }}
+ type="button"
+ role="tab"
+ id={`${idPrefix}-${item.value}`}
+ aria-selected={selected}
+ aria-controls={`${idPrefix}panel-${item.value}`}
+ tabIndex={selected ? 0 : -1}
+ className={classNames('Tabs__tab', {
+ 'Tabs__tab--active': selected
+ })}
+ onClick={() => onChange(item.value)}
+ >
+ {item.glyph && <Icon glyph={item.glyph} size="sm" />}
+ {item.label}
+ </button>
+ )
+ })}
</div>
)
}
diff --git a/src/frontend/components/UI/ToggleSwitch/index.css b/src/frontend/components/UI/ToggleSwitch/index.css
index 0aabe7004..a0564f2b8 100644
--- a/src/frontend/components/UI/ToggleSwitch/index.css
+++ b/src/frontend/components/UI/ToggleSwitch/index.css
@@ -60,6 +60,55 @@
background: var(--ink-on-accent, var(--background-darker));
}
+/* A checkbox that controls a list is mixed: partially filled track, and the
+ thumb keeps its position with a dash instead of the "on" accent dot. */
+.ToggleSwitch__input:indeterminate + .ToggleSwitch__track {
+ background: color-mix(
+ in oklab,
+ var(--navbar-accent, var(--accent)) 32%,
+ var(--input-background)
+ );
+ border-color: var(--navbar-accent, var(--accent));
+}
+
+.ToggleSwitch__input:indeterminate + .ToggleSwitch__track .ToggleSwitch__thumb {
+ position: relative;
+ transform: none;
+ background: var(--navbar-accent, var(--accent));
+}
+
+.ToggleSwitch__input:indeterminate
+ + .ToggleSwitch__track
+ .ToggleSwitch__thumb::after {
+ content: '';
+ position: absolute;
+ inset-block-start: 50%;
+ inset-inline: 5px;
+ height: 2px;
+ border-radius: 1px;
+ background: var(--ink-on-accent, var(--background-darker));
+ transform: translateY(-50%);
+}
+
+@media (forced-colors: active) {
+ .ToggleSwitch__input:indeterminate + .ToggleSwitch__track {
+ background: Canvas;
+ border-color: CanvasText;
+ }
+
+ .ToggleSwitch__input:indeterminate
+ + .ToggleSwitch__track
+ .ToggleSwitch__thumb {
+ background: CanvasText;
+ }
+
+ .ToggleSwitch__input:indeterminate
+ + .ToggleSwitch__track
+ .ToggleSwitch__thumb::after {
+ background: Canvas;
+ }
+}
+
.isRTL
.ToggleSwitch__input:checked
+ .ToggleSwitch__track
diff --git a/src/frontend/components/UI/ToggleSwitch/index.stories.tsx b/src/frontend/components/UI/ToggleSwitch/index.stories.tsx
index ab84dede4..41edb4748 100644
--- a/src/frontend/components/UI/ToggleSwitch/index.stories.tsx
+++ b/src/frontend/components/UI/ToggleSwitch/index.stories.tsx
@@ -41,6 +41,16 @@ export const WithInfo: Story = {
}
}
+export const Indeterminate: Story = {
+ args: { indeterminate: true },
+ play: async ({ canvas }) => {
+ const toggle = canvas.getByRole('checkbox')
+
+ await expect(toggle).toHaveAttribute('aria-checked', 'mixed')
+ await expect((toggle as HTMLInputElement).indeterminate).toBe(true)
+ }
+}
+
function ControlledToggle() {
const [value, setValue] = useState(false)
diff --git a/src/frontend/components/UI/ToggleSwitch/index.tsx b/src/frontend/components/UI/ToggleSwitch/index.tsx
index 9664e68a0..c9dd7bcd4 100644
--- a/src/frontend/components/UI/ToggleSwitch/index.tsx
+++ b/src/frontend/components/UI/ToggleSwitch/index.tsx
@@ -1,5 +1,5 @@
import classNames from 'classnames'
-import { ChangeEventHandler, ReactNode } from 'react'
+import { ChangeEventHandler, ReactNode, useEffect, useRef } from 'react'
import InfoTooltip from '../InfoTooltip'
import SettingRow from '../SettingRow'
import './index.css'
@@ -14,6 +14,8 @@ interface Props {
description?: string
info?: ReactNode
fading?: boolean
+ // Shows the mixed state of a checkbox that controls a list of items.
+ indeterminate?: boolean
}
export default function ToggleSwitch({
@@ -25,10 +27,18 @@ export default function ToggleSwitch({
extraClass,
description,
info,
- fading
+ fading,
+ indeterminate = false
}: Props) {
+ const inputRef = useRef<HTMLInputElement>(null)
const infoAsDescription = !description && info
+ useEffect(() => {
+ if (inputRef.current) {
+ inputRef.current.indeterminate = indeterminate
+ }
+ }, [indeterminate])
+
return (
<SettingRow
label={title}
@@ -44,12 +54,14 @@ export default function ToggleSwitch({
})}
>
<input
+ ref={inputRef}
id={htmlId}
disabled={disabled}
checked={Boolean(value)}
type="checkbox"
onChange={handleChange}
aria-label={title}
+ aria-checked={indeterminate ? 'mixed' : undefined}
className="ToggleSwitch__input hiddenCheckbox"
/>
<label className="ToggleSwitch__track" htmlFor={htmlId} tabIndex={-1}>
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/DLCDownloadListing.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/DLCDownloadListing.tsx
index 23e5a89fe..3c5c45950 100644
--- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/DLCDownloadListing.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/DLCDownloadListing.tsx
@@ -1,7 +1,9 @@
-import React, { useEffect, useState } from 'react'
+import React from 'react'
import ToggleSwitch from 'frontend/components/UI/ToggleSwitch'
+import SettingsCard from 'frontend/components/UI/SettingsCard'
import { useTranslation } from 'react-i18next'
import { DLCInfo } from 'common/types/legendary'
+import { DlcMasterState, getDlcMasterState, toggleAllDlcs } from './installTabs'
interface Props {
DLCList: DLCInfo[]
@@ -15,70 +17,55 @@ const DLCDownloadListing: React.FC<Props> = ({
dlcsToInstall
}) => {
const { t } = useTranslation()
- const [installAllDlcs, setInstallAllDlcs] = useState(false)
if (!DLCList) {
return null
}
- useEffect(() => {
- setInstallAllDlcs(dlcsToInstall.length === DLCList.length)
- }, [dlcsToInstall])
+ const allIds = DLCList.map(({ app_name }) => app_name)
+ const masterState: DlcMasterState = getDlcMasterState(dlcsToInstall, allIds)
const handleAllDlcs = () => {
- setInstallAllDlcs(!installAllDlcs)
- if (!installAllDlcs) {
- setDlcsToInstall(DLCList.map(({ app_name }) => app_name))
- }
-
- if (installAllDlcs) {
- setDlcsToInstall([])
- }
+ setDlcsToInstall(toggleAllDlcs(masterState, allIds))
}
- const handleDlcToggle = (index: number) => {
- const { app_name } = DLCList[index]
+ const handleDlcToggle = (appName: string) => {
const newDlcsToInstall = [...dlcsToInstall]
- if (newDlcsToInstall.includes(app_name)) {
- newDlcsToInstall.splice(newDlcsToInstall.indexOf(app_name), 1)
+ if (newDlcsToInstall.includes(appName)) {
+ newDlcsToInstall.splice(newDlcsToInstall.indexOf(appName), 1)
} else {
- newDlcsToInstall.push(app_name)
+ newDlcsToInstall.push(appName)
}
setDlcsToInstall(newDlcsToInstall)
}
return (
- <div className="InstallModal__dlcs">
- <label
- className="InstallModal__toggle toggleWrapper"
- htmlFor="allDlcsSwitch"
- >
+ <SettingsCard title={t('install.dlc.title', 'Select to install')}>
+ <div className="InstallModal__dlcMaster">
<ToggleSwitch
htmlId="allDlcsSwitch"
- value={installAllDlcs}
- handleChange={() => handleAllDlcs()}
+ value={masterState === 'all'}
+ indeterminate={masterState === 'partial'}
+ handleChange={handleAllDlcs}
title={t('dlc.installDlcs', 'Install all DLCs')}
+ description={t(
+ 'install.dlc.selectAllDescription',
+ 'Install every DLC available for this game.'
+ )}
/>
- </label>
+ </div>
<div className="InstallModal__dlcsList">
- {DLCList?.map(({ title, app_name }, index) => (
- <label
- key={title}
- className="InstallModal__toggle toggleWrapper"
+ {DLCList.map(({ title, app_name }) => (
+ <ToggleSwitch
+ key={app_name}
+ htmlId={`dlcSelector-${app_name}`}
+ value={dlcsToInstall.includes(app_name)}
title={title}
- htmlFor={`dlcSelector-${index}`}
- >
- <ToggleSwitch
- htmlId={`dlcSelector-${index}`}
- value={dlcsToInstall.includes(app_name)}
- title={title}
- extraClass="InstallModal__toggle--sdl"
- handleChange={() => handleDlcToggle(index)}
- />
- </label>
+ handleChange={() => handleDlcToggle(app_name)}
+ />
))}
</div>
- </div>
+ </SettingsCard>
)
}
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx
index 17aa91985..230b06f10 100644
--- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/ZoomCollections.tsx
@@ -1,22 +1,30 @@
import { useTranslation } from 'react-i18next'
+import { ChevronDown } from 'lucide-react'
import { ZoomDownloadFile } from 'common/types/zoom'
import {
- hasSelectedGameFile,
selectedZoomFileGroups,
ZoomFileGroups,
zoomFilesBytes
} from 'common/zoomFiles'
import { formatSize } from 'common/format'
import { useDisplayUnits } from 'frontend/state/DisplayUnits'
+import Alert from 'frontend/components/UI/Alert'
import Button from 'frontend/components/UI/Button'
+import Icon from 'frontend/components/UI/Icon'
+import SettingsCard from 'frontend/components/UI/SettingsCard'
+
+export type ZoomCollectionsStatus = 'loading' | 'error' | 'empty' | 'ready'
interface Props {
files: ZoomFileGroups
selectedIds: string[]
+ status: ZoomCollectionsStatus
+ error?: string | null
onToggle: (fileId: string) => void
+ onRetry: () => void
canChangePlatform: boolean
onChangePlatform: () => void
- onBack: () => void
+ onClose: () => void
}
function FileRow({
@@ -55,27 +63,64 @@ function FileRow({
export default function ZoomCollections({
files,
selectedIds,
+ status,
+ error,
onToggle,
+ onRetry,
canChangePlatform,
onChangePlatform,
- onBack
+ onClose
}: Props) {
const { t } = useTranslation()
const units = useDisplayUnits((state) => state.units)
+ const title = t('zoom.collections.title', 'Select files to install')
+ const description = t(
+ 'zoom.collections.description',
+ 'This product includes more than one file. Pick what you want to install.'
+ )
+
+ if (status === 'loading') {
+ return (
+ <SettingsCard className="ZoomCollections" title={title}>
+ <p className="ZoomCollections__loading" role="status">
+ {t('zoom.collections.loading', 'Loading files…')}
+ </p>
+ </SettingsCard>
+ )
+ }
+
+ if (status === 'error') {
+ return (
+ <SettingsCard className="ZoomCollections" title={title}>
+ <Alert variant="error">
+ {error ||
+ t('zoom.collections.loadError', 'Could not load the files.')}
+ </Alert>
+ <div className="ZoomCollections__stateActions">
+ <Button onClick={onRetry}>
+ {t('zoom.collections.retry', 'Try again')}
+ </Button>
+ <Button variant="secondary" onClick={onClose}>
+ {t('zoom.collections.close', 'Close')}
+ </Button>
+ </div>
+ </SettingsCard>
+ )
+ }
- if (!files.game.length && !files.extras.length) {
+ if (status === 'empty' || (!files.game.length && !files.extras.length)) {
return (
- <section className="ZoomCollections">
+ <SettingsCard className="ZoomCollections" title={title}>
<p className="ZoomCollections__empty">
{t(
'zoom.collections.noFiles',
'This product has no files to install.'
)}
</p>
- <Button variant="secondary" onClick={onBack}>
- {t('zoom.collections.back', 'Back')}
+ <Button variant="secondary" onClick={onClose}>
+ {t('zoom.collections.close', 'Close')}
</Button>
- </section>
+ </SettingsCard>
)
}
@@ -84,17 +129,11 @@ export default function ZoomCollections({
const extrasBytes = zoomFilesBytes(files.extras)
return (
- <section className="ZoomCollections">
- <h3 className="ZoomCollections__title">
- {t('zoom.collections.title', 'Select files to install')}
- </h3>
- <p className="ZoomCollections__description">
- {t(
- 'zoom.collections.description',
- 'This product includes more than one file. Pick what you want to install.'
- )}
- </p>
-
+ <SettingsCard
+ className="ZoomCollections"
+ title={title}
+ description={description}
+ >
<fieldset className="ZoomCollections__group">
<legend>{t('zoom.collections.gameGroup', 'Game files')}</legend>
@@ -119,8 +158,8 @@ export default function ZoomCollections({
</Button>
</>
) : (
- <Button variant="secondary" onClick={onBack}>
- {t('zoom.collections.back', 'Back')}
+ <Button variant="secondary" onClick={onClose}>
+ {t('zoom.collections.close', 'Close')}
</Button>
)}
</div>
@@ -139,6 +178,11 @@ export default function ZoomCollections({
{files.extras.length > 0 && (
<details className="ZoomCollections__extras">
<summary className="ZoomCollections__summaryRow">
+ <Icon
+ glyph={ChevronDown}
+ size="sm"
+ className="ZoomCollections__chevron"
+ />
<span className="ZoomCollections__summaryLabel">
{t('zoom.collections.extrasGroup', 'Extras')}
</span>
@@ -172,15 +216,6 @@ export default function ZoomCollections({
size: formatSize(selectedBytes, units)
})}
</p>
-
- {files.game.length > 0 && !hasSelectedGameFile(files, selectedIds) && (
- <p className="ZoomCollections__hint">
- {t(
- 'zoom.collections.selectOne',
- 'Select at least one game file to continue.'
- )}
- </p>
- )}
- </section>
+ </SettingsCard>
)
}
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/DLCDownloadListing.test.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/DLCDownloadListing.test.tsx
new file mode 100644
index 000000000..4410e532e
--- /dev/null
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/DLCDownloadListing.test.tsx
@@ -0,0 +1,104 @@
+/**
+ * @jest-environment jsdom
+ */
+import { fireEvent, render, screen } from '@testing-library/react'
+import { createInstance } from 'i18next'
+import { I18nextProvider } from 'react-i18next'
+import { DLCInfo } from 'common/types/legendary'
+import translation from '../../../../../../../../public/locales/en/translation.json'
+import DLCDownloadListing from '../DLCDownloadListing'
+
+jest.mock('frontend/components/UI/SettingsCard/index.css', () => ({}))
+jest.mock('frontend/components/UI/ToggleSwitch/index.css', () => ({}))
+jest.mock('frontend/components/UI/SettingRow/index.css', () => ({}))
+jest.mock('frontend/components/UI/InfoTooltip/index.css', () => ({}))
+jest.mock('frontend/components/UI/Icon/index.css', () => ({}))
+jest.mock('frontend/components/UI/Panel/index.css', () => ({}))
+
+const dlcs = [
+ { app_name: 'dlc-1', title: 'DLC One' },
+ { app_name: 'dlc-2', title: 'DLC Two' }
+] as DLCInfo[]
+
+const i18n = createInstance()
+
+beforeAll(async () => {
+ await i18n.init({
+ lng: 'en',
+ ns: ['translation'],
+ defaultNS: 'translation',
+ resources: { en: { translation } },
+ interpolation: { escapeValue: false },
+ react: { useSuspense: false }
+ })
+})
+
+const renderPanel = (dlcsToInstall: string[], setDlcsToInstall = jest.fn()) =>
+ render(
+ <I18nextProvider i18n={i18n}>
+ <DLCDownloadListing
+ DLCList={dlcs}
+ dlcsToInstall={dlcsToInstall}
+ setDlcsToInstall={setDlcsToInstall}
+ />
+ </I18nextProvider>
+ )
+
+const masterCheckbox = () => {
+ const element = screen.getByLabelText('Install all DLCs')
+ if (!(element instanceof HTMLInputElement)) {
+ throw new Error('Expected the master DLC checkbox')
+ }
+ return element
+}
+
+describe('DLC master toggle', () => {
+ it('is off when nothing is selected', () => {
+ renderPanel([])
+
+ expect(masterCheckbox().checked).toBe(false)
+ expect(masterCheckbox().indeterminate).toBe(false)
+ })
+
+ it('is mixed when part of the list is selected', () => {
+ renderPanel(['dlc-1'])
+
+ expect(masterCheckbox().checked).toBe(false)
+ expect(masterCheckbox().indeterminate).toBe(true)
+ expect(masterCheckbox().getAttribute('aria-checked')).toBe('mixed')
+ })
+
+ it('is on when every DLC is selected', () => {
+ renderPanel(['dlc-1', 'dlc-2'])
+
+ expect(masterCheckbox().checked).toBe(true)
+ expect(masterCheckbox().indeterminate).toBe(false)
+ })
+
+ it('selects every DLC from none', () => {
+ const setDlcsToInstall = jest.fn()
+ renderPanel([], setDlcsToInstall)
+
+ fireEvent.click(masterCheckbox())
+
+ expect(setDlcsToInstall).toHaveBeenCalledWith(['dlc-1', 'dlc-2'])
+ })
+
+ it('clears the selection when everything is selected', () => {
+ const setDlcsToInstall = jest.fn()
+ renderPanel(['dlc-1', 'dlc-2'], setDlcsToInstall)
+
+ fireEvent.click(masterCheckbox())
+
+ expect(setDlcsToInstall).toHaveBeenCalledWith([])
+ })
+
+ it('selects everything from a partial selection', () => {
+ const setDlcsToInstall = jest.fn()
+ renderPanel(['dlc-1'], setDlcsToInstall)
+
+ fireEvent.click(masterCheckbox())
+
+ expect(setDlcsToInstall).toHaveBeenCalledWith(['dlc-1', 'dlc-2'])
+ })
+})
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/installTabs.test.ts b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/installTabs.test.ts
new file mode 100644
index 000000000..84de6bdc4
--- /dev/null
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/__tests__/installTabs.test.ts
@@ -0,0 +1,65 @@
+import {
+ getDlcMasterState,
+ getVisibleInstallTabs,
+ toggleAllDlcs
+} from '../installTabs'
+
+describe('getVisibleInstallTabs', () => {
+ it('always starts with installation', () => {
+ expect(
+ getVisibleInstallTabs({
+ hasComponents: false,
+ hasDlcs: false,
+ hasWine: false
+ })
+ ).toEqual(['installation'])
+ })
+
+ it.each`
+ components | dlcs | wine | expected
+ ${true} | ${false} | ${false} | ${['installation', 'components']}
+ ${false} | ${true} | ${false} | ${['installation', 'dlcs']}
+ ${false} | ${false} | ${true} | ${['installation', 'wine']}
+ ${true} | ${true} | ${true} | ${['installation', 'components', 'dlcs', 'wine']}
+ `(
+ 'components=$components dlcs=$dlcs wine=$wine',
+ ({ components, dlcs, wine, expected }) => {
+ expect(
+ getVisibleInstallTabs({
+ hasComponents: components,
+ hasDlcs: dlcs,
+ hasWine: wine
+ })
+ ).toEqual(expected)
+ }
+ )
+})
+
+describe('DLC master state', () => {
+ const all = ['a', 'b', 'c']
+
+ it('is none when nothing is selected', () => {
+ expect(getDlcMasterState([], all)).toBe('none')
+ })
+
+ it('is partial when some are selected', () => {
+ expect(getDlcMasterState(['a'], all)).toBe('partial')
+ })
+
+ it('is all when everything is selected', () => {
+ expect(getDlcMasterState(all, all)).toBe('all')
+ })
+
+ it('ignores ids that are not in the list', () => {
+ expect(getDlcMasterState(['a', 'z'], all)).toBe('partial')
+ })
+
+ it('selects everything from none or partial', () => {
+ expect(toggleAllDlcs('none', all)).toEqual(all)
+ expect(toggleAllDlcs('partial', all)).toEqual(all)
+ })
+
+ it('clears the selection when everything is selected', () => {
+ expect(toggleAllDlcs('all', all)).toEqual([])
+ })
+})
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
index 2aa5edc50..dc6d32889 100644
--- a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/index.tsx
@@ -21,12 +21,22 @@ import {
import { BuildItem, DLCInfo as GOGDLCInfo } from 'common/types/gog'
import { ZoomInstallInfo } from 'common/types/zoom'
import {
+ canInstallZoomSelection,
carryZoomSelection,
hasSelectedGameFile,
+ selectedZoomFileGroups,
shouldShowZoomCollections,
- ZoomFileGroups
+ ZoomFileGroups,
+ zoomFilesBytes
} from 'common/zoomFiles'
-import { PathSelectionBox, ToggleSwitch } from 'frontend/components/UI'
+import {
+ PathSelectionBox,
+ SettingsCard,
+ TabPanel,
+ Tabs,
+ ToggleSwitch
+} from 'frontend/components/UI'
+import type { TabItem } from 'frontend/components/UI/Tabs'
import Anticheat from 'frontend/components/UI/Anticheat'
import {
ModalHeader,
@@ -49,6 +59,7 @@ import React, {
useContext,
useEffect,
useMemo,
+ useRef,
useState
} from 'react'
import { useTranslation } from 'react-i18next'
@@ -61,8 +72,9 @@ import SteamLibrarySelector from './SteamLibrarySelector'
import { SteamInstallLibrary } from 'common/types/steam'
import { hasAnticheatInfo } from 'frontend/hooks/hasAnticheatInfo'
import BranchSelector from './BranchSelector'
+import ZoomCollections, { type ZoomCollectionsStatus } from './ZoomCollections'
import AnticheatDisabledMessage from './AnticheatDisabledMessage'
-import ZoomCollections from './ZoomCollections'
+import { getVisibleInstallTabs, InstallTab } from './installTabs'
import { openInstallGameModal } from 'frontend/state/InstallGameModal'
interface Props {
@@ -76,7 +88,8 @@ interface Props {
crossoverBottle: string
wineVersion: WineInstallation | undefined
wineSelectionValid: boolean
- children: React.ReactNode
+ platformSelection: React.ReactNode
+ wineSelector?: React.ReactNode
gameInfo: GameInfo
}
@@ -116,7 +129,8 @@ export default function DownloadDialog({
winePrefix,
wineVersion,
wineSelectionValid,
- children,
+ platformSelection,
+ wineSelector,
gameInfo,
crossoverBottle
}: Props) {
@@ -171,6 +185,9 @@ export default function DownloadDialog({
extras: []
})
const [selectedZoomFiles, setSelectedZoomFiles] = useState<string[]>([])
+ const [zoomFilesError, setZoomFilesError] = useState<string | null>(null)
+ const [zoomFilesLoaded, setZoomFilesLoaded] = useState(false)
+ const [zoomRetryKey, setZoomRetryKey] = useState(0)
function focusPlatformPicker() {
const picker = document.getElementById('platformPick')
@@ -188,6 +205,9 @@ export default function DownloadDialog({
)
}, [])
+ const [activeTab, setActiveTab] = useState<InstallTab>('installation')
+ const panelAreaRef = useRef<HTMLDivElement>(null)
+
const installFolder = gameStatus?.folder || installPath
const [spaceLeft, setSpaceLeft] = useState<DiskSpaceInfo>({
@@ -284,7 +304,15 @@ export default function DownloadDialog({
async function handleInstall(path?: string, ignoreAnticheat = false) {
if (!wineSelectionValid) return
- if (isZoom && !hasSelectedGameFile(zoomFiles, selectedZoomFiles)) {
+ if (
+ isZoom &&
+ !canInstallZoomSelection(
+ zoomFiles,
+ selectedZoomFiles,
+ zoomFilesError,
+ zoomFilesLoaded
+ )
+ ) {
return
}
@@ -351,6 +379,10 @@ export default function DownloadDialog({
const fetchedPlatform = platformToInstall
const fetchedBuild = selectedBuild
setGettingInstallInfo(true)
+ if (isZoom) {
+ setZoomFilesError(null)
+ setZoomFilesLoaded(false)
+ }
const gameInstallInfo = await getInstallInfo(
appName,
runner,
@@ -377,6 +409,15 @@ export default function DownloadDialog({
return
}
+ if (isZoom && !gameInstallInfo) {
+ setZoomFilesError(
+ tr('zoom.collections.loadError', 'Could not load the files.')
+ )
+ setZoomFilesLoaded(true)
+ setGettingInstallInfo(false)
+ return
+ }
+
if (noContent && !isZoom) {
showDialogModal({
showDialog: true,
@@ -402,6 +443,8 @@ export default function DownloadDialog({
if (isZoom) {
const zoomInfo = gameInstallInfo as ZoomInstallInfo | null
const files = zoomInfo?.files ?? { game: [], extras: [] }
+ setZoomFilesError(null)
+ setZoomFilesLoaded(true)
setZoomFiles(files)
setSelectedZoomFiles((previous) =>
carryZoomSelection(files, previous, zoomInfo?.installedFileIds)
@@ -491,6 +534,15 @@ export default function DownloadDialog({
}
}
} catch (error) {
+ if (isZoom) {
+ console.error(error)
+ setGettingInstallInfo(false)
+ setZoomFilesLoaded(true)
+ setZoomFilesError(
+ tr('zoom.collections.loadError', 'Could not load the files.')
+ )
+ return
+ }
showDialogModal({
type: 'ERROR',
title: tr('box.error.generic.title', 'Error!'),
@@ -509,7 +561,8 @@ export default function DownloadDialog({
platformToInstall,
selectedBuild,
branch,
- savedBranchPassword
+ savedBranchPassword,
+ zoomRetryKey
])
useEffect(() => {
@@ -576,10 +629,6 @@ export default function DownloadDialog({
getSpace()
}, [installPath, diskSize])
- const haveDLCs =
- gameInstallInfo &&
- 'game' in gameInstallInfo &&
- gameInstallInfo?.game?.owned_dlc?.length > 0
const DLCList: Array<GOGDLCInfo | LegendaryDLCInfo> =
(gameInstallInfo &&
'game' in gameInstallInfo &&
@@ -587,6 +636,13 @@ export default function DownloadDialog({
[]
const downloadSize = useMemo(() => {
+ if (isZoom) {
+ if (zoomFilesError) return '—'
+ if (!zoomFilesLoaded) return ''
+ if (!zoomFiles.game.length && !zoomFiles.extras.length) return size(0)
+ const selected = selectedZoomFileGroups(zoomFiles, selectedZoomFiles)
+ return size(zoomFilesBytes([...selected.game, ...selected.extras]))
+ }
if (
gameInstallInfo &&
gameInstallInfo.manifest &&
@@ -622,9 +678,26 @@ export default function DownloadDialog({
return size(Number(gameInstallInfo?.manifest?.download_size))
}
return ''
- }, [installPath, gameInstallInfo, installLanguage, dlcsToInstall])
+ }, [
+ installPath,
+ gameInstallInfo,
+ installLanguage,
+ dlcsToInstall,
+ isZoom,
+ zoomFiles,
+ selectedZoomFiles,
+ zoomFilesLoaded,
+ zoomFilesError
+ ])
const installSize = useMemo(() => {
+ if (isZoom) {
+ if (zoomFilesError) return '—'
+ if (!zoomFilesLoaded) return ''
+ if (!zoomFiles.game.length && !zoomFiles.extras.length) return size(0)
+ const selected = selectedZoomFileGroups(zoomFiles, selectedZoomFiles)
+ return size(zoomFilesBytes([...selected.game, ...selected.extras]))
+ }
if (
gameInstallInfo &&
gameInstallInfo.manifest &&
@@ -652,7 +725,17 @@ export default function DownloadDialog({
}
return ''
- }, [gameInstallInfo, installLanguage, platformToInstall, dlcsToInstall])
+ }, [
+ gameInstallInfo,
+ installLanguage,
+ platformToInstall,
+ dlcsToInstall,
+ isZoom,
+ zoomFiles,
+ selectedZoomFiles,
+ zoomFilesLoaded,
+ zoomFilesError
+ ])
const {
validPath,
@@ -676,12 +759,42 @@ export default function DownloadDialog({
return t('button.no-path-selected', 'No path selected')
}
- const zoomGameSelected = hasSelectedGameFile(zoomFiles, selectedZoomFiles)
+ const zoomSelectionReady = canInstallZoomSelection(
+ zoomFiles,
+ selectedZoomFiles,
+ zoomFilesError,
+ zoomFilesLoaded
+ )
+ const zoomCollectionsLoading = isZoom && !zoomFilesLoaded
+ const zoomCollectionsEmpty =
+ isZoom &&
+ zoomFilesLoaded &&
+ !zoomFilesError &&
+ !zoomFiles.game.length &&
+ !zoomFiles.extras.length
+ const zoomCollectionsStatus: ZoomCollectionsStatus = zoomFilesError
+ ? 'error'
+ : zoomCollectionsLoading
+ ? 'loading'
+ : zoomCollectionsEmpty
+ ? 'empty'
+ : 'ready'
+ const zoomSelectionHint =
+ isZoom &&
+ zoomCollectionsStatus === 'ready' &&
+ !hasSelectedGameFile(zoomFiles, selectedZoomFiles)
+ ? tr(
+ 'zoom.collections.selectOne',
+ 'Select at least one game file to continue.'
+ )
+ : ''
+ const showInstallSpinner =
+ gettingInstallInfo || (!isZoom && !diskSize) || (isZoom && !zoomFilesLoaded)
const readyToInstall = isZoom
? !!installPath &&
!gettingInstallInfo &&
validFlatpakPath &&
- zoomGameSelected &&
+ zoomSelectionReady &&
wineSelectionValid
: installPath &&
!!diskSize &&
@@ -689,231 +802,327 @@ export default function DownloadDialog({
validFlatpakPath &&
wineSelectionValid
- const showDlcSelector =
- ['legendary', 'gog'].includes(runner) && DLCList && DLCList?.length > 0
+ const hasDlcs = DLCList.length > 0
+ const hasWine = Boolean(wineSelector)
- return (
+ const installTabs = getVisibleInstallTabs({
+ hasComponents: haveSDL,
+ hasDlcs,
+ hasWine
+ })
+
+ useEffect(() => {
+ if (!installTabs.includes(activeTab)) {
+ setActiveTab('installation')
+ }
+ }, [activeTab, installTabs])
+
+ const changeTab = (value: InstallTab) => {
+ setActiveTab(value)
+ panelAreaRef.current?.scrollTo({ top: 0 })
+ }
+
+ const tabLabels: Record<InstallTab, string> = {
+ installation: t('install.tabs.installation', 'Installation'),
+ components: t('install.tabs.components', 'Components'),
+ dlcs: t('install.tabs.dlcs', 'DLCs'),
+ wine: t('install.tabs.wine', 'Wine')
+ }
+
+ const tabItems: Array<TabItem<InstallTab>> = installTabs.map((value) => ({
+ value,
+ label: tabLabels[value]
+ }))
+
+ const sizeChips = (
<>
- <ModalHeader>
- {title ? title : '...'}
- {availablePlatforms.map((p) => (
+ <div className="InstallModal__size">
+ <FontAwesomeIcon
+ className={classNames('InstallModal__sizeIcon', {
+ 'fa-spin-pulse': !downloadSize
+ })}
+ icon={downloadSize ? faDownload : faSpinner}
+ />
+ {downloadSize ? (
+ <>
+ <div className="InstallModal__sizeLabel">
+ {t('game.downloadSize', 'Download Size')}:
+ </div>
+ <div className="InstallModal__sizeValue">{downloadSize}</div>
+ </>
+ ) : (
+ `${t('game.getting-download-size', 'Geting download size')}...`
+ )}
+ </div>
+ {!isZoom && (
+ <div className="InstallModal__size">
<FontAwesomeIcon
- className="InstallModal__platformIcon"
- icon={p.icon}
- key={p.value}
+ className={classNames('InstallModal__sizeIcon', {
+ 'fa-spin-pulse': !downloadSize
+ })}
+ icon={downloadSize ? faHardDrive : faSpinner}
/>
- ))}
- </ModalHeader>
- <Anticheat anticheatInfo={anticheatInfo} />
- <ModalContent>
- <div className="InstallModal__sizes">
- <div className="InstallModal__size">
- <FontAwesomeIcon
- className={classNames('InstallModal__sizeIcon', {
- 'fa-spin-pulse': !downloadSize
- })}
- icon={downloadSize ? faDownload : faSpinner}
- />
- {downloadSize ? (
- <>
- <div className="InstallModal__sizeLabel">
- {t('game.downloadSize', 'Download Size')}:
- </div>
- <div className="InstallModal__sizeValue">{downloadSize}</div>
- </>
- ) : (
- `${t('game.getting-download-size', 'Geting download size')}...`
- )}
- </div>
- <div className="InstallModal__size">
- <FontAwesomeIcon
- className={classNames('InstallModal__sizeIcon', {
- 'fa-spin-pulse': !downloadSize
- })}
- icon={downloadSize ? faHardDrive : faSpinner}
- />
- {downloadSize ? (
- <>
- <div className="InstallModal__sizeLabel">
- {t('game.installSize', 'Install Size')}:
- </div>
- <div className="InstallModal__sizeValue">{installSize}</div>
- </>
- ) : (
- `${t('game.getting-install-size', 'Geting install size')}...`
- )}
- </div>
- {previousProgress.folder === installPath && (
- <div className="InstallModal__size">
- <FontAwesomeIcon
- className="InstallModal__sizeIcon"
- icon={faSpinner}
- />
+ {downloadSize ? (
+ <>
<div className="InstallModal__sizeLabel">
- {t('status.totalDownloaded', 'Total Downloaded')}:
- </div>
- <div className="InstallModal__sizeValue">
- {getProgress(previousProgress)}%
+ {t('game.installSize', 'Install Size')}:
</div>
- </div>
+ <div className="InstallModal__sizeValue">{installSize}</div>
+ </>
+ ) : (
+ `${t('game.getting-install-size', 'Geting install size')}...`
)}
</div>
- {installLanguages && installLanguages?.length > 1 && (
- <GameLanguageSelector
- installPlatform={platformToInstall}
- installLanguage={installLanguage}
- setInstallLanguage={setInstallLanguage}
- installLanguages={installLanguages}
- languageLocales={languageLocales}
+ )}
+ {previousProgress.folder === installPath && (
+ <div className="InstallModal__size">
+ <FontAwesomeIcon
+ className="InstallModal__sizeIcon"
+ icon={faSpinner}
/>
- )}
+ <div className="InstallModal__sizeLabel">
+ {t('status.totalDownloaded', 'Total Downloaded')}:
+ </div>
+ <div className="InstallModal__sizeValue">
+ {getProgress(previousProgress)}%
+ </div>
+ </div>
+ )}
+ </>
+ )
- {isSteam ? (
- <SteamLibrarySelector
- libraries={steamLibraries}
- selectedPath={installPath}
- onChange={setInstallPath}
- />
- ) : (
- <PathSelectionBox
- type="directory"
- onPathChange={setInstallPath}
- path={installPath}
- placeholder={getDefaultInstallPath()}
- pathDialogTitle={t('install.path')}
- pathDialogDefaultPath={getDefaultInstallPath()}
- htmlId="setinstallpath"
- label={t('install.path', 'Select Install Path')}
- noDeleteButton
- afterInput={
- downloadSize ? (
- <span className="smallInputInfo">
- {validPath && validFlatpakPath && (
- <>
- <span>
- {`${t('install.disk-space-left', 'Space Available')}: `}
- </span>
- <span>
- <strong>{`${message}`}</strong>
- </span>
- {!notEnoughDiskSpace && (
- <>
- <span>
- {` - ${t(
- 'install.space-after-install',
- 'After Install'
- )}: `}
- </span>
- <span>
- <strong>{`${spaceLeftAfter}`}</strong>
- </span>
- </>
- )}
- </>
- )}
- {!validPath && (
- <span className="warning">
- {`${t(
- 'install.path-not-writtable',
- 'Warning: path might not be writable.'
- )}`}
- </span>
- )}
- {validPath && !validFlatpakPath && (
- <span className="error">
- {`${t(
- 'install.flatpak-path-not-writtable',
- 'Error: Sandbox access not granted to this path, data loss will occur.'
- )}`}
+ const installationContent = (
+ <>
+ {platformSelection}
+ {installLanguages && installLanguages?.length > 1 && (
+ <GameLanguageSelector
+ installPlatform={platformToInstall}
+ installLanguage={installLanguage}
+ setInstallLanguage={setInstallLanguage}
+ installLanguages={installLanguages}
+ languageLocales={languageLocales}
+ />
+ )}
+
+ {isSteam ? (
+ <SteamLibrarySelector
+ libraries={steamLibraries}
+ selectedPath={installPath}
+ onChange={setInstallPath}
+ />
+ ) : (
+ <PathSelectionBox
+ type="directory"
+ onPathChange={setInstallPath}
+ path={installPath}
+ placeholder={getDefaultInstallPath()}
+ pathDialogTitle={t('install.path')}
+ pathDialogDefaultPath={getDefaultInstallPath()}
+ htmlId="setinstallpath"
+ label={t('install.path', 'Select Install Path')}
+ noDeleteButton
+ afterInput={
+ downloadSize ? (
+ <span className="smallInputInfo">
+ {validPath && validFlatpakPath && (
+ <>
+ <span>
+ {`${t('install.disk-space-left', 'Space Available')}: `}
</span>
- )}
- {validPath && notEnoughDiskSpace && (
- <span className="warning">
- {` (${t(
- 'install.not-enough-disk-space',
- 'Not enough disk space'
- )})`}
+ <span>
+ <strong>{`${message}`}</strong>
</span>
- )}
- </span>
- ) : null
- }
+ {!notEnoughDiskSpace && (
+ <>
+ <span>
+ {` - ${t(
+ 'install.space-after-install',
+ 'After Install'
+ )}: `}
+ </span>
+ <span>
+ <strong>{`${spaceLeftAfter}`}</strong>
+ </span>
+ </>
+ )}
+ </>
+ )}
+ {!validPath && (
+ <span className="warning">
+ {`${t(
+ 'install.path-not-writtable',
+ 'Warning: path might not be writable.'
+ )}`}
+ </span>
+ )}
+ {validPath && !validFlatpakPath && (
+ <span className="error">
+ {`${t(
+ 'install.flatpak-path-not-writtable',
+ 'Error: Sandbox access not granted to this path, data loss will occur.'
+ )}`}
+ </span>
+ )}
+ {validPath && notEnoughDiskSpace && (
+ <span className="warning">
+ {` (${t(
+ 'install.not-enough-disk-space',
+ 'Not enough disk space'
+ )})`}
+ </span>
+ )}
+ </span>
+ ) : null
+ }
+ />
+ )}
+
+ {platformToInstall !== 'linux' && branches.length > 1 && (
+ <div>
+ <BranchSelector
+ appName={gameInfo.app_name}
+ branches={branches}
+ branch={branch}
+ setBranch={setBranch}
+ savedBranchPassword={savedBranchPassword}
+ onPasswordChange={(newPasswd) => setSavedBranchPassword(newPasswd)}
/>
- )}
-
- {platformToInstall !== 'linux' && branches.length > 1 && (
- <div>
- <BranchSelector
- appName={gameInfo.app_name}
- branches={branches}
- branch={branch}
- setBranch={setBranch}
- savedBranchPassword={savedBranchPassword}
- onPasswordChange={(newPasswd) =>
- setSavedBranchPassword(newPasswd)
- }
- />
- </div>
- )}
+ </div>
+ )}
+
+ {platformToInstall !== 'linux' && !!gameBuilds.length && (
+ <div>
+ <BuildSelector
+ gameBuilds={gameBuilds}
+ selectedBuild={selectedBuild}
+ setSelectedBuild={setSelectedBuild}
+ />
+ </div>
+ )}
- {platformToInstall !== 'linux' && !!gameBuilds.length && (
- <div>
- <BuildSelector
- gameBuilds={gameBuilds}
- selectedBuild={selectedBuild}
- setSelectedBuild={setSelectedBuild}
- />
- </div>
- )}
- {isZoom && shouldShowZoomCollections(zoomFiles) && (
+ {isZoom &&
+ (zoomCollectionsLoading ||
+ !!zoomFilesError ||
+ shouldShowZoomCollections(zoomFiles)) && (
<ZoomCollections
files={zoomFiles}
selectedIds={selectedZoomFiles}
+ status={zoomCollectionsStatus}
+ error={zoomFilesError}
onToggle={handleZoomFileToggle}
+ onRetry={() => setZoomRetryKey((key) => key + 1)}
canChangePlatform={availablePlatforms.length > 1}
onChangePlatform={focusPlatformPicker}
- onBack={backdropClick}
+ onClose={backdropClick}
/>
)}
- {(haveDLCs || haveSDL) && (
- <div className="InstallModal__sectionHeader">
- {t('sdl.title', 'Select components to Install')}:
- </div>
- )}
- {haveSDL && (
- <div className="InstallModal__sdls">
- {sdls.map((sdl: SelectiveDownload, idx: number) => (
- <label
- key={sdl.name}
- className="InstallModal__toggle toggleWrapper"
- >
- <ToggleSwitch
- htmlId={`sdls-${idx}`}
- title={sdl.name}
- extraClass="InstallModal__toggle--sdl"
- value={!!sdl.required || !!selectedSdls[getUniqueKey(sdl)]}
- disabled={sdl.required}
- handleChange={(e) => handleSdl(sdl, e.target.checked)}
- />
- </label>
- ))}
- </div>
- )}
- {showDlcSelector && (
- <DLCDownloadListing
- DLCList={DLCList}
- dlcsToInstall={dlcsToInstall}
- setDlcsToInstall={setDlcsToInstall}
+ </>
+ )
+
+ const componentsContent = (
+ <SettingsCard title={t('sdl.title', 'Select components to Install')}>
+ {sdls.map((sdl: SelectiveDownload, idx: number) => (
+ <ToggleSwitch
+ key={sdl.name}
+ htmlId={`sdls-${idx}`}
+ title={
+ sdl.required
+ ? `${sdl.name} (${t('install.components.required', 'Required')})`
+ : sdl.name
+ }
+ description={sdl.description}
+ value={!!sdl.required || !!selectedSdls[getUniqueKey(sdl)]}
+ disabled={sdl.required}
+ handleChange={(e) => handleSdl(sdl, e.target.checked)}
+ />
+ ))}
+ </SettingsCard>
+ )
+
+ return (
+ <>
+ <ModalHeader
+ meta={<div className="InstallModal__sizes">{sizeChips}</div>}
+ >
+ {title ? title : '...'}
+ {availablePlatforms.map((p) => (
+ <FontAwesomeIcon
+ className="InstallModal__platformIcon"
+ icon={p.icon}
+ key={p.value}
+ />
+ ))}
+ </ModalHeader>
+ <Anticheat anticheatInfo={anticheatInfo} compact />
+ <ModalContent className="InstallModal__content">
+ {installTabs.length > 1 && (
+ <Tabs
+ items={tabItems}
+ value={activeTab}
+ onChange={changeTab}
+ aria-label={t('install.tabs.ariaLabel', 'Install sections')}
+ idPrefix="install-tab"
+ className="InstallModal__tabs"
/>
)}
- {children}
+ <div className="InstallModal__panelArea" ref={panelAreaRef}>
+ {installTabs.length > 1 ? (
+ <TabPanel
+ value={activeTab}
+ idPrefix="install-tab"
+ index="installation"
+ >
+ {installationContent}
+ </TabPanel>
+ ) : (
+ installationContent
+ )}
+ {haveSDL && (
+ <TabPanel
+ value={activeTab}
+ idPrefix="install-tab"
+ index="components"
+ >
+ {componentsContent}
+ </TabPanel>
+ )}
+ {hasDlcs && (
+ <TabPanel value={activeTab} idPrefix="install-tab" index="dlcs">
+ <DLCDownloadListing
+ DLCList={DLCList}
+ dlcsToInstall={dlcsToInstall}
+ setDlcsToInstall={setDlcsToInstall}
+ />
+ </TabPanel>
+ )}
+ {hasWine && (
+ <TabPanel
+ value={activeTab}
+ idPrefix="install-tab"
+ index="wine"
+ keepMounted
+ >
+ {wineSelector}
+ </TabPanel>
+ )}
+ </div>
</ModalContent>
+ {zoomSelectionHint && (
+ <p
+ className="InstallModal__zoomHint"
+ id="zoom-select-hint"
+ aria-live="polite"
+ >
+ {zoomSelectionHint}
+ </p>
+ )}
<ModalFooter>
<Button
onClick={async () => handleInstall()}
disabled={!readyToInstall}
+ aria-describedby={zoomSelectionHint ? 'zoom-select-hint' : undefined}
icon={
- !readyToInstall ? (
+ showInstallSpinner ? (
<FontAwesomeIcon className="fa-spin-pulse" icon={faSpinner} />
) : null
}
diff --git a/src/frontend/screens/Library/components/InstallModal/DownloadDialog/installTabs.ts b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/installTabs.ts
new file mode 100644
index 000000000..16df51e90
--- /dev/null
+++ b/src/frontend/screens/Library/components/InstallModal/DownloadDialog/installTabs.ts
@@ -0,0 +1,37 @@
+export type InstallTab = 'installation' | 'components' | 'dlcs' | 'wine'
+
+export type DlcMasterState = 'all' | 'partial' | 'none'
+
+export function getVisibleInstallTabs({
+ hasComponents,
+ hasDlcs,
+ hasWine
+}: {
+ hasComponents: boolean
+ hasDlcs: boolean
+ hasWine: boolean
+}): InstallTab[] {
+ return [
+ 'installation',
+ ...(hasComponents ? (['components'] as const) : []),
+ ...(hasDlcs ? (['dlcs'] as const) : []),
+ ...(hasWine ? (['wine'] as const) : [])
+ ]
+}
+
+export function getDlcMasterState(
+ selected: string[],
+ all: string[]
+): DlcMasterState {
+ const selectedCount = all.filter((id) => selected.includes(id)).length
+
+ if (selectedCount === 0) {
+ return 'none'
+ }
+
+ return selectedCount === all.length ? 'all' : 'partial'
+}
+
+export function toggleAllDlcs(state: DlcMasterState, all: string[]): string[] {
+ return state === 'all' ? [] : [...all]
+}
diff --git a/src/frontend/screens/Library/components/InstallModal/index.scss b/src/frontend/screens/Library/components/InstallModal/index.scss
index 82c45be3d..b68b955ec 100644
--- a/src/frontend/screens/Library/components/InstallModal/index.scss
+++ b/src/frontend/screens/Library/components/InstallModal/index.scss
@@ -36,10 +36,12 @@
}
.InstallModal__sizes {
- display: inline-grid;
- grid-gap: 24px;
- grid-auto-flow: column;
- margin: var(--space-xs) 0;
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-xs) 24px;
+ max-width: 100%;
+ min-width: 0;
+ margin: 0;
}
.InstallModal__size {
@@ -109,19 +111,7 @@
}
.ZoomCollections {
- margin: var(--space-md) var(--space-md) 0;
-
- &__title {
- margin: 0 0 var(--space-xs);
- font-size: 1em;
- font-weight: 600;
- }
-
- &__description {
- margin: 0 0 var(--space-sm);
- color: var(--text-secondary);
- font-size: 0.9em;
- }
+ margin-block: var(--space-md) 0;
&__group {
margin: 0;
@@ -182,6 +172,27 @@
border-top: 1px solid var(--divider);
}
+ &__chevron {
+ flex: 0 0 auto;
+ transition: transform 150ms ease;
+ }
+
+ &__extras[open] &__chevron {
+ transform: rotate(180deg);
+ }
+
+ &__loading {
+ margin: 0;
+ color: var(--text-secondary);
+ }
+
+ &__stateActions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: var(--space-xs);
+ margin-top: var(--space-sm);
+ }
+
&__summaryRow {
list-style: none;
@@ -238,3 +249,49 @@
}
}
}
+
+.InstallModal__content {
+ display: flex;
+ flex-direction: column;
+ min-height: 0;
+ overflow: hidden;
+}
+
+.InstallModal__tabs {
+ flex: 0 0 auto;
+ margin-bottom: var(--space-md);
+}
+
+.InstallModal__panelArea {
+ flex: 1 1 auto;
+ min-height: 0;
+ overflow-x: hidden;
+ overflow-y: auto;
+ padding-bottom: var(--space-md);
+}
+
+.InstallModal__dlcMaster {
+ position: sticky;
+ top: 0;
+ z-index: 1;
+ background: var(--panel-background-raised, var(--panel-background));
+ padding-block: var(--space-xs);
+}
+
+.InstallModal__dlcsList {
+ margin-inline-start: 24px;
+ padding-inline-start: var(--space-sm);
+ border-inline-start: 1px solid var(--panel-divider);
+ max-width: none;
+}
+
+.InstallModal__dlcsList .ToggleSwitch {
+ padding-block: var(--space-2xs);
+}
+
+.InstallModal__zoomHint {
+ margin: 0;
+ padding: 0 var(--modal-padding-inline) var(--space-xs);
+ color: var(--status-warning);
+ font-size: var(--body-sm);
+}
diff --git a/src/frontend/screens/Library/components/InstallModal/index.tsx b/src/frontend/screens/Library/components/InstallModal/index.tsx
index 1fca444d6..bc4557d72 100644
--- a/src/frontend/screens/Library/components/InstallModal/index.tsx
+++ b/src/frontend/screens/Library/components/InstallModal/index.tsx
@@ -233,13 +233,15 @@ function InstallModal({ appName, runner, gameInfo = null }: Props) {
const isImportMode = action === 'import'
const closeModal = () => closeInstallGameModal()
+ const isDownloadDialog =
+ showDownloadDialog && !isThirdPartyManagedApp && !isImportMode
return (
<div className="InstallModal">
<Modal
onClose={closeModal}
showCloseButton
- size="lg"
+ size={isDownloadDialog ? 'md' : 'lg'}
className="InstallModal__dialog"
>
{isThirdPartyManagedApp ? (
@@ -318,26 +320,28 @@ function InstallModal({ appName, runner, gameInfo = null }: Props) {
setPlatformToInstall={setPlatformToInstall}
gameInfo={gameInfo}
crossoverBottle={crossoverBottle}
- >
- {platformSelection()}
- {hasWine ? (
- <WineSelector
- appName={appName}
- winePrefix={winePrefix}
- wineVersion={wineVersion}
- wineVersionList={wineVersionList}
- title={gameInfo?.title}
- setWinePrefix={setWinePrefix}
- setWineVersion={setWineVersion}
- crossoverBottle={crossoverBottle}
- setCrossoverBottle={setCrossoverBottle}
- userPickedWineVersion={userPickedWineVersion}
- onWineVersionPicked={() => setUserPickedWineVersion(true)}
- useSharedPrefix={useSharedPrefix}
- setUseSharedPrefix={setUseSharedPrefix}
- />
- ) : null}
- </DownloadDialog>
+ platformSelection={platformSelection()}
+ wineSelector={
+ hasWine ? (
+ <WineSelector
+ appName={appName}
+ winePrefix={winePrefix}
+ wineVersion={wineVersion}
+ wineVersionList={wineVersionList}
+ title={gameInfo?.title}
+ setWinePrefix={setWinePrefix}
+ setWineVersion={setWineVersion}
+ crossoverBottle={crossoverBottle}
+ setCrossoverBottle={setCrossoverBottle}
+ userPickedWineVersion={userPickedWineVersion}
+ onWineVersionPicked={() => setUserPickedWineVersion(true)}
+ useSharedPrefix={useSharedPrefix}
+ setUseSharedPrefix={setUseSharedPrefix}
+ noDetails
+ />
+ ) : null
+ }
+ />
) : (
<SideloadDialog
title={sideloadTitle}
diff --git a/src/frontend/screens/Settings/index.tsx b/src/frontend/screens/Settings/index.tsx
index 9bf1390df..d8c67c046 100644
--- a/src/frontend/screens/Settings/index.tsx
+++ b/src/frontend/screens/Settings/index.tsx
@@ -357,6 +357,8 @@ function Settings() {
onChange={(value) => navigate(`/settings/${value}`)}
aria-label={t('Settings', 'Settings')}
className="settingsNav settingsNav--tabs"
+ idPrefix="settings-nav"
+ activation="manual"
/>
{settingsSearchRow}
</>
diff --git a/src/frontend/screens/Settings/sections/GamesSettings/index.tsx b/src/frontend/screens/Settings/sections/GamesSettings/index.tsx
index e6a27e48f..75ab3abe1 100644
--- a/src/frontend/screens/Settings/sections/GamesSettings/index.tsx
+++ b/src/frontend/screens/Settings/sections/GamesSettings/index.tsx
@@ -213,6 +213,8 @@ export default function GamesSettings({ initialTab }: Props = {}) {
onChange={handleChange}
aria-label={t('settings.navbar.tabs', 'Settings sections')}
className="settingsTabs"
+ idPrefix="settings-games"
+ activation="manual"
/>
{isDefault && (
@@ -224,7 +226,7 @@ export default function GamesSettings({ initialTab }: Props = {}) {
</Alert>
)}
- <TabPanel value={activeTab} index={'wine'}>
+ <TabPanel value={activeTab} idPrefix="settings-games" index={'wine'}>
<SettingsCard
glyph={WineIcon}
title={t('settings.section.wineVersion', 'Wine')}
@@ -272,7 +274,7 @@ export default function GamesSettings({ initialTab }: Props = {}) {
)}
</TabPanel>
- <TabPanel value={activeTab} index={'other'}>
+ <TabPanel value={activeTab} idPrefix="settings-games" index={'other'}>
<SettingsCard
glyph={Gauge}
title={t('settings.section.performance', 'Performance & overlays')}
@@ -299,7 +301,7 @@ export default function GamesSettings({ initialTab }: Props = {}) {
)}
</TabPanel>
- <TabPanel value={activeTab} index={'advanced'}>
+ <TabPanel value={activeTab} idPrefix="settings-games" index={'advanced'}>
<SettingsCard
glyph={SlidersHorizontal}
title={t('settings.section.launch', 'Launch options')}
@@ -351,7 +353,7 @@ export default function GamesSettings({ initialTab }: Props = {}) {
)}
</TabPanel>
- <TabPanel value={activeTab} index={'saves'}>
+ <TabPanel value={activeTab} idPrefix="settings-games" index={'saves'}>
<SettingsCard
glyph={Save}
title={t('settings.navbar.sync', 'Cloud saves sync')}
@@ -360,12 +362,12 @@ export default function GamesSettings({ initialTab }: Props = {}) {
</SettingsCard>
</TabPanel>
- <TabPanel value={activeTab} index={'gamescope'}>
+ <TabPanel value={activeTab} idPrefix="settings-games" index={'gamescope'}>
<Gamescope />
</TabPanel>
{isLinux && (
- <TabPanel value={activeTab} index={'legacy'}>
+ <TabPanel value={activeTab} idPrefix="settings-games" index={'legacy'}>
<Alert variant="warning">
{t(
'settings.legacy_warning',