summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-24 21:33:21 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2025-07-24 21:33:21 -0400
commit50c3d263f7df3f47777889ddc1f1a77e1fdba083 (patch)
tree4730a1ecdf4d6fac9a9504c59519985e763a43fb /src
parent8e18e9a162676488292287f96d4dca7fa8d0f431 (diff)
downloaddecky-lsfg-vk-50c3d263f7df3f47777889ddc1f1a77e1fdba083.tar.gz
decky-lsfg-vk-50c3d263f7df3f47777889ddc1f1a77e1fdba083.zip
add state persistence to collapsible workarounds sectionv0.7.1
Diffstat (limited to 'src')
-rw-r--r--src/components/ConfigurationSection.tsx23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/components/ConfigurationSection.tsx b/src/components/ConfigurationSection.tsx
index a1aca09..57c75ad 100644
--- a/src/components/ConfigurationSection.tsx
+++ b/src/components/ConfigurationSection.tsx
@@ -1,5 +1,5 @@
import { PanelSectionRow, ToggleField, SliderField, ButtonItem } from "@decky/ui";
-import { useState } from "react";
+import { useState, useEffect } from "react";
import { RiArrowDownSFill, RiArrowUpSFill } from "react-icons/ri";
import { ConfigurationData } from "../config/configSchema";
import { FpsMultiplierControl } from "./FpsMultiplierControl";
@@ -14,11 +14,30 @@ interface ConfigurationSectionProps {
onConfigChange: (fieldName: keyof ConfigurationData, value: boolean | number | string) => Promise<void>;
}
+const WORKAROUNDS_COLLAPSED_KEY = 'lsfg-workarounds-collapsed';
+
export function ConfigurationSection({
config,
onConfigChange
}: ConfigurationSectionProps) {
- const [workaroundsCollapsed, setWorkaroundsCollapsed] = useState(true);
+ // Initialize with localStorage value, fallback to true if not found
+ const [workaroundsCollapsed, setWorkaroundsCollapsed] = useState(() => {
+ try {
+ const saved = localStorage.getItem(WORKAROUNDS_COLLAPSED_KEY);
+ return saved !== null ? JSON.parse(saved) : true;
+ } catch {
+ return true;
+ }
+ });
+
+ // Persist workarounds collapse state to localStorage
+ useEffect(() => {
+ try {
+ localStorage.setItem(WORKAROUNDS_COLLAPSED_KEY, JSON.stringify(workaroundsCollapsed));
+ } catch (error) {
+ console.warn('Failed to save workarounds collapse state:', error);
+ }
+ }, [workaroundsCollapsed]);
return (
<>