From 170d183fdafc1ec1a686c006fd6a2431c1f30c71 Mon Sep 17 00:00:00 2001 From: xXJSONDeruloXx Date: Sun, 6 Sep 2026 19:06:52 -0400 Subject: refactor: align secondary tabs with Decky UI --- src/components/ConfigFileTab.tsx | 42 ++++++++++++------------ src/components/FlatpaksTab.tsx | 37 +++++++++------------ src/components/InstallationButton.tsx | 43 +++++------------------- src/components/SetupTab.tsx | 1 - src/components/StatusDisplay.tsx | 61 +++++++---------------------------- 5 files changed, 57 insertions(+), 127 deletions(-) (limited to 'src') diff --git a/src/components/ConfigFileTab.tsx b/src/components/ConfigFileTab.tsx index 60c5c7e..e3cc09d 100644 --- a/src/components/ConfigFileTab.tsx +++ b/src/components/ConfigFileTab.tsx @@ -1,19 +1,11 @@ import { useEffect, useState } from "react"; -import { Field, Focusable, PanelSection, PanelSectionRow, Spinner } from "@decky/ui"; +import { Field, PanelSection, PanelSectionRow, Spinner } from "@decky/ui"; import { getConfigFileContent, FileContentResult } from "../api/lsfgApi"; import t from "../i18n/i18n"; export function ConfigFileTab() { const [result, setResult] = useState(null); - const copy = async (content: string) => { - try { - await navigator.clipboard.writeText(content); - } catch { - // Clipboard access is unavailable in some Deck UI contexts. - } - }; - useEffect(() => { getConfigFileContent().then(setResult).catch((error) => { setResult({ success: false, error: String(error) }); @@ -23,24 +15,32 @@ export function ConfigFileTab() { if (!result) { return ( - + + + ); } return ( - - - {result.success && result.content && ( - void copy(result.content || "")}> -
-                {result.content}
-              
-
- )} -
-
+ {result.error && ( + + + + )} + {result.success && result.content && ( + <> + + + + +
+              {result.content}
+            
+
+ + )}
); } diff --git a/src/components/FlatpaksTab.tsx b/src/components/FlatpaksTab.tsx index dc73858..b4d5e4d 100644 --- a/src/components/FlatpaksTab.tsx +++ b/src/components/FlatpaksTab.tsx @@ -1,15 +1,12 @@ import { useEffect, useState } from "react"; import { - ButtonItem, ConfirmModal, Field, PanelSection, PanelSectionRow, - Spinner, - Toggle, + ToggleField, showModal, } from "@decky/ui"; -import { FaCheck, FaCog, FaDownload, FaTimes, FaTrash } from "react-icons/fa"; import { checkFlatpakExtensionStatus, FlatpakApp, @@ -40,15 +37,13 @@ interface RuntimeRowProps { function RuntimeRow({ version, installed, busy, onAction }: RuntimeRowProps) { return ( - : } - > - - {busy ? : installed ? <> {t("FLATPAK_UNINSTALL_BTN", "Uninstall")} : <> {t("FLATPAK_INSTALL_BTN", "Install")}} - - + description={busy ? "Updating..." : installed ? t("FLATPAK_INSTALLED", "Installed") : t("FLATPAK_NOT_INSTALLED", "Not installed")} + checked={installed} + onChange={() => onAction()} + disabled={busy} + /> ); } @@ -70,13 +65,13 @@ function AppRow({ app, busy, onToggle }: AppRowProps) { return ( - } - > - - + checked={configured} + onChange={onToggle} + disabled={busy} + /> ); } @@ -162,13 +157,13 @@ export function FlatpaksTab() { }; if (loading) { - return ; + return ; } return ( <> - - {error && } />} + + {error && } {extensionStatus?.success ? runtimeVersions.map(({ version, key }) => ( } - + {apps?.success ? apps.apps.length ? apps.apps.map((app) => ( { - if (isInstalling) { - return ( -
-
{t('INSTALL_INSTALLING', 'Installing...')}
-
- ); - } - - if (isUninstalling) { - return ( -
-
{t('INSTALL_UNINSTALLING', 'Uninstalling...')}
-
- ); - } - - if (isInstalled) { - return ( -
- -
{t('INSTALL_UNINSTALL_BTN', 'Uninstall LSFG-VK')}
-
- ); - } - - return ( -
- -
{t('INSTALL_INSTALL_BTN', 'Install LSFG-VK')}
-
- ); - }; + const label = isInstalling + ? t('INSTALL_INSTALLING', 'Installing...') + : isUninstalling + ? t('INSTALL_UNINSTALLING', 'Uninstalling...') + : isInstalled + ? t('INSTALL_UNINSTALL_BTN', 'Uninstall LSFG-VK') + : t('INSTALL_INSTALL_BTN', 'Install LSFG-VK'); return ( @@ -58,7 +31,7 @@ export function InstallationButton({ onClick={isInstalled ? onUninstall : onInstall} disabled={isInstalling || isUninstalling} > - {renderButtonContent()} + {label} ); diff --git a/src/components/SetupTab.tsx b/src/components/SetupTab.tsx index 34106ed..98d6e78 100644 --- a/src/components/SetupTab.tsx +++ b/src/components/SetupTab.tsx @@ -29,7 +29,6 @@ export function SetupTab({ return ( -
-
- {losslessScalingAppInstalled ? "Lossless Scaling Installed" : "Lossless Scaling Not Installed"} -
- {!losslessScalingAppInstalled && losslessScalingStatus && ( -
- {losslessScalingStatus} -
- )} -
- {installationStatus} -
-
+ +
+ + {steamBranchStatus?.installed && ( -
-
- Steam branch: {steamBranchStatus.current_branch || "public"} - {steamBranchStatus.needs_switch && ( -
- {steamBranchStatus.message} -
- )} -
-
+
)} -- cgit v1.2.3