diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-09-06 23:12:28 -0400 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2026-09-06 23:12:28 -0400 |
| commit | d1f8263bf9f22753ad53e1b0105172a3bd0faf5f (patch) | |
| tree | 5e744fd0d2d61f6ea118d1d53b94a602fed3111b /src/components/ConfigurationTab.tsx | |
| parent | 7bc5f685186b1ff03ce0f7c99e7bec411beabaeb (diff) | |
| download | decky-lsfg-vk-d1f8263bf9f22753ad53e1b0105172a3bd0faf5f.tar.gz decky-lsfg-vk-d1f8263bf9f22753ad53e1b0105172a3bd0faf5f.zip | |
feat: organize game profiles and focus enabled settings
Diffstat (limited to 'src/components/ConfigurationTab.tsx')
| -rw-r--r-- | src/components/ConfigurationTab.tsx | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/components/ConfigurationTab.tsx b/src/components/ConfigurationTab.tsx index dab6f19..6c4a99a 100644 --- a/src/components/ConfigurationTab.tsx +++ b/src/components/ConfigurationTab.tsx @@ -1,5 +1,5 @@ import { ButtonItem, Field, Focusable, PanelSection, PanelSectionRow } from "@decky/ui"; -import { useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { ConfigurationData } from "../config/configSchema"; import { GameTarget } from "../hooks/useGameConfiguration"; import { GameConfigurationControls } from "./GameConfigurationControls"; @@ -27,7 +27,13 @@ export function ConfigurationTab({ onResetAll, }: ConfigurationTabProps) { const [detailAppId, setDetailAppId] = useState<string | null>(null); + const [focusFpsMultiplier, setFocusFpsMultiplier] = useState(false); const promptedRunningAppId = useRef<string | null>(null); + const closeDetails = useCallback(() => { + setFocusFpsMultiplier(false); + setDetailAppId(null); + }, []); + const clearFpsFocusRequest = useCallback(() => setFocusFpsMultiplier(false), []); useEffect(() => { if (!runningGame || runningGame.configured) { @@ -59,22 +65,28 @@ export function ConfigurationTab({ } const profileLabel = selectedTarget?.name || "Game profile"; - const running = selectedTarget?.appid === runningGame?.appid; const profileDescription = selectedTarget - ? `${selectedTarget.nonSteam ? "Non-Steam" : "Steam"} · App ID ${selectedTarget.appid} · ${selectedTarget.configured ? running && !runningGame?.configured ? "Profile saved · applies next launch" : "Profile active" : "Not configured · changes apply next launch"}` + ? `${selectedTarget.nonSteam ? "Non-Steam" : "Steam"} · App ID ${selectedTarget.appid} · ${selectedTarget.configured ? "Configured" : "Not configured"}` : "Game is no longer available"; return ( - <Focusable onCancelButton={() => setDetailAppId(null)}> + <Focusable onCancelButton={closeDetails}> <PanelSection title="Game Profile"> <PanelSectionRow> <Field label={profileLabel} description={profileDescription} /> </PanelSectionRow> <PanelSectionRow> - <ButtonItem layout="below" onClick={() => setDetailAppId(null)}>Back to games</ButtonItem> + <ButtonItem layout="below" onClick={closeDetails}>Back to games</ButtonItem> </PanelSectionRow> </PanelSection> - <GameConfigurationControls config={config} onConfigChange={onConfigChange} /> + {selectedTarget?.configured && ( + <GameConfigurationControls + config={config} + onConfigChange={onConfigChange} + autoFocusFpsMultiplier={focusFpsMultiplier} + onFpsMultiplierFocused={clearFpsFocusRequest} + /> + )} <PanelSectionRow> <ButtonItem layout="below" @@ -82,9 +94,9 @@ export function ConfigurationTab({ if (selectedTarget?.configured) { promptedRunningAppId.current = detailAppId; await onReset(); - setDetailAppId(null); + closeDetails(); } else if (detailAppId) { - await onEnable(detailAppId); + if (await onEnable(detailAppId)) setFocusFpsMultiplier(true); } }} > |
