summaryrefslogtreecommitdiff
path: root/src/components/Content.tsx
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-13 00:04:54 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-13 00:04:54 -0400
commit77494457e2a4f5c80c3a2f7acb054b12d918d8ad (patch)
treefad4c4dd2ce69a850b56078444427866dedce9fa /src/components/Content.tsx
parent6cfcaa6c169cb8c898775eee276ff2497ab8f45c (diff)
downloaddecky-lsfg-vk-77494457e2a4f5c80c3a2f7acb054b12d918d8ad.tar.gz
decky-lsfg-vk-77494457e2a4f5c80c3a2f7acb054b12d918d8ad.zip
restructure for maintainability
Diffstat (limited to 'src/components/Content.tsx')
-rw-r--r--src/components/Content.tsx108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/components/Content.tsx b/src/components/Content.tsx
new file mode 100644
index 0000000..cecb142
--- /dev/null
+++ b/src/components/Content.tsx
@@ -0,0 +1,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 multiplier={config.multiplier} />
+ </PanelSection>
+ );
+}