summaryrefslogtreecommitdiff
path: root/src/components/GameConfigurationSelector.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/GameConfigurationSelector.tsx')
-rw-r--r--src/components/GameConfigurationSelector.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/components/GameConfigurationSelector.tsx b/src/components/GameConfigurationSelector.tsx
new file mode 100644
index 0000000..8a0df6c
--- /dev/null
+++ b/src/components/GameConfigurationSelector.tsx
@@ -0,0 +1,29 @@
+import { Dropdown, DropdownOption, PanelSectionRow, ButtonItem } from "@decky/ui";
+import { GameTarget } from "../hooks/useGameConfiguration";
+
+interface Props {
+ targets: GameTarget[];
+ runningGame: GameTarget | null;
+ selectedAppId: string;
+ onSelect: (appid: string) => void;
+ onReset: () => Promise<void>;
+ onResetAll: () => Promise<void>;
+}
+
+export function GameConfigurationSelector({ targets, runningGame, selectedAppId, onSelect, onReset, onResetAll }: Props) {
+ const options: DropdownOption[] = [
+ { data: "", label: runningGame ? `Default (editing template) · ${runningGame.name}` : "Default" },
+ ...targets.map((target) => ({ data: target.appid, label: `${target.name} · ${target.appid}` })),
+ ];
+ return <>
+ <PanelSectionRow>
+ <Dropdown rgOptions={options} selectedOption={selectedAppId} onChange={(option) => onSelect(String(option.data))} />
+ </PanelSectionRow>
+ <PanelSectionRow>
+ <ButtonItem layout="below" onClick={() => void onReset()} disabled={!selectedAppId}>Reset selected game</ButtonItem>
+ </PanelSectionRow>
+ <PanelSectionRow>
+ <ButtonItem layout="below" onClick={() => void onResetAll()} disabled={!targets.some((target) => target.configured)}>Reset all game profiles</ButtonItem>
+ </PanelSectionRow>
+ </>;
+}