summaryrefslogtreecommitdiff
path: root/src/index.tsx
diff options
context:
space:
mode:
authorKurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>2025-07-21 10:05:39 -0400
committerGitHub <noreply@github.com>2025-07-21 10:05:39 -0400
commit9573344450de451b8f9c7295c11318010d67f1d5 (patch)
tree1df1f75d3add63a65b9554a08c54165f41bf415f /src/index.tsx
parenta5796c1bd7957731215e858d169f2831a328cb55 (diff)
downloadDecky-Framegen-9573344450de451b8f9c7295c11318010d67f1d5.tar.gz
Decky-Framegen-9573344450de451b8f9c7295c11318010d67f1d5.zip
Refresh UI (#117)v0.11.2
* initial visual refinement * rm dupe status pops * hide other menus if uninstalled opti * bump ver * fix ver bump
Diffstat (limited to 'src/index.tsx')
-rw-r--r--src/index.tsx42
1 files changed, 35 insertions, 7 deletions
diff --git a/src/index.tsx b/src/index.tsx
index 41f8dc3..0bd00c0 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,20 +1,48 @@
import { definePlugin } from "@decky/api";
import { RiAiGenerate } from "react-icons/ri";
+import { useState, useEffect } from "react";
import { FGModInstallerSection } from "./components/FGModInstallerSection";
import { InstalledGamesSection } from "./components/InstalledGamesSection";
import { DocumentationButton } from "./components/DocumentationButton";
+import { checkFGModPath } from "./api";
+import { safeAsyncOperation } from "./utils";
+import { TIMEOUTS } from "./utils/constants";
+
+function MainContent() {
+ const [pathExists, setPathExists] = useState<boolean | null>(null);
+
+ useEffect(() => {
+ const checkPath = async () => {
+ const result = await safeAsyncOperation(
+ async () => await checkFGModPath(),
+ 'MainContent -> checkPath'
+ );
+ if (result) setPathExists(result.exists);
+ };
+
+ checkPath(); // Initial check
+ const intervalId = setInterval(checkPath, TIMEOUTS.pathCheck); // Check every 3 seconds
+ return () => clearInterval(intervalId); // Cleanup interval on component unmount
+ }, []);
+
+ return (
+ <>
+ <FGModInstallerSection pathExists={pathExists} setPathExists={setPathExists} />
+ {pathExists === true ? (
+ <>
+ <InstalledGamesSection />
+ <DocumentationButton />
+ </>
+ ) : null}
+ </>
+ );
+}
export default definePlugin(() => ({
name: "Framegen Plugin",
titleView: <div>Decky Framegen</div>,
alwaysRender: true,
- content: (
- <>
- <FGModInstallerSection />
- <InstalledGamesSection />
- <DocumentationButton />
- </>
- ),
+ content: <MainContent />,
icon: <RiAiGenerate />,
onDismount() {
console.log("Framegen Plugin unmounted");