From 7b32df09487383897927356547f1ba5a73e8cc94 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Fri, 4 Oct 2024 23:59:53 -0400 Subject: Add routerhook for desktop UI and a basic sidebar menu for Decky in desktop UI --- frontend/src/components/settings/index.tsx | 17 ++++- .../components/settings/pages/general/Updater.tsx | 88 ++++++++++++---------- 2 files changed, 63 insertions(+), 42 deletions(-) (limited to 'frontend/src/components/settings') diff --git a/frontend/src/components/settings/index.tsx b/frontend/src/components/settings/index.tsx index d6d98645..cb5096f5 100644 --- a/frontend/src/components/settings/index.tsx +++ b/frontend/src/components/settings/index.tsx @@ -53,5 +53,20 @@ export default function SettingsPage() { }, ]; - return ; + return ( +
+ + +
+ ); } diff --git a/frontend/src/components/settings/pages/general/Updater.tsx b/frontend/src/components/settings/pages/general/Updater.tsx index 59756a57..89b6d6ee 100644 --- a/frontend/src/components/settings/pages/general/Updater.tsx +++ b/frontend/src/components/settings/pages/general/Updater.tsx @@ -6,8 +6,8 @@ import { Focusable, ProgressBarWithInfo, Spinner, - findSP, showModal, + useWindowRef, } from '@decky/ui'; import { Suspense, lazy, useCallback, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -21,45 +21,48 @@ import WithSuspense from '../../../WithSuspense'; const MarkdownRenderer = lazy(() => import('../../../Markdown')); function PatchNotesModal({ versionInfo, closeModal }: { versionInfo: VerInfo | null; closeModal?: () => {} }) { - const SP = findSP(); + const [outerRef, win] = useWindowRef(); const { t } = useTranslation(); + // TODO proper desktop scrolling return ( - + - ( - -
-

{versionInfo?.all?.[id]?.name || 'Invalid Update Name'}

- {versionInfo?.all?.[id]?.body ? ( - - {versionInfo.all[id].body} - - ) : ( - t('Updater.no_patch_notes_desc') - )} -
-
- )} - fnGetId={(id) => id} - nNumItems={versionInfo?.all?.length} - nHeight={SP.innerHeight - 40} - nItemHeight={SP.innerHeight - 40} - nItemMarginX={0} - initialColumn={0} - autoFocus={true} - fnGetColumnWidth={() => SP.innerWidth} - name={t('Updater.decky_updates') as string} - /> + {win && ( + ( + +
+

{versionInfo?.all?.[id]?.name || 'Invalid Update Name'}

+ {versionInfo?.all?.[id]?.body ? ( + + {versionInfo.all[id].body} + + ) : ( + t('Updater.no_patch_notes_desc') + )} +
+
+ )} + fnGetId={(id) => id} + nNumItems={versionInfo?.all?.length} + nHeight={(win?.innerHeight || 800) - 40} + nItemHeight={(win?.innerHeight || 800) - 40} + nItemMarginX={0} + initialColumn={0} + autoFocus={true} + fnGetColumnWidth={() => win?.innerHeight || 1280} + name={t('Updater.decky_updates') as string} + /> + )}
); @@ -72,6 +75,8 @@ export default function UpdaterSettings() { const [updateProgress, setUpdateProgress] = useState(-1); const [reloading, setReloading] = useState(false); + const [windowRef, win] = useWindowRef(); + const { t } = useTranslation(); useEffect(() => { @@ -91,11 +96,12 @@ export default function UpdaterSettings() { }, []); const showPatchNotes = useCallback(() => { - showModal(); - }, [versionInfo]); + // TODO set width and height on desktop - needs fixing in DFL? + showModal(, win!); + }, [versionInfo, win]); return ( - <> +
)} - +
); } -- cgit v1.2.3