From 4104e28053fc03b3875958c7bf56ec6fbc5aab84 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Sat, 16 Aug 2025 12:05:10 -0400 Subject: initial prof selector and creator ui --- src/components/Content.tsx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/components/Content.tsx') diff --git a/src/components/Content.tsx b/src/components/Content.tsx index a075574..c7c757b 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -1,10 +1,12 @@ import { useEffect } from "react"; import { PanelSection, showModal, ButtonItem, PanelSectionRow } from "@decky/ui"; import { useInstallationStatus, useDllDetection, useLsfgConfig } from "../hooks/useLsfgHooks"; +import { useProfileManagement } from "../hooks/useProfileManagement"; import { useInstallationActions } from "../hooks/useInstallationActions"; import { StatusDisplay } from "./StatusDisplay"; import { InstallationButton } from "./InstallationButton"; import { ConfigurationSection } from "./ConfigurationSection"; +import { ProfileManagement } from "./ProfileManagement"; import { UsageInstructions } from "./UsageInstructions"; import { WikiButton } from "./WikiButton"; import { ClipboardButton } from "./ClipboardButton"; @@ -29,6 +31,11 @@ export function Content() { updateField } = useLsfgConfig(); + const { + currentProfile, + updateProfileConfig + } = useProfileManagement(); + const { isInstalling, isUninstalling, handleInstall, handleUninstall } = useInstallationActions(); // Reload config when installation status changes @@ -40,7 +47,16 @@ export function Content() { // Generic configuration change handler const handleConfigChange = async (fieldName: keyof ConfigurationData, value: boolean | number | string) => { - await updateField(fieldName, value); + // If we have a current profile, update that profile specifically + if (currentProfile) { + const newConfig = { ...config, [fieldName]: value }; + await updateProfileConfig(currentProfile, newConfig); + // Also update local config state + await updateField(fieldName, value); + } else { + // Fallback to the original method + await updateField(fieldName, value); + } }; const onInstall = () => { @@ -74,6 +90,14 @@ export function Content() { + {/* Profile Management - only show if installed */} + {isInstalled && ( + loadLsfgConfig()} + /> + )} + {/* Configuration Section - only show if installed */} {isInstalled && ( Date: Sat, 16 Aug 2025 12:17:21 -0400 Subject: fix unique prof creation in conf --- src/components/Content.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/components/Content.tsx') diff --git a/src/components/Content.tsx b/src/components/Content.tsx index c7c757b..d823257 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -50,11 +50,13 @@ export function Content() { // If we have a current profile, update that profile specifically if (currentProfile) { const newConfig = { ...config, [fieldName]: value }; - await updateProfileConfig(currentProfile, newConfig); - // Also update local config state - await updateField(fieldName, value); + const result = await updateProfileConfig(currentProfile, newConfig); + if (result.success) { + // Reload config to reflect the changes from the backend + await loadLsfgConfig(); + } } else { - // Fallback to the original method + // Fallback to the original method for backward compatibility await updateField(fieldName, value); } }; -- cgit v1.2.3 From 149ecf2d8bf5eaacb2e71d7006d3b38f15b91104 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Sat, 16 Aug 2025 12:27:11 -0400 Subject: fix: stuck ui states on newly created profile in conf items --- src/components/Content.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/components/Content.tsx') diff --git a/src/components/Content.tsx b/src/components/Content.tsx index d823257..7815951 100644 --- a/src/components/Content.tsx +++ b/src/components/Content.tsx @@ -33,7 +33,8 @@ export function Content() { const { currentProfile, - updateProfileConfig + updateProfileConfig, + loadProfiles } = useProfileManagement(); const { isInstalling, isUninstalling, handleInstall, handleUninstall } = useInstallationActions(); @@ -96,7 +97,10 @@ export function Content() { {isInstalled && ( loadLsfgConfig()} + onProfileChange={async () => { + await loadProfiles(); + await loadLsfgConfig(); + }} /> )} -- cgit v1.2.3