From 28de5d077c1ca98325cca76b756f2afd486403a6 Mon Sep 17 00:00:00 2001
From: xXJSONDeruloXx <danielhimebauch@gmail.com>
Date: Thu, 23 Jan 2025 18:40:59 -0500
Subject: swap install and uninstall buttons depending on state

---
 src/index.tsx | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

(limited to 'src/index.tsx')

diff --git a/src/index.tsx b/src/index.tsx
index 4162cf7..18fb0a5 100755
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -87,16 +87,27 @@ function FGModInstallerSection() {
 
   return (
     <PanelSection title="FG Mod Installer">
-      <PanelSectionRow>
-        <ButtonItem layout="below" onClick={handleInstallClick} disabled={installing}>
-          {installing ? "Installing..." : "Install FG Mod"}
-        </ButtonItem>
-      </PanelSectionRow>
-      <PanelSectionRow>
-        <ButtonItem layout="below" onClick={handleUninstallClick} disabled={uninstalling}>
-          {uninstalling ? "Uninstalling..." : "Uninstall FG Mod"}
-        </ButtonItem>
-      </PanelSectionRow>
+      {pathExists !== null && (
+        <PanelSectionRow>
+          <div style={{ color: pathExists ? "green" : "red" }}>
+            {pathExists ? "Mod Is Installed" : "Mod Not Installed"}
+          </div>
+        </PanelSectionRow>
+      )}
+      {pathExists === false && (
+        <PanelSectionRow>
+          <ButtonItem layout="below" onClick={handleInstallClick} disabled={installing}>
+            {installing ? "Installing..." : "Install FG Mod"}
+          </ButtonItem>
+        </PanelSectionRow>
+      )}
+      {pathExists === true && (
+        <PanelSectionRow>
+          <ButtonItem layout="below" onClick={handleUninstallClick} disabled={uninstalling}>
+            {uninstalling ? "Uninstalling..." : "Uninstall FG Mod"}
+          </ButtonItem>
+        </PanelSectionRow>
+      )}
       {installResult && (
         <PanelSectionRow>
           <div>
@@ -137,13 +148,6 @@ function FGModInstallerSection() {
           </div>
         </PanelSectionRow>
       )}
-      {pathExists !== null && (
-        <PanelSectionRow>
-          <div style={{ color: pathExists ? "green" : "red" }}>
-            {pathExists ? "Mod Is Installed" : "Mod Not Installed"}
-          </div>
-        </PanelSectionRow>
-      )}
       <PanelSectionRow>
         <div>
           Once the patch is installed, launch your game, press "Set Launch Options" below, then restart the game!
-- 
cgit v1.2.3

