From fb4d053213bdbda271a54b517a11a89c4780f80a Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Wed, 9 Sep 2026 20:45:20 -0400 Subject: fix: restore profile and Flatpak controls --- src/components/ConfigurationTab.tsx | 3 ++ src/components/Content.tsx | 11 +++- src/components/GameConfigurationSelector.tsx | 40 ++++++++++++++ src/components/SetupTab.tsx | 81 ++++++++++++++++++++++++---- src/components/index.ts | 1 + 5 files changed, 124 insertions(+), 12 deletions(-) (limited to 'src/components') diff --git a/src/components/ConfigurationTab.tsx b/src/components/ConfigurationTab.tsx index 90c1a7b..8f8690c 100644 --- a/src/components/ConfigurationTab.tsx +++ b/src/components/ConfigurationTab.tsx @@ -14,6 +14,7 @@ interface ConfigurationTabProps { onSelect: (appid: string) => void; onConfigChange: (fieldName: keyof ConfigurationData, value: boolean | number | string | string[]) => Promise; onEnable: (appid: string) => Promise; + onEnableAll: () => Promise; onRepair: (appid: string) => Promise; onReset: () => Promise; onResetAll: () => Promise; @@ -26,6 +27,7 @@ export function ConfigurationTab({ onSelect, onConfigChange, onEnable, + onEnableAll, onRepair, onReset, onResetAll, @@ -84,6 +86,7 @@ export function ConfigurationTab({ onSelect(appid); setDetailAppId(appid); }} + onEnableAll={onEnableAll} onResetAll={onResetAll} focusConfiguredToggle={focusConfiguredToggle} onConfiguredToggleFocused={clearConfiguredToggleFocusRequest} diff --git a/src/components/Content.tsx b/src/components/Content.tsx index ff2376b..58512d5 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -1,18 +1,20 @@ import { Tabs } from "@decky/ui"; import { useEffect, useRef, useState } from "react"; -import { FaGamepad, FaList, FaTools } from "react-icons/fa"; +import { FaFileAlt, FaGamepad, FaList, FaTools } from "react-icons/fa"; import { ConfigurationData } from "../config/configSchema"; import { tabStyles } from "../styles"; import { useGameConfiguration } from "../hooks/useGameConfiguration"; import { useInstallationActions } from "../hooks/useInstallationActions"; import { useInstallationStatus } from "../hooks/useLsfgHooks"; import { ConfigurationTab } from "./ConfigurationTab"; +import { ConfigFileTab } from "./ConfigFileTab"; import { NowPlayingTab } from "./NowPlayingTab"; import { SetupTab } from "./SetupTab"; const tabIcons = { nowPlaying: , games: , + configFile: , setup: , }; @@ -34,6 +36,7 @@ export function Content() { setSelectedAppId, save, enable, + enableAll, repair, resetSelected, resetAll, @@ -130,12 +133,18 @@ export function Content() { onSelect={setSelectedAppId} onConfigChange={(fieldName, value) => handleConfigChange(fieldName, value, true)} onEnable={enable} + onEnableAll={enableAll} onRepair={repair} onReset={resetSelected} onResetAll={resetAll} /> ), }, + { + id: "ConfigFile", + title: tabIcons.configFile, + content: , + }, { id: "Setup", title: tabIcons.setup, content: setupContent }, ] : [ diff --git a/src/components/GameConfigurationSelector.tsx b/src/components/GameConfigurationSelector.tsx index 2a92c67..92eacba 100644 --- a/src/components/GameConfigurationSelector.tsx +++ b/src/components/GameConfigurationSelector.tsx @@ -7,6 +7,7 @@ interface Props { targets: GameTarget[]; runningGame: GameTarget | null; onSelect: (appid: string) => void; + onEnableAll: () => Promise; onResetAll: () => Promise; focusConfiguredToggle?: boolean; onConfiguredToggleFocused?: () => void; @@ -95,6 +96,7 @@ export function GameConfigurationSelector({ targets, runningGame, onSelect, + onEnableAll, onResetAll, focusConfiguredToggle = false, onConfiguredToggleFocused, @@ -131,8 +133,39 @@ export function GameConfigurationSelector({ ); }; + const confirmEnableAll = () => { + showModal( + void onEnableAll()} + onCancel={() => {}} + />, + ); + }; + return ( <> + {targets.length === 0 && ( @@ -153,6 +186,13 @@ export function GameConfigurationSelector({ onToggle={toggleAvailable} onSelect={onSelect} /> + {availableGames.length > 0 && ( + + + Enable all available games + + + )} (null); const [advanced, setAdvanced] = useState(false); - const [busy, setBusy] = useState(false); + const [operation, setOperation] = useState(null); const refresh = async () => { try { @@ -51,6 +53,51 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) { if (!relevant || !status?.available) return null; + const runExtensionOperation = async (version: string, enabled: boolean) => { + const operationKey = `${enabled ? "enable" : "disable"}-${version}`; + setOperation(operationKey); + try { + const result = await setFlatpakExtensionEnabled(version, enabled); + if (!result.success) throw new Error(result.error || result.message || "Flatpak runtime update failed"); + await refresh(); + } catch (error) { + showErrorToast("Flatpak runtime update failed", String(error)); + } finally { + setOperation(null); + } + }; + + const confirmDisable = (version: string) => { + showModal( + void runExtensionOperation(version, false)} + onCancel={() => {}} + />, + ); + }; + + const handleExtensionToggle = (version: string, enabled: boolean) => { + const installed = status.installed_branches.includes(version); + const owned = status.owned_branches.includes(version); + if (!enabled && installed && !owned) { + showErrorToast( + "Flatpak runtime preserved", + `${version} was not installed by this plugin, so it will remain installed.`, + ); + void refresh(); + return; + } + if (!enabled && installed && owned) { + confirmDisable(version); + return; + } + void runExtensionOperation(version, enabled); + }; + const confirmCleanup = () => { showModal( { - setBusy(true); + setOperation("cleanup"); try { - await removePluginOwnedFlatpakExtensions(); + const result = await removePluginOwnedFlatpakExtensions(); + if (!result.success) throw new Error(result.error || result.message || "Flatpak cleanup failed"); await refresh(); + } catch (error) { + showErrorToast("Flatpak cleanup failed", String(error)); } finally { - setBusy(false); + setOperation(null); } }} onCancel={() => {}} @@ -89,13 +139,22 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) { <> {status.supported_branches.map((branch) => ( - handleExtensionToggle(branch, enabled)} + disabled={operation !== null || status.ownership_uncertain} /> ))} @@ -107,10 +166,10 @@ function FlatpakSupportDiagnostics({ relevant }: { relevant: boolean }) { - {busy ? "Removing..." : "Remove plugin-installed extensions"} + {operation === "cleanup" ? "Removing..." : "Remove plugin-installed extensions"} diff --git a/src/components/index.ts b/src/components/index.ts index 7c3ee0a..6856e76 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -4,6 +4,7 @@ export { InstallationButton } from "./InstallationButton"; export { ConfigurationSection } from "./ConfigurationSection"; export { FpsMultiplierControl } from "./FpsMultiplierControl"; export { ConfigurationTab } from "./ConfigurationTab"; +export { ConfigFileTab } from "./ConfigFileTab"; export { SetupTab } from "./SetupTab"; export { GameConfigurationSelector } from "./GameConfigurationSelector"; export { GameConfigurationControls } from "./GameConfigurationControls"; -- cgit v1.2.3