From 86a5a7b744ed62e73f2da0dd4cd0361ba1ce5582 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Mon, 13 Apr 2026 14:40:49 -0700 Subject: [PATCH] Re-add this back --- src/app/main/game/page.tsx | 39 +++++++++++++++++++++++++------------- src/app/main/page.tsx | 30 +++++++++++++++++------------ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/src/app/main/game/page.tsx b/src/app/main/game/page.tsx index f36871c..6305881 100644 --- a/src/app/main/game/page.tsx +++ b/src/app/main/game/page.tsx @@ -57,6 +57,16 @@ export default function Installs () { ) } + const filteredVersions = 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 === id && + (category == -1 ? info.category == -1 : info.category == category) + ) + }) + return (
@@ -191,19 +201,22 @@ export default function Installs () {
) })} - {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 === id && - (category == -1 - ? info.category == -1 - : info.category == category) - ) - }) + {filteredVersions.length === 0 && + (category !== -1 || + 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 === id + }).length === 0) && ( +
+

No versions installed

+
+ )} + {filteredVersions .sort((a, b) => { const infoA = serverVersionList?.versions.find(vf => vf.id == a) const infoB = serverVersionList?.versions.find(vf => vf.id == b) diff --git a/src/app/main/page.tsx b/src/app/main/page.tsx index e75c187..548d1bb 100644 --- a/src/app/main/page.tsx +++ b/src/app/main/page.tsx @@ -32,6 +32,13 @@ export default function Installs () { setSelectedVersionList([]) }, [setSelectedVersionList, showPopup]) + const filteredGames = + serverVersionList?.games.filter(g => + serverVersionList.versions + .filter(v => v.game === g.id) + .some(v => Object.keys(versionsList).includes(v.id)) + ) ?? [] + return (
@@ -57,13 +64,12 @@ export default function Installs () { : 'h-[calc(100vh-84px)]' }`} > - {serverVersionList?.games - .filter(g => - serverVersionList.versions - .filter(v => v.game === g.id) - .some(v => Object.keys(versionsList).includes(v.id)) - ) - .map(i => ( + {filteredGames.length == 0 ? ( +
+

No games installed

+
+ ) : ( + filteredGames.map(i => (

{(() => { - const gameVersions = - serverVersionList.versions.filter( - v => v.game === i.id - ) + const gameVersions = ( + serverVersionList?.versions ?? [] + ).filter(v => v.game === i.id) const installed = gameVersions.filter(v => Object.keys(versionsList).includes(v.id) ).length @@ -126,7 +131,8 @@ export default function Installs () {

- ))} + )) + )}