Make it say there is no versions available if there are none, rather than showing nothing

This commit is contained in:
Lncvrt committed 2026-05-01 13:15:46 -07:00
1 parent 3e45caf4f3
commit abeeab79d7
4 files changed
+42 -23

No files matched your search

+21 -7
View File
@@ -6,20 +6,28 @@ import {
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
export default function GamesDownloadPopup () { export default function GamesDownloadPopup () {
const { serverVersionList, setSelectedGame } = useGlobal() const {
serverVersionList,
setSelectedGame,
setManagingGame,
setPopupMode,
setShowPopup,
setFadeOut,
setViewingInfoFromDownloads
} = useGlobal()
return ( return (
<> <>
<p className='text-xl text-center'>Select a game to download</p> <p className='text-xl text-center'>Select a game to download</p>
<div className='popup-content'> <div className='popup-content'>
{serverVersionList?.games {serverVersionList?.games
.filter(i => { .filter(g => {
const gameVersions = serverVersionList.versions.filter( const gameVersions = serverVersionList.versions.filter(
vf => vf.game === i.id gv => gv.game === g.id
) )
if (gameVersions.length > 0) return true if (gameVersions.length > 0) return true
}) })
.map((v, i) => ( .map((g, i) => (
<div <div
key={i} key={i}
className='popup-entry grid items-center gap-3' className='popup-entry grid items-center gap-3'
@@ -27,15 +35,21 @@ export default function GamesDownloadPopup () {
> >
<button <button
className='button btntheme3' className='button btntheme3'
onClick={() => setSelectedGame(v.id)} onClick={() => {
setViewingInfoFromDownloads(true)
setManagingGame(g.id)
setPopupMode(5)
setShowPopup(true)
setFadeOut(false)
}}
title='Click to view game info.' title='Click to view game info.'
> >
<FontAwesomeIcon icon={faInfo} /> Info <FontAwesomeIcon icon={faInfo} /> Info
</button> </button>
<p className='text-2xl text-center truncate'>{v.name}</p> <p className='text-2xl text-center truncate'>{g.name}</p>
<button <button
className='button btntheme3' className='button btntheme3'
onClick={() => setSelectedGame(v.id)} onClick={() => setSelectedGame(g.id)}
title='Click to view more versions of the game.' title='Click to view more versions of the game.'
> >
<FontAwesomeIcon icon={faArrowUpRightFromSquare} /> View <FontAwesomeIcon icon={faArrowUpRightFromSquare} /> View
+6 -9
View File
@@ -19,7 +19,6 @@ export default function ManageGamePopup () {
const { const {
versionsList, versionsList,
serverVersionList, serverVersionList,
viewingInfoFromDownloads,
closePopup, closePopup,
versions, versions,
customDataLocation, customDataLocation,
@@ -35,7 +34,7 @@ export default function ManageGamePopup () {
const gameInfo = serverVersionList?.games.find(vf => vf.id == managingGame) const gameInfo = serverVersionList?.games.find(vf => vf.id == managingGame)
useEffect(() => { useEffect(() => {
if (viewingInfoFromDownloads || !versionsInstalled) return if (!versionsInstalled || versionsInstalled.length == 0) return
let cancelled = false let cancelled = false
@@ -60,7 +59,7 @@ export default function ManageGamePopup () {
return () => { return () => {
cancelled = true cancelled = true
} }
}, [versionsInstalled, viewingInfoFromDownloads]) }, [versionsInstalled])
return ( return (
<> <>
@@ -105,17 +104,15 @@ export default function ManageGamePopup () {
</div> </div>
<div <div
className='entry-info-item btntheme2' className='entry-info-item btntheme2'
hidden={viewingInfoFromDownloads} hidden={versionsInstalled?.length == 0}
> >
<FontAwesomeIcon icon={faHardDrive} color='lightgray' /> <FontAwesomeIcon icon={faHardDrive} color='lightgray' />
<p> <p>
Size on disk:{' '} Size on disk:{' '}
{gameSize && gameSize > 0 {prettyBytes(gameSize, {
? prettyBytes(gameSize, {
minimumFractionDigits: 2, minimumFractionDigits: 2,
maximumFractionDigits: 2 maximumFractionDigits: 2
}) })}
: 'N/A'}
</p> </p>
</div> </div>
<div <div
@@ -160,7 +157,7 @@ export default function ManageGamePopup () {
} }
}} }}
title='Click to uninstall this game. This will NOT remove any progress or any save files.' title='Click to uninstall this game. This will NOT remove any progress or any save files.'
hidden={viewingInfoFromDownloads} hidden={versionsInstalled?.length == 0}
> >
Uninstall Uninstall
</div> </div>
+2 -4
View File
@@ -101,12 +101,10 @@ export default function ManageVersionPopup () {
<FontAwesomeIcon icon={faHardDrive} color='lightgray' /> <FontAwesomeIcon icon={faHardDrive} color='lightgray' />
<p> <p>
Size on disk:{' '} Size on disk:{' '}
{versionSize && versionSize > 0 {prettyBytes(versionSize, {
? prettyBytes(versionSize, {
minimumFractionDigits: 2, minimumFractionDigits: 2,
maximumFractionDigits: 2 maximumFractionDigits: 2
}) })}
: 'N/A'}
</p> </p>
</div> </div>
<div <div
+13 -3
View File
@@ -25,7 +25,8 @@ export default function VersionsDownloadPopup () {
<> <>
<p className='text-xl text-center'>Select versions to download</p> <p className='text-xl text-center'>Select versions to download</p>
<div className='popup-content'> <div className='popup-content'>
{list.map((v, i) => ( {list.length != 0 ? (
list.map((v, i) => (
<div <div
key={i} key={i}
className='popup-entry grid items-center gap-3' className='popup-entry grid items-center gap-3'
@@ -42,7 +43,10 @@ export default function VersionsDownloadPopup () {
> >
<FontAwesomeIcon icon={faInfo} /> Info <FontAwesomeIcon icon={faInfo} /> Info
</button> </button>
<p className='text-2xl text-center truncate' title={v.displayName}> <p
className='text-2xl text-center truncate'
title={v.displayName}
>
{v.displayName} {v.displayName}
</p> </p>
<button <button
@@ -71,7 +75,13 @@ export default function VersionsDownloadPopup () {
)} )}
</button> </button>
</div> </div>
))} ))
) : (
<div className='flex flex-col gap-2 justify-center text-center w-full h-full'>
<p className='text-2xl'>No versions available to download</p>
<p>You may have all versions installed for this game</p>
</div>
)}
</div> </div>
<div className='flex justify-center'> <div className='flex justify-center'>
<button <button