Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[UI/UX] Use Tabs on Game Settings #3105

Merged
merged 17 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/backend/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ ipcMain.handle('callTool', async (event, { tool, exe, appName, runner }) => {
await Winetricks.run(runner, appName, event)
break
case 'winecfg':
runWineCommandOnGame(runner, appName, {
await runWineCommandOnGame(runner, appName, {
gameSettings,
commandParts: ['winecfg'],
wait: false
Expand All @@ -634,7 +634,7 @@ ipcMain.handle('callTool', async (event, { tool, exe, appName, runner }) => {
case 'runExe':
if (exe) {
const workingDir = path.parse(exe).dir
runWineCommandOnGame(runner, appName, {
await runWineCommandOnGame(runner, appName, {
gameSettings,
commandParts: [exe],
wait: false,
Expand Down
24 changes: 0 additions & 24 deletions src/frontend/components/UI/Collapsible/Collapsible.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,23 @@ export default function SidebarLinks() {
>
<span>{t('settings.navbar.general')}</span>
</NavLink>
<NavLink
role="link"
to={`/settings/${runner}/${appName}/games_settings`}
state={{ ...state, runner: state?.runner }}
className={classNames('Sidebar__item SidebarLinks__subItem', {
['active']: type === 'games_settings'
})}
>
<span>
{t('settings.navbar.games_settings_defaults', 'Game Defaults')}
</span>
</NavLink>
{!isWin && (
<NavLink
role="link"
to={`/settings/${runner}/${appName}/games_settings`}
state={{ ...state, runner: state?.runner }}
className={classNames('Sidebar__item SidebarLinks__subItem', {
['active']: type === 'games_settings'
})}
>
<span>
{t(
'settings.navbar.games_settings_defaults',
'Game Defaults'
)}
</span>
</NavLink>
)}
<NavLink
role="link"
to={`/settings/${runner}/${appName}/advanced`}
Expand Down
8 changes: 7 additions & 1 deletion src/frontend/screens/Settings/components/BattlEyeRuntime.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useState } from 'react'
import React, { useContext, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { ToggleSwitch } from 'frontend/components/UI'
import useSetting from 'frontend/hooks/useSetting'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faSyncAlt } from '@fortawesome/free-solid-svg-icons'
import ContextProvider from 'frontend/state/ContextProvider'

const BattlEyeRuntime = () => {
const { t } = useTranslation()
Expand All @@ -12,6 +13,11 @@ const BattlEyeRuntime = () => {
'battlEyeRuntime',
false
)
const { platform } = useContext(ContextProvider)

if (platform !== 'linux') {
return null
}

const handleBattlEyeRuntime = async () => {
if (!battlEyeRuntime) {
Expand Down
6 changes: 5 additions & 1 deletion src/frontend/screens/Settings/components/EacRuntime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const EacRuntime = () => {
const [installing, setInstalling] = useState(false)
const [eacRuntime, setEacRuntime] = useSetting('eacRuntime', false)
const [useGameMode, setUseGameMode] = useSetting('useGameMode', false)
const { showDialogModal } = useContext(ContextProvider)
const { showDialogModal, platform } = useContext(ContextProvider)

if (platform !== 'linux') {
return null
}

const handleEacRuntime = async () => {
if (!eacRuntime) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
width: 65vw;
display: flex;
flex-direction: column;
justify-content: space-between;
flex: 1 1 60vh;
max-width: 800px;
min-height: 50vh;
flavioislima marked this conversation as resolved.
Show resolved Hide resolved

.log-box {
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function SettingsModal({ gameInfo, type }: Props) {
</DialogHeader>
<DialogContent className="settingsDialogContent">
<SettingsContext.Provider value={contextValues}>
{type === 'settings' ? <GamesSettings useDetails /> : <LogSettings />}
{type === 'settings' ? <GamesSettings /> : <LogSettings />}
</SettingsContext.Provider>
</DialogContent>
</Dialog>
Expand Down
26 changes: 25 additions & 1 deletion src/frontend/screens/Settings/components/Tools/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
.button {
padding-block: var(--space-lg);
margin: 0 var(--space-3xs);
display: flex;
align-items: center;
border-radius: 8px;
}

.active {
animation: fading 1s alternate infinite;
}

.drag {
Expand All @@ -19,8 +26,9 @@
flex-direction: column;
text-decoration: none;
white-space: nowrap;
justify-content: center;

& > span {
& span {
transition: 350ms;
font-size: var(--text-xs);
font-style: italic;
Expand All @@ -29,3 +37,19 @@
}
}
}

@keyframes fading {
0% {
opacity: 0.2;
}

50% {
opacity: 0.5;
background-color: var(--navbar-background);
color: var(--text-default);
}

100% {
opacity: 1;
}
}
26 changes: 17 additions & 9 deletions src/frontend/screens/Settings/components/Tools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function Tools() {
const { t } = useTranslation()
const [winecfgRunning, setWinecfgRunning] = useState(false)
const [winetricksRunning, setWinetricksRunning] = useState(false)
const [runExeRunning, setRunExeRunning] = useState(false)
const [progress, setProgress] = useState<string[]>([])
const { appName, runner, isDefault } = useContext(SettingsContext)
const { platform } = useContext(ContextProvider)
Expand All @@ -25,20 +26,26 @@ export default function Tools() {

type Tool = 'winecfg' | 'winetricks' | string
async function callTools(tool: Tool, exe?: string) {
if (tool === 'winetricks') {
setWinetricksRunning(true)
const toolStates = {
winetricks: setWinetricksRunning,
winecfg: setWinecfgRunning,
runExe: setRunExeRunning
}
if (tool === 'winecfg') {
setWinecfgRunning(true)

if (tool in toolStates) {
toolStates[tool](true)
}

await window.api.callTool({
tool,
exe,
appName,
runner
})
setWinetricksRunning(false)
setWinecfgRunning(false)

if (tool in toolStates) {
toolStates[tool](false)
}
}

useEffect(() => {
Expand Down Expand Up @@ -131,11 +138,12 @@ export default function Tools() {
<a
onDrop={async (ev) => dropHandler(ev)}
onDragOver={(ev) => dragOverHandler(ev)}
className="button outline drag"
className={classNames('button outline drag', {
active: runExeRunning
})}
onClick={handleRunExe}
>
{t('setting.runexe.title')}
<br />
{t('setting.runexe.title')} <br />
<span>{t('setting.runexe.message')}</span>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/screens/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function Settings() {
</h1>

{isGeneralSettings && <GeneralSettings />}
{isGamesSettings && <GamesSettings useDetails={false} />}
{isGamesSettings && <GamesSettings />}
{isSyncSettings && <SyncSaves />}
{isAdvancedSetting && <AdvancedSettings />}
{isLogSettings && <LogSettings />}
Expand Down
20 changes: 20 additions & 0 deletions src/frontend/screens/Settings/sections/GamesSettings/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@
}
}

.MuiTabs-root {
padding-bottom: var(--space-xs);

.MuiTabs-scroller {
.MuiTabs-indicator {
background-color: var(--accent);
}

.MuiTabs-flexContainer {
.MuiTab-root {
color: var(--text-default);
}

.Mui-selected {
color: var(--accent);
}
}
}
}

// details, should have an hover effect and a pointer cursor and also the summary should be bold and have a background color
details {
cursor: pointer;
Expand Down
Loading