From bac028efc3ebed098c8a52d8843ceca1399a328a Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Wed, 29 Jul 2026 05:08:57 -0700 Subject: [PATCH] Rename Games page to Library & remove sidebar always show games setting --- src/app/main/layout.tsx | 10 +- src/app/main/{games => library}/page.tsx | 2 +- src/app/main/settings/page.tsx | 12 -- src/components/Sidebar.tsx | 184 +++++++++++------------ src/providers/GlobalProvider.tsx | 1 - 5 files changed, 89 insertions(+), 120 deletions(-) rename src/app/main/{games => library}/page.tsx (99%) diff --git a/src/app/main/layout.tsx b/src/app/main/layout.tsx index ed83016..e45aa09 100644 --- a/src/app/main/layout.tsx +++ b/src/app/main/layout.tsx @@ -86,8 +86,6 @@ export default function RootLayout ({ const [versions, setVersions] = useState(null) const [account, setAccount] = useState(null) - const [sidebarAlwaysShowGames, setSidebarAlwaysShowGames] = - useState(false) const [linuxUseWine, setLinuxUseWine] = useState(false) const [linuxWineCommand, setLinuxWineCommand] = useState('wine %path%') @@ -357,7 +355,7 @@ export default function RootLayout ({ } const closePopup = useCallback(() => { - if (popupMode == 0 && selectedGame && pathname === '/main/games') { + if (popupMode == 0 && selectedGame && pathname === '/main/library') { setSelectedGame(null) setSelectedVersionList([]) } else if (viewingInfoFromDownloads) { @@ -829,9 +827,6 @@ export default function RootLayout ({ } watchSettings('theme', v => setTheme(v ?? 'dark')) - watchSettings('sidebarAlwaysShowGames', v => - setSidebarAlwaysShowGames(v ?? true) - ) watchSettings('linuxUseWine', v => setLinuxUseWine(v ?? false)) watchSettings('linuxWineCommand', v => setLinuxWineCommand(v ?? 'wine %path%') @@ -897,7 +892,6 @@ export default function RootLayout ({ settings, versions, account, - sidebarAlwaysShowGames, linuxUseWine, linuxWineCommand, theme, @@ -955,7 +949,7 @@ export default function RootLayout ({ icon={ (popupMode == 0 && selectedGame && - pathname === '/main/games') || + pathname === '/main/library') || viewingInfoFromDownloads || (popupMode == 3 && showModInfo) || popupMode == 4 diff --git a/src/app/main/games/page.tsx b/src/app/main/library/page.tsx similarity index 99% rename from src/app/main/games/page.tsx rename to src/app/main/library/page.tsx index 555a217..cc09bc2 100644 --- a/src/app/main/games/page.tsx +++ b/src/app/main/library/page.tsx @@ -11,7 +11,7 @@ import { import { platform } from '@tauri-apps/plugin-os' import { useRouter } from 'next/navigation' -export default function GamesPage () { +export default function LibraryPage () { const { versionsList, serverVersionList, diff --git a/src/app/main/settings/page.tsx b/src/app/main/settings/page.tsx index b90e903..15f848e 100644 --- a/src/app/main/settings/page.tsx +++ b/src/app/main/settings/page.tsx @@ -21,7 +21,6 @@ export default function SettingsPage () { account, version, versionsList, - sidebarAlwaysShowGames, linuxUseWine, linuxWineCommand, theme, @@ -34,17 +33,6 @@ export default function SettingsPage () {

Settings

- { - await settings?.set( - 'sidebarAlwaysShowGames', - !sidebarAlwaysShowGames - ) - }} - title="This setting will make it so when you are on a page like this, the games won't disappear." - /> - Games + Library - {serverVersionList?.games - .filter(g => - serverVersionList.versions - .filter(v => v.game === g.id) - .some(v => Object.keys(versionsList).includes(v.id)) - ) - .map(i => ( - -
{ - setCategory(-1) - router.push('/main/game?id=' + i.id) - }} - onContextMenu={e => { - e.preventDefault() - setManagingGame(i.id) - setPopupMode(5) - setShowPopup(true) - setFadeOut(false) - }} - title='Click to view game installs.' - > -
- 0 - ? faLayerGroup - : faGamepad - } - className='mr-1' - /> - {i.name} -
-
- {Object.entries(i.categoryNames) - .sort(([a], [b]) => Number(b) - Number(a)) - .filter(([key]) => { - const count = Object.keys(versionsList).filter(v => { - const info = serverVersionList.versions.find( - vf => vf.id == v - ) - if (!info) return false - - if (platform() == 'linux' && info.wine && !linuxUseWine) - return false - - return info.game === i.id && info.category === Number(key) - }).length - - return count >= 1 - }) - .map(([key, value]) => ( -
{ - setCategory(Number(key)) - router.push('/main/game?id=' + i.id) - }} - title="Click to view this game's category." - > -
- - {value} -
+ {(pathname === '/main/library' || pathname.startsWith('/main/game')) && + serverVersionList?.games + .filter(g => + serverVersionList.versions + .filter(v => v.game === g.id) + .some(v => Object.keys(versionsList).includes(v.id)) + ) + .map(i => ( + +
{ + setCategory(-1) + router.push('/main/game?id=' + i.id) + }} + onContextMenu={e => { + e.preventDefault() + setManagingGame(i.id) + setPopupMode(5) + setShowPopup(true) + setFadeOut(false) + }} + title='Click to view game installs.' + > +
+ 0 + ? faLayerGroup + : faGamepad + } + className='mr-1' + /> + {i.name}
- ))} - - ))} +
+ {Object.entries(i.categoryNames) + .sort(([a], [b]) => Number(b) - Number(a)) + .filter(([key]) => { + const count = Object.keys(versionsList).filter(v => { + const info = serverVersionList.versions.find( + vf => vf.id == v + ) + if (!info) return false + + if (platform() == 'linux' && info.wine && !linuxUseWine) + return false + + return info.game === i.id && info.category === Number(key) + }).length + + return count >= 1 + }) + .map(([key, value]) => ( +
{ + setCategory(Number(key)) + router.push('/main/game?id=' + i.id) + }} + title="Click to view this game's category." + > +
+ + {value} +
+
+ ))} +
+ ))}