summaryrefslogtreecommitdiff
path: root/src/components/ConfigurationTab.tsx
blob: 6f3f474b015cc1b276ac86dda30b6243090bed62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { PanelSection } from "@decky/ui";
import { ConfigurationData } from "../config/configSchema";
import { GameTarget } from "../hooks/useGameConfiguration";
import { ConfigurationSection } from "./ConfigurationSection";
import { FgmodClipboardButton } from "./FgmodClipboardButton";
import { FpsMultiplierControl } from "./FpsMultiplierControl";
import { GameConfigurationSelector } from "./GameConfigurationSelector";
import t from "../i18n/i18n";

interface ConfigurationTabProps {
  config: ConfigurationData;
  targets: GameTarget[];
  runningGame: GameTarget | null;
  selectedAppId: string;
  onSelect: (appid: string) => void;
  onConfigChange: (fieldName: keyof ConfigurationData, value: boolean | number | string | string[]) => Promise<void>;
  onReset: () => Promise<void>;
  onResetAll: () => Promise<void>;
}

export function ConfigurationTab({
  config,
  targets,
  runningGame,
  selectedAppId,
  onSelect,
  onConfigChange,
  onReset,
  onResetAll,
}: ConfigurationTabProps) {
  return (
    <>
      <PanelSection title={t("CONTENT_FPS_MULTIPLIER", "FPS Multiplier")}>
        <FpsMultiplierControl config={config} onConfigChange={onConfigChange} />
      </PanelSection>
      <PanelSection title="Game Profile">
        <GameConfigurationSelector
          targets={targets}
          runningGame={runningGame}
          selectedAppId={selectedAppId}
          onSelect={onSelect}
          onReset={onReset}
          onResetAll={onResetAll}
        />
      </PanelSection>
      <PanelSection title="Options">
        <ConfigurationSection config={config} onConfigChange={onConfigChange} />
      </PanelSection>
      <PanelSection>
        <FgmodClipboardButton />
      </PanelSection>
    </>
  );
}