import { useState, useEffect } from "react"; import { PanelSection, PanelSectionRow, ButtonItem, } from "@decky/ui"; import { definePlugin, callable } from "@decky/api"; import { FaShip } from "react-icons/fa"; const runInstallFGMod = callable< [], { status: string; message?: string; output?: string } >("run_install_fgmod"); const checkFGModPath = callable< [], { exists: boolean } >("check_fgmod_path"); function FGModInstallerSection() { const [installing, setInstalling] = useState(false); const [installResult, setInstallResult] = useState<{ status: string; output?: string; message?: string; } | null>(null); const [pathExists, setPathExists] = useState(null); useEffect(() => { const checkPath = async () => { const result = await checkFGModPath(); setPathExists(result.exists); }; checkPath(); }, []); const handleInstallClick = async () => { setInstalling(true); const result = await runInstallFGMod(); setInstalling(false); setInstallResult(result); }; return ( {installing ? "Installing..." : "Install FG Mod"} {installResult && (
Status:{" "} {installResult.status === "success" ? "Success" : "Error"}
{installResult.output && ( <> Output:
{installResult.output}
)} {installResult.message && ( <> Error: {installResult.message} )}
)} {pathExists !== null && (
{pathExists ? "Path exists" : "Path does not exist"}
)}
); } export default definePlugin(() => ({ name: "Framegen Plugin", titleView:
Framegen Plugin
, content: , icon: , onDismount() { console.log("Framegen Plugin unmounted"); }, })); function MainContent() { return ( <> ); }