Skip to content

Commit 583f1e3

Browse files
authored
[UI] Refactor GamesSettings component to Tabs instead of Collapsible (#1176)
Co-authored-by: Flavio F Lima <[email protected]>
1 parent 6724386 commit 583f1e3

File tree

4 files changed

+69
-104
lines changed

4 files changed

+69
-104
lines changed

src/frontend/screens/Settings/components/SettingsModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function SettingsModal({ gameInfo, type }: Props) {
5151
</DialogHeader>
5252
<DialogContent className="settingsDialogContent">
5353
<SettingsContext.Provider value={contextValues}>
54-
{type === 'settings' ? <GamesSettings useDetails /> : <LogSettings />}
54+
{type === 'settings' ? <GamesSettings /> : <LogSettings />}
5555
</SettingsContext.Provider>
5656
</DialogContent>
5757
</Dialog>

src/frontend/screens/Settings/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function Settings() {
159159
<GeneralSettings />
160160
</Tabs.Panel>
161161
<Tabs.Panel value="gamesSettings">
162-
<GamesSettings useDetails={false} />
162+
<GamesSettings />
163163
</Tabs.Panel>
164164
<Tabs.Panel value="advSettings">
165165
<AdvancedSettings />

src/frontend/screens/Settings/sections/GamesSettings/index.scss

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@
2525
}
2626
}
2727

28-
// details, should have an hover effect and a pointer cursor and also the summary should be bold and have a background color
29-
details {
30-
cursor: pointer;
31-
width: 100%;
32-
33-
button,
34-
.button {
35-
display: flex;
36-
justify-content: center;
37-
align-content: center;
38-
align-items: center;
39-
}
40-
41-
summary {
42-
font-weight: bold;
43-
padding: var(--space-xs) 0;
44-
font-size: var(--text-xl);
45-
}
28+
.tabsList {
29+
padding: var(--space-md) 0;
4630
}

src/frontend/screens/Settings/sections/GamesSettings/index.tsx

Lines changed: 65 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,15 @@ import {
3333
import ContextProvider from 'frontend/state/ContextProvider'
3434
import Tools from '../../components/Tools'
3535
import SettingsContext from '../../SettingsContext'
36-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
37-
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'
3836
import useSetting from 'frontend/hooks/useSetting'
3937
import { defaultWineVersion } from '../..'
40-
import Collapsible from 'frontend/components/UI/Collapsible/Collapsible'
4138
import SyncSaves from '../SyncSaves'
4239
import EnableDXVKFpsLimit from '../../components/EnableDXVKFpsLimit'
40+
import { Tabs, getTabsClassNames } from '@hyperplay/ui'
41+
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'
42+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
4343

44-
type Props = {
45-
useDetails?: boolean
46-
}
47-
48-
export default function GamesSettings({ useDetails = true }: Props) {
44+
export default function GamesSettings() {
4945
const { t } = useTranslation()
5046
const { platform } = useContext(ContextProvider)
5147
const { isDefault, gameInfo } = useContext(SettingsContext)
@@ -87,100 +83,85 @@ export default function GamesSettings({ useDetails = true }: Props) {
8783
)}
8884
</p>
8985
)}
90-
91-
{showCrossPlatformOptions && (
92-
<>
93-
<Collapsible
94-
isOpen
95-
isCollapsible={useDetails}
96-
summary={isLinux ? 'Wine' : 'Wine/Crossover'}
97-
>
86+
<Tabs
87+
defaultValue={showCrossPlatformOptions ? 'wine' : 'other'}
88+
classNames={getTabsClassNames(
89+
{ list: 'settingsTabList' },
90+
{ list: 'outline' }
91+
)}
92+
>
93+
<Tabs.List className="tabsList">
94+
{showCrossPlatformOptions && (
95+
<Tabs.Tab value="wine">
96+
{isLinux ? 'Wine' : 'Wine/Crossover'}
97+
</Tabs.Tab>
98+
)}
99+
<Tabs.Tab value="other">
100+
{showCrossPlatformOptions
101+
? t('settings.navbar.other', 'Other')
102+
: t('settings.navbar.advanced', 'Advanced')}
103+
</Tabs.Tab>
104+
{hasCloudSaves && (
105+
<Tabs.Tab value="sync">
106+
{t('settings.navbar.sync', 'Cloud Saves Sync')}
107+
</Tabs.Tab>
108+
)}
109+
</Tabs.List>
110+
{showCrossPlatformOptions && (
111+
<Tabs.Panel value="wine">
98112
<WineVersionSelector />
99113
<WinePrefix />
100114
<CrossoverBottle />
101-
102115
{!isCrossover && (
103116
<>
104117
<AutoDXVK />
105118
{isLinux && (
106119
<>
107120
<AutoDXVKNVAPI />
108-
109121
<AutoVKD3D />
110-
111122
<EacRuntime />
112-
113123
<BattlEyeRuntime />
114124
</>
115125
)}
116126
<Tools />
117127
</>
118128
)}
119-
</Collapsible>
120-
</>
121-
)}
122-
123-
<Collapsible
124-
isOpen={nativeGame}
125-
isCollapsible={useDetails}
126-
summary={
127-
showCrossPlatformOptions
128-
? t('settings.navbar.other', 'Other')
129-
: t('settings.navbar.advanced', 'Advanced')
130-
}
131-
>
132-
<AlternativeExe />
133-
134-
<ShowFPS />
135-
136-
{showCrossPlatformOptions && <EnableDXVKFpsLimit />}
137-
138-
{showCrossPlatformOptions && (
139-
<>
140-
<EnableEsync />
141-
<EnableMsync />
142-
{isLinux && (
143-
<>
144-
<EnableFsync />
145-
146-
<PreferSystemLibs />
147-
148-
<EnableFSR />
149-
150-
<GameMode />
151-
</>
152-
)}
153-
</>
129+
</Tabs.Panel>
154130
)}
155-
156-
<UseDGPU />
157-
158-
{isLinux && <Mangohud />}
159-
160-
<SteamRuntime />
161-
162-
<IgnoreGameUpdates />
163-
164-
<OfflineMode />
165-
166-
<EnvVariablesTable />
167-
168-
<WrappersTable />
169-
170-
<LauncherArgs />
171-
172-
<PreferedLanguage />
173-
</Collapsible>
174-
175-
{hasCloudSaves && (
176-
<Collapsible
177-
isOpen={false}
178-
isCollapsible={useDetails}
179-
summary={t('settings.navbar.sync', 'Cloud Saves Sync')}
180-
>
181-
<SyncSaves />
182-
</Collapsible>
183-
)}
131+
<Tabs.Panel value="other">
132+
<AlternativeExe />
133+
<ShowFPS />
134+
{showCrossPlatformOptions && <EnableDXVKFpsLimit />}
135+
{showCrossPlatformOptions && (
136+
<>
137+
<EnableEsync />
138+
<EnableMsync />
139+
{isLinux && (
140+
<>
141+
<EnableFsync />
142+
<PreferSystemLibs />
143+
<EnableFSR />
144+
<GameMode />
145+
</>
146+
)}
147+
</>
148+
)}
149+
<UseDGPU />
150+
{isLinux && <Mangohud />}
151+
<SteamRuntime />
152+
<IgnoreGameUpdates />
153+
<OfflineMode />
154+
<EnvVariablesTable />
155+
<WrappersTable />
156+
<LauncherArgs />
157+
<PreferedLanguage />
158+
</Tabs.Panel>
159+
{hasCloudSaves && (
160+
<Tabs.Panel value="sync">
161+
<SyncSaves />
162+
</Tabs.Panel>
163+
)}
164+
</Tabs>
184165
</>
185166
)
186167
}

0 commit comments

Comments
 (0)