From 683158e31e50f20479914aea1354e0a2f9b77544 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Fri, 1 May 2026 13:37:24 -0700 Subject: [PATCH] Improve the logic for this I guess --- src/popups/ManageVersion.tsx | 293 ++++++++++++++++++----------------- 1 file changed, 147 insertions(+), 146 deletions(-) diff --git a/src/popups/ManageVersion.tsx b/src/popups/ManageVersion.tsx index 5823b4c..96aee83 100644 --- a/src/popups/ManageVersion.tsx +++ b/src/popups/ManageVersion.tsx @@ -48,165 +48,166 @@ export default function ManageVersionPopup () {

Viewing {versionInfo?.displayName}

- - -
setPopupMode(4)} - hidden={!versionInfo?.changelog} - > -

View Changelog

- -
+ + )}
-
- -
openFolder(managingVersion)} - title="Click to browse the game's files." - hidden={viewingInfoFromDownloads} - > - Open Folder - -
-
{ - closePopup() + {!viewingInfoFromDownloads && ( +
+
+ +

+ Size on disk:{' '} + {prettyBytes(versionSize, { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + })} +

+
+
openFolder(managingVersion)} + title="Click to browse the game's files." + > + Open Folder + +
+
{ + closePopup() - await versions?.set( - 'list', - Object.fromEntries( - Object.entries(versionsList).filter( - ([k]) => k !== managingVersion + await versions?.set( + 'list', + Object.fromEntries( + Object.entries(versionsList).filter( + ([k]) => k !== managingVersion + ) ) ) - ) - if ( - await exists( - (customDataLocation ? customDataLocation + '/' : null) + - 'game/' + - managingVersion, - { - baseDir: customDataLocation - ? undefined - : 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 -
-
{ - //change popup to downloads - setManagingVersion(null) - setPopupMode(1) - - //uninstall - await versions?.set( - 'list', - Object.fromEntries( - Object.entries(versionsList).filter( - ([k]) => k !== managingVersion + if ( + await exists( + (customDataLocation ? customDataLocation + '/' : null) + + 'game/' + + managingVersion, + { + baseDir: customDataLocation + ? undefined + : 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.' + > + Uninstall +
+
{ + //change popup to downloads + setManagingVersion(null) + setPopupMode(1) - if ( - await exists( - (customDataLocation ? customDataLocation + '/' : null) + - 'game/' + - managingVersion, - { - baseDir: customDataLocation - ? undefined - : BaseDirectory.AppLocalData - } - ) - ) - await remove( - (customDataLocation ? customDataLocation + '/' : null) + - 'game/' + - managingVersion, - { - baseDir: customDataLocation - ? undefined - : BaseDirectory.AppLocalData, - recursive: true - } + //uninstall + await versions?.set( + 'list', + Object.fromEntries( + Object.entries(versionsList).filter( + ([k]) => k !== managingVersion + ) + ) ) - //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 + if ( + await exists( + (customDataLocation ? customDataLocation + '/' : null) + + 'game/' + + managingVersion, + { + baseDir: customDataLocation + ? undefined + : BaseDirectory.AppLocalData + } + ) + ) + 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." + > + Reinstall +
-
+ )}
)