From e6efa4f0ff32d520982860180a29472068aab8e2 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Thu, 10 Sep 2026 09:53:55 -0400 Subject: simplify unhooked game behavior on mount --- src/components/ConfigurationTab.tsx | 14 ------------- src/components/Content.tsx | 9 ++++---- src/components/NowPlayingTab.tsx | 42 ++++++------------------------------- 3 files changed, 10 insertions(+), 55 deletions(-) (limited to 'src/components') diff --git a/src/components/ConfigurationTab.tsx b/src/components/ConfigurationTab.tsx index 8f8690c..8150819 100644 --- a/src/components/ConfigurationTab.tsx +++ b/src/components/ConfigurationTab.tsx @@ -37,7 +37,6 @@ export function ConfigurationTab({ const [focusDetailAction, setFocusDetailAction] = useState<"enable" | "fps" | null>(null); const [focusConfiguredToggle, setFocusConfiguredToggle] = useState(false); const enableRef = useRef(null); - const promptedRunningAppId = useRef(null); const closeDetails = useCallback(() => { setFocusFpsMultiplier(false); setFocusDetailAction(null); @@ -60,18 +59,6 @@ export function ConfigurationTab({ return () => cancelAnimationFrame(frame); }, [focusDetailAction]); - useEffect(() => { - if (!runningGame || runningGame.configured) { - promptedRunningAppId.current = null; - return; - } - if (promptedRunningAppId.current !== runningGame.appid && detailAppId === null) { - promptedRunningAppId.current = runningGame.appid; - setFocusDetailAction("enable"); - setDetailAppId(runningGame.appid); - } - }, [detailAppId, runningGame?.appid, runningGame?.configured]); - const selectedTarget = detailAppId ? targets.find((target) => target.appid === detailAppId) : null; if (detailAppId === null) { @@ -106,7 +93,6 @@ export function ConfigurationTab({ : "Game is no longer available"; const handleProfileAction = async () => { if (selectedTarget?.configured) { - promptedRunningAppId.current = detailAppId; await onReset(); setFocusConfiguredToggle(true); closeDetails(); diff --git a/src/components/Content.tsx b/src/components/Content.tsx index e5216ca..578f984 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -56,15 +56,15 @@ export function Content() { setTab("Setup"); return; } - setTab((current) => current === "Setup" ? (runningGame ? "NowPlaying" : "Games") : current); - }, [runningGame?.appid, setupComplete]); + setTab((current) => current === "Setup" ? (runningGame?.configured ? "NowPlaying" : "Games") : current); + }, [runningGame?.appid, runningGame?.configured, setupComplete]); useEffect(() => { if (!setupComplete) return; const appid = runningGame?.appid || null; const previous = previousRunningAppId.current; previousRunningAppId.current = appid; - if (appid && appid !== previous) setTab("NowPlaying"); + if (appid && appid !== previous) setTab(runningGame?.configured ? "NowPlaying" : "Games"); else if (!appid && previous) { setTab((current) => current === "NowPlaying" ? "Games" : current); } @@ -96,7 +96,7 @@ export function Content() { const tabs = setupComplete ? [ - ...(runningGame ? [{ + ...(runningGame?.configured ? [{ id: "NowPlaying", title: tabIcons.nowPlaying, content: ( @@ -104,7 +104,6 @@ export function Content() { game={runningGame} config={config} onConfigChange={(field, value) => handleConfigChange(field, value)} - onEnable={enable} onRepair={repair} /> ), diff --git a/src/components/NowPlayingTab.tsx b/src/components/NowPlayingTab.tsx index 5bce5c4..57858db 100644 --- a/src/components/NowPlayingTab.tsx +++ b/src/components/NowPlayingTab.tsx @@ -11,7 +11,6 @@ interface Props { fieldName: keyof ConfigurationData, value: boolean | number | string | string[], ) => Promise; - onEnable: (appid: string) => Promise; onRepair: (appid: string) => Promise; } @@ -24,25 +23,13 @@ export function NowPlayingTab({ game, config, onConfigChange, - onEnable, onRepair, }: Props) { const [busy, setBusy] = useState(false); const supportNeedsRepair = - game.configured && game.transport.kind === "flatpak" && game.flatpakSupport?.support_status !== "ready"; - const handleEnable = async () => { - if (busy) return; - setBusy(true); - try { - await onEnable(game.appid); - } finally { - setBusy(false); - } - }; - const handleRepair = async () => { if (busy) return; setBusy(true); @@ -60,22 +47,7 @@ export function NowPlayingTab({ - {!game.configured && ( - - - - - - void handleEnable()}> - {busy ? "Enabling..." : "Enable LSFG-VK"} - - - - )} - {game.configured && supportNeedsRepair && ( + {supportNeedsRepair && ( )} - {game.configured && ( - - )} + ); } -- cgit v1.2.3