Skip to content

Commit 5dc05b8

Browse files
authored
[UI] Sidebar settings button opens game settings on GamePage (#1579)
* Fix sidebar settings button * fixes * lint fix * Add i18n fallback * lint fix * Renamed defaultSettingsPath to settingsPath * lint fix
1 parent 2617652 commit 5dc05b8

33 files changed

+68
-6
lines changed

public/locales/bg/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Магазин",
152152
"title": "Име на играта"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Няма намерени игри. Опитайте да излезете и влезете пак с регистрацията си, или пробвайте един от вариантите по-долу"

public/locales/ca/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Botiga",
152152
"title": "Títol del joc"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No s'han trobat jocs. Proveu a reiniciar la sessió o alguna de les opcions de sota."

public/locales/cs/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Obchod",
152152
"title": "Název hry"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Nebyly nalezeny žádné hry - Zkuste se znovu odhlásit a přihlásit nebo jednu z níže uvedených možností"

public/locales/de/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Keine Spiele gefunden - Versuchen Sie, sich abzumelden und erneut anzumelden, oder wählen Sie eine der folgenden Optionen"

public/locales/el/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/en/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/es/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/et/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Pood",
152152
"title": "Mängu pealkiri"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Mänge ei leitud - proovige uuesti sisse logida või ühte allolevatest võimalustest"

public/locales/fa/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "فروشگاه",
152152
"title": "عنوان بازی"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "بازی یافت نشد - خروج از حساب و ورود مجدد را امتحان کرده یا یکی از گزینه های زیر را امتحان کنید"

public/locales/fi/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/fr/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/gl/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/hr/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/hu/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/id/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Toko",
152152
"title": "Judul Gim"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Tidak ada Gim yang ditemukan - Silakan coba log keluar lalu log masuk lagi atau salah satu opsi di bawah ini"

public/locales/it/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/ja/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/ko/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/ml/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/nl/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/pl/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Sklep",
152152
"title": "Tytuł Gry"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Nie znaleziono żadnych gier - Spróbuj wylogować i zalogować się ponownie lub postępuj zgodnie z jedną z opcji poniżej"

public/locales/pt/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/pt_BR/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Loja",
152152
"title": "Título do jogo"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Nenhum jogo encontrado - Tente sair e fazer login novamente ou uma das opções abaixo"

public/locales/ru/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Магазин",
152152
"title": "Название игры"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Игры не найдены. Попробуйте выйти из системы и войти снова или один из вариантов ниже"

public/locales/sv/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/ta/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Store",
152152
"title": "Game Title"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "No Games found - Try to logout and login again or one of the options bellow"

public/locales/tr/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Mağaza",
152152
"title": "Oyun Adı"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Oyun bulunamadı - Oturumu kapatıp tekrar açmayı veya aşağıdaki seçeneklerden birini deneyin"

public/locales/uk/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Магазин",
152152
"title": "Назва гри"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Ігри не знайдено - Спробуйте вийти та увійти наново або один із варіантів нижче"

public/locales/vi/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "Cửa hàng",
152152
"title": "Tựa game"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "Không tìm thấy game - Hãy thử đăng xuất rồi đăng nhập lại hoặc một trong các cách sau"

public/locales/zh_Hans/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "商店",
152152
"title": "游戏名"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "没有发现游戏 - 尝试注销并再次登录或以下选项之一"

public/locales/zh_Hant/translation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@
151151
"store": "商店",
152152
"title": "遊戲名稱"
153153
},
154+
"GameSettings": "Game Settings",
154155
"generic": {
155156
"error": {
156157
"component": "沒有發現遊戲 - 嘗試登入並再次登入或以下選項之一"

src/components/UI/Sidebar/components/CurrentDownload/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default function CurrentDownload({ appName, runner }: Props) {
7070
<Box sx={{ width: '100%', mr: 1 }}>
7171
<LinearProgress
7272
variant="determinate"
73-
value={progress.percent}
73+
value={progress.percent || 0}
7474
/>
7575
</Box>
7676
<Box sx={{ minWidth: 35 }}>

src/components/UI/Sidebar/components/SidebarLinks/index.tsx

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
1010
import { NavLink, useNavigate, useLocation } from 'react-router-dom'
1111
import { openDiscordLink } from 'src/helpers'
1212
import classNames from 'classnames'
13-
import React, { useContext } from 'react'
13+
import React, { useContext, useEffect, useState } from 'react'
1414
import { useTranslation } from 'react-i18next'
1515
import { faDiscord, faPatreon } from '@fortawesome/free-brands-svg-icons'
1616
import {
@@ -46,7 +46,10 @@ export default function SidebarLinks() {
4646

4747
const isStore = location.pathname.includes('store')
4848
const isSettings = location.pathname.includes('settings')
49-
const isDefaultSetting = location.pathname.startsWith('/settings/default')
49+
const [isDefaultSetting, setIsDefaultSetting] = useState(
50+
location.pathname.startsWith('/settings/default')
51+
)
52+
const [settingsPath, setSettingsPath] = useState('/settings/default/general')
5053

5154
const {
5255
hasCloudSave = false,
@@ -62,6 +65,23 @@ export default function SidebarLinks() {
6265

6366
const loggedIn = epic.username || gog.username
6467

68+
useEffect(() => {
69+
let tmpAppName = ''
70+
if (location.pathname.startsWith('/gamepage/')) {
71+
tmpAppName = location.pathname.replace('/gamepage/', '')
72+
} else {
73+
tmpAppName = appName !== 'default' ? appName : ''
74+
}
75+
76+
if (tmpAppName) {
77+
setSettingsPath(`/settings/${tmpAppName}/wine`)
78+
setIsDefaultSetting(false)
79+
} else {
80+
setSettingsPath('/settings/default/general')
81+
setIsDefaultSetting(true)
82+
}
83+
}, [location])
84+
6585
return (
6686
<div className="SidebarLinks Sidebar__section">
6787
{loggedIn && (
@@ -145,14 +165,25 @@ export default function SidebarLinks() {
145165
className={({ isActive }) =>
146166
classNames('Sidebar__item', { active: isActive })
147167
}
148-
to={{ pathname: '/settings/default/general' }}
168+
to={{ pathname: settingsPath }}
149169
state={{ fromGameCard: false }}
150170
>
151171
<>
152172
<div className="Sidebar__itemIcon">
153-
<FontAwesomeIcon icon={faSlidersH} title={t('Settings')} />
173+
<FontAwesomeIcon
174+
icon={faSlidersH}
175+
title={
176+
isDefaultSetting
177+
? t('Settings')
178+
: t('GameSettings', 'Game Settings')
179+
}
180+
/>
154181
</div>
155-
<span>{t('Settings')}</span>
182+
<span>
183+
{isDefaultSetting
184+
? t('Settings')
185+
: t('GameSettings', 'Game Settings')}
186+
</span>
156187
</>
157188
</NavLink>
158189
{isSettings && (

0 commit comments

Comments
 (0)