diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-23 00:08:36 -0500 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-23 00:08:36 -0500 |
| commit | 23b4d45c34bdf2211cb74ac19b36d8086eccbb89 (patch) | |
| tree | 610a33a1693048c828d1bcbe1bd9283c8d85e3a5 /src | |
| parent | 52cbb5022f0d6b8b27d7537316630c02982a6bf9 (diff) | |
| download | Decky-Framegen-23b4d45c34bdf2211cb74ac19b36d8086eccbb89.tar.gz Decky-Framegen-23b4d45c34bdf2211cb74ac19b36d8086eccbb89.zip | |
add uninstaller button and script
Diffstat (limited to 'src')
| -rwxr-xr-x | src/index.tsx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/index.tsx b/src/index.tsx index b5211ea..aa2c55e 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -12,6 +12,11 @@ const runInstallFGMod = callable< { status: string; message?: string; output?: string } >("run_install_fgmod"); +const runUninstallFGMod = callable< + [], + { status: string; message?: string; output?: string } +>("run_uninstall_fgmod"); + const checkFGModPath = callable< [], { exists: boolean } @@ -19,11 +24,17 @@ const checkFGModPath = callable< function FGModInstallerSection() { const [installing, setInstalling] = useState(false); + const [uninstalling, setUninstalling] = useState(false); const [installResult, setInstallResult] = useState<{ status: string; output?: string; message?: string; } | null>(null); + const [uninstallResult, setUninstallResult] = useState<{ + status: string; + output?: string; + message?: string; + } | null>(null); const [pathExists, setPathExists] = useState<boolean | null>(null); useEffect(() => { @@ -46,6 +57,13 @@ function FGModInstallerSection() { setInstallResult(result); }; + const handleUninstallClick = async () => { + setUninstalling(true); + const result = await runUninstallFGMod(); + setUninstalling(false); + setUninstallResult(result); + }; + return ( <PanelSection title="FG Mod Installer"> <PanelSectionRow> @@ -53,6 +71,11 @@ function FGModInstallerSection() { {installing ? "Installing..." : "Install FG Mod"} </ButtonItem> </PanelSectionRow> + <PanelSectionRow> + <ButtonItem layout="below" onClick={handleUninstallClick} disabled={uninstalling}> + {uninstalling ? "Uninstalling..." : "Uninstall FG Mod"} + </ButtonItem> + </PanelSectionRow> {installResult && ( <PanelSectionRow> <div> @@ -73,6 +96,26 @@ function FGModInstallerSection() { </div> </PanelSectionRow> )} + {uninstallResult && ( + <PanelSectionRow> + <div> + <strong>Status:</strong>{" "} + {uninstallResult.status === "success" ? "Success" : "Error"} + <br /> + {uninstallResult.output && ( + <> + <strong>Output:</strong> + <pre style={{ whiteSpace: "pre-wrap" }}>{uninstallResult.output}</pre> + </> + )} + {uninstallResult.message && ( + <> + <strong>Error:</strong> {uninstallResult.message} + </> + )} + </div> + </PanelSectionRow> + )} {pathExists !== null && ( <PanelSectionRow> <div style={{ color: pathExists ? "green" : "red" }}> |
