Skip to content

[UI] Sidebar settings button opens game settings on GamePage #1579

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

Merged
merged 8 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions public/locales/bg/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Магазин",
"title": "Име на играта"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Няма намерени игри. Опитайте да излезете и влезете пак с регистрацията си, или пробвайте един от вариантите по-долу"
Expand Down
1 change: 1 addition & 0 deletions public/locales/ca/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Botiga",
"title": "Títol del joc"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No s'han trobat jocs. Proveu a reiniciar la sessió o alguna de les opcions de sota."
Expand Down
1 change: 1 addition & 0 deletions public/locales/cs/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Obchod",
"title": "Název hry"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Nebyly nalezeny žádné hry - Zkuste se znovu odhlásit a přihlásit nebo jednu z níže uvedených možností"
Expand Down
1 change: 1 addition & 0 deletions public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Keine Spiele gefunden - Versuchen Sie, sich abzumelden und erneut anzumelden, oder wählen Sie eine der folgenden Optionen"
Expand Down
1 change: 1 addition & 0 deletions public/locales/el/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/et/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Pood",
"title": "Mängu pealkiri"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Mänge ei leitud - proovige uuesti sisse logida või ühte allolevatest võimalustest"
Expand Down
1 change: 1 addition & 0 deletions public/locales/fa/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "فروشگاه",
"title": "عنوان بازی"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "بازی یافت نشد - خروج از حساب و ورود مجدد را امتحان کرده یا یکی از گزینه های زیر را امتحان کنید"
Expand Down
1 change: 1 addition & 0 deletions public/locales/fi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/gl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/hr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/hu/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/id/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Toko",
"title": "Judul Gim"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Tidak ada Gim yang ditemukan - Silakan coba log keluar lalu log masuk lagi atau salah satu opsi di bawah ini"
Expand Down
1 change: 1 addition & 0 deletions public/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/ko/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/ml/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/nl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/pl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Sklep",
"title": "Tytuł Gry"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Nie znaleziono żadnych gier - Spróbuj wylogować i zalogować się ponownie lub postępuj zgodnie z jedną z opcji poniżej"
Expand Down
1 change: 1 addition & 0 deletions public/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/pt_BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Loja",
"title": "Título do jogo"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Nenhum jogo encontrado - Tente sair e fazer login novamente ou uma das opções abaixo"
Expand Down
1 change: 1 addition & 0 deletions public/locales/ru/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Магазин",
"title": "Название игры"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Игры не найдены. Попробуйте выйти из системы и войти снова или один из вариантов ниже"
Expand Down
1 change: 1 addition & 0 deletions public/locales/sv/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/ta/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Store",
"title": "Game Title"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "No Games found - Try to logout and login again or one of the options bellow"
Expand Down
1 change: 1 addition & 0 deletions public/locales/tr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Mağaza",
"title": "Oyun Adı"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Oyun bulunamadı - Oturumu kapatıp tekrar açmayı veya aşağıdaki seçeneklerden birini deneyin"
Expand Down
1 change: 1 addition & 0 deletions public/locales/uk/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Магазин",
"title": "Назва гри"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "Ігри не знайдено - Спробуйте вийти та увійти наново або один із варіантів нижче"
Expand Down
1 change: 1 addition & 0 deletions public/locales/vi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "Cửa hàng",
"title": "Tựa game"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"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"
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh_Hans/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "商店",
"title": "游戏名"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "没有发现游戏 - 尝试注销并再次登录或以下选项之一"
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh_Hant/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"store": "商店",
"title": "遊戲名稱"
},
"GameSettings": "Game Settings",
"generic": {
"error": {
"component": "沒有發現遊戲 - 嘗試登入並再次登入或以下選項之一"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function CurrentDownload({ appName, runner }: Props) {
<Box sx={{ width: '100%', mr: 1 }}>
<LinearProgress
variant="determinate"
value={progress.percent}
value={progress.percent || 0}
/>
</Box>
<Box sx={{ minWidth: 35 }}>
Expand Down
41 changes: 36 additions & 5 deletions src/components/UI/Sidebar/components/SidebarLinks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { NavLink, useNavigate, useLocation } from 'react-router-dom'
import { openDiscordLink } from 'src/helpers'
import classNames from 'classnames'
import React, { useContext } from 'react'
import React, { useContext, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { faDiscord, faPatreon } from '@fortawesome/free-brands-svg-icons'
import {
Expand Down Expand Up @@ -46,7 +46,10 @@ export default function SidebarLinks() {

const isStore = location.pathname.includes('store')
const isSettings = location.pathname.includes('settings')
const isDefaultSetting = location.pathname.startsWith('/settings/default')
const [isDefaultSetting, setIsDefaultSetting] = useState(
location.pathname.startsWith('/settings/default')
)
const [settingsPath, setSettingsPath] = useState('/settings/default/general')

const {
hasCloudSave = false,
Expand All @@ -62,6 +65,23 @@ export default function SidebarLinks() {

const loggedIn = epic.username || gog.username

useEffect(() => {
let tmpAppName = ''
if (location.pathname.startsWith('/gamepage/')) {
tmpAppName = location.pathname.replace('/gamepage/', '')
} else {
tmpAppName = appName !== 'default' ? appName : ''
}

if (tmpAppName) {
setSettingsPath(`/settings/${tmpAppName}/wine`)
setIsDefaultSetting(false)
} else {
setSettingsPath('/settings/default/general')
setIsDefaultSetting(true)
}
}, [location])

return (
<div className="SidebarLinks Sidebar__section">
{loggedIn && (
Expand Down Expand Up @@ -145,14 +165,25 @@ export default function SidebarLinks() {
className={({ isActive }) =>
classNames('Sidebar__item', { active: isActive })
}
to={{ pathname: '/settings/default/general' }}
to={{ pathname: settingsPath }}
state={{ fromGameCard: false }}
>
<>
<div className="Sidebar__itemIcon">
<FontAwesomeIcon icon={faSlidersH} title={t('Settings')} />
<FontAwesomeIcon
icon={faSlidersH}
title={
isDefaultSetting
? t('Settings')
: t('GameSettings', 'Game Settings')
}
/>
</div>
<span>{t('Settings')}</span>
<span>
{isDefaultSetting
? t('Settings')
: t('GameSettings', 'Game Settings')}
</span>
</>
</NavLink>
{isSettings && (
Expand Down