diff options
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" }}> |
