Improve this popup a little

This commit is contained in:
Lncvrt committed 2026-05-01 13:26:41 -07:00
1 parent e0a20ddcf1
commit a1a719ba72
1 file changed
+150 -140
+150 -140
View File
@@ -46,156 +46,166 @@ export default function ManageVersionPopup () {
return ( return (
<> <>
<p className='text-xl text-center'>Viewing {versionInfo?.displayName}</p> <p className='text-xl text-center'>Viewing {versionInfo?.displayName}</p>
<div className='popup-content flex flex-col items-center justify-center gap-2 h-full'> <div className='popup-content h-full w-full flex justify-center items-center flex-col gap-2'>
<div <div className='flex flex-row gap-2 justify-center'>
className='entry-info-item btntheme2' <div
hidden={viewingInfoFromDownloads} className='entry-info-item btntheme2'
> hidden={viewingInfoFromDownloads}
<p> >
Installed{' '} <p>
{new Intl.DateTimeFormat(undefined).format( Installed{' '}
versionsList[managingVersion] ?? 0 {new Intl.DateTimeFormat(undefined).format(
)} versionsList[managingVersion] ?? 0
</p> )}
</p>
</div>
<div
className='entry-info-item btntheme2'
hidden={!versionInfo || versionInfo.releaseDate == 0}
>
<p>
Released{' '}
{new Intl.DateTimeFormat(undefined).format(
versionInfo?.releaseDate ? versionInfo.releaseDate * 1000 : 0
)}
</p>
</div>
<div
className='entry-info-item btntheme2'
onClick={() => setPopupMode(4)}
hidden={!versionInfo?.changelog}
>
<p>View Changelog</p>
<FontAwesomeIcon
icon={faArrowUpRightFromSquare}
color='lightgray'
/>
</div>
</div> </div>
<div <div className='flex flex-row gap-2 justify-center'>
className='entry-info-item btntheme2' <div
hidden={!versionInfo || versionInfo.releaseDate == 0} className='entry-info-item btntheme2'
> hidden={viewingInfoFromDownloads}
<p> >
Released{' '} <FontAwesomeIcon icon={faHardDrive} color='lightgray' />
{new Intl.DateTimeFormat(undefined).format( <p>
versionInfo?.releaseDate ? versionInfo.releaseDate * 1000 : 0 Size on disk:{' '}
)} {prettyBytes(versionSize, {
</p> minimumFractionDigits: 2,
</div> maximumFractionDigits: 2
<div })}
className='entry-info-item btntheme2' </p>
hidden={viewingInfoFromDownloads} </div>
> <div
<FontAwesomeIcon icon={faHardDrive} color='lightgray' /> className='entry-info-item btntheme2'
<p> onClick={async () => openFolder(managingVersion)}
Size on disk:{' '} title="Click to browse the game's files."
{prettyBytes(versionSize, { hidden={viewingInfoFromDownloads}
minimumFractionDigits: 2, >
maximumFractionDigits: 2 Open Folder
})} <FontAwesomeIcon
</p> icon={faArrowUpRightFromSquare}
</div> color='lightgray'
<div />
className='entry-info-item btntheme2' </div>
onClick={() => setPopupMode(4)} <div
hidden={!versionInfo?.changelog} className='entry-info-item btntheme2'
> onClick={async () => {
<p>View Changelog</p> closePopup()
<FontAwesomeIcon icon={faArrowUpRightFromSquare} color='lightgray' />
</div>
<div
className='entry-info-item btntheme2'
onClick={async () => openFolder(managingVersion)}
title="Click to browse the game's files."
hidden={viewingInfoFromDownloads}
>
Open Folder
<FontAwesomeIcon icon={faArrowUpRightFromSquare} color='lightgray' />
</div>
<div
className='entry-info-item btntheme2'
onClick={async () => {
closePopup()
await versions?.set( await versions?.set(
'list', 'list',
Object.fromEntries( Object.fromEntries(
Object.entries(versionsList).filter( Object.entries(versionsList).filter(
([k]) => k !== managingVersion ([k]) => k !== managingVersion
)
) )
) )
)
if ( if (
await exists( await exists(
(customDataLocation ? customDataLocation + '/' : null) + (customDataLocation ? customDataLocation + '/' : null) +
'game/' + 'game/' +
managingVersion, managingVersion,
{ {
baseDir: customDataLocation baseDir: customDataLocation
? undefined ? undefined
: BaseDirectory.AppLocalData : BaseDirectory.AppLocalData
} }
)
)
await remove(
(customDataLocation ? customDataLocation + '/' : null) +
'game/' +
managingVersion,
{
baseDir: customDataLocation
? undefined
: BaseDirectory.AppLocalData,
recursive: true
}
)
}}
title='Click to uninstall this game. This will NOT remove any progress or any save files.'
hidden={viewingInfoFromDownloads}
>
Uninstall
</div>
<div
className='entry-info-item btntheme2'
onClick={async () => {
//change popup to downloads
setManagingVersion(null)
setPopupMode(1)
//uninstall
await versions?.set(
'list',
Object.fromEntries(
Object.entries(versionsList).filter(
([k]) => k !== managingVersion
) )
) )
) await remove(
(customDataLocation ? customDataLocation + '/' : null) +
'game/' +
managingVersion,
{
baseDir: customDataLocation
? undefined
: BaseDirectory.AppLocalData,
recursive: true
}
)
}}
title='Click to uninstall this game. This will NOT remove any progress or any save files.'
hidden={viewingInfoFromDownloads}
>
Uninstall
</div>
<div
className='entry-info-item btntheme2'
onClick={async () => {
//change popup to downloads
setManagingVersion(null)
setPopupMode(1)
if ( //uninstall
await exists( await versions?.set(
(customDataLocation ? customDataLocation + '/' : null) + 'list',
'game/' + Object.fromEntries(
managingVersion, Object.entries(versionsList).filter(
{ ([k]) => k !== managingVersion
baseDir: customDataLocation )
? undefined )
: BaseDirectory.AppLocalData
}
)
)
await remove(
(customDataLocation ? customDataLocation + '/' : null) +
'game/' +
managingVersion,
{
baseDir: customDataLocation
? undefined
: BaseDirectory.AppLocalData,
recursive: true
}
) )
//reinstall if (
setSelectedVersionList([managingVersion]) await exists(
downloadVersions([ (customDataLocation ? customDataLocation + '/' : null) +
{ 'game/' +
id: managingVersion, managingVersion,
type: 0 {
} baseDir: customDataLocation
]) ? undefined
}} : BaseDirectory.AppLocalData
title="Click to reinstall this game. This will NOT remove any progress or any save files. This WILL uninstall any modifications to the game's executable files." }
hidden={viewingInfoFromDownloads} )
> )
Reinstall await remove(
(customDataLocation ? customDataLocation + '/' : null) +
'game/' +
managingVersion,
{
baseDir: customDataLocation
? undefined
: BaseDirectory.AppLocalData,
recursive: true
}
)
//reinstall
setSelectedVersionList([managingVersion])
downloadVersions([
{
id: managingVersion,
type: 0
}
])
}}
title="Click to reinstall this game. This will NOT remove any progress or any save files. This WILL uninstall any modifications to the game's executable files."
hidden={viewingInfoFromDownloads}
>
Reinstall
</div>
</div> </div>
</div> </div>
</> </>