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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
import { useEffect } from "react";
import { PanelSection } from "@decky/ui";
import { useInstallationStatus, useDllDetection, useLsfgConfig } from "../hooks/useLsfgHooks";
import { useInstallationActions } from "../hooks/useInstallationActions";
import { StatusDisplay } from "./StatusDisplay";
import { InstallationButton } from "./InstallationButton";
import { ConfigurationSection } from "./ConfigurationSection";
import { UsageInstructions } from "./UsageInstructions";
export function Content() {
const {
isInstalled,
installationStatus,
setIsInstalled,
setInstallationStatus
} = useInstallationStatus();
const { dllDetected, dllDetectionStatus } = useDllDetection();
const {
config,
setters,
loadLsfgConfig,
updateConfig
} = useLsfgConfig();
const { isInstalling, isUninstalling, handleInstall, handleUninstall } = useInstallationActions();
// Reload config when installation status changes
useEffect(() => {
if (isInstalled) {
loadLsfgConfig();
}
}, [isInstalled, loadLsfgConfig]);
// Configuration change handlers
const handleEnableLsfgChange = async (value: boolean) => {
setters.setEnableLsfg(value);
await updateConfig(value, config.multiplier, config.flowScale, config.hdr, config.perfMode, config.immediateMode);
};
const handleMultiplierChange = async (value: number) => {
setters.setMultiplier(value);
await updateConfig(config.enableLsfg, value, config.flowScale, config.hdr, config.perfMode, config.immediateMode);
};
const handleFlowScaleChange = async (value: number) => {
setters.setFlowScale(value);
await updateConfig(config.enableLsfg, config.multiplier, value, config.hdr, config.perfMode, config.immediateMode);
};
const handleHdrChange = async (value: boolean) => {
setters.setHdr(value);
await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, value, config.perfMode, config.immediateMode);
};
const handlePerfModeChange = async (value: boolean) => {
setters.setPerfMode(value);
await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, value, config.immediateMode);
};
const handleImmediateModeChange = async (value: boolean) => {
setters.setImmediateMode(value);
await updateConfig(config.enableLsfg, config.multiplier, config.flowScale, config.hdr, config.perfMode, value);
};
const onInstall = () => {
handleInstall(setIsInstalled, setInstallationStatus, loadLsfgConfig);
};
const onUninstall = () => {
handleUninstall(setIsInstalled, setInstallationStatus);
};
return (
<PanelSection>
<StatusDisplay
dllDetected={dllDetected}
dllDetectionStatus={dllDetectionStatus}
isInstalled={isInstalled}
installationStatus={installationStatus}
/>
<InstallationButton
isInstalled={isInstalled}
isInstalling={isInstalling}
isUninstalling={isUninstalling}
onInstall={onInstall}
onUninstall={onUninstall}
/>
{/* Configuration Section - only show if installed */}
{isInstalled && (
<ConfigurationSection
config={config}
onEnableLsfgChange={handleEnableLsfgChange}
onMultiplierChange={handleMultiplierChange}
onFlowScaleChange={handleFlowScaleChange}
onHdrChange={handleHdrChange}
onPerfModeChange={handlePerfModeChange}
onImmediateModeChange={handleImmediateModeChange}
/>
)}
<UsageInstructions config={config} />
</PanelSection>
);
}
|