From c03862fa1d824f22e85d3ec64ba42de2cf47d116 Mon Sep 17 00:00:00 2001 From: Tormak <63308171+Tormak9970@users.noreply.github.com> Date: Sat, 20 Jan 2024 13:33:56 -0500 Subject: [PATCH 1/5] fix: fix system now properly deletes tabs when checking on load --- src/lib/controllers/TabErrorController.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/lib/controllers/TabErrorController.tsx b/src/lib/controllers/TabErrorController.tsx index fb5585d..313c1f4 100644 --- a/src/lib/controllers/TabErrorController.tsx +++ b/src/lib/controllers/TabErrorController.tsx @@ -47,8 +47,11 @@ export class TabErrorController { onConfirm={(editedTabSettings: TabSettingsDictionary) => { for (const tab of Object.values(editedTabSettings)) { if (tabsToFix.has(tab.id)) { - if (tab.filters!.length === 0) tabMasterManager.deleteTab(tab.id); - else tabMasterManager.updateCustomTab(tab.id, tab as EditableTabSettings); + if (tab.filters!.length === 0) { + tabMasterManager.deleteTab(tab.id); + } else { + tabMasterManager.updateCustomTab(tab.id, tab as EditableTabSettings); + } } } @@ -70,8 +73,11 @@ export class TabErrorController { */ private static processQueue = (tabMasterManager: TabMasterManager) => { const validationSet = this.validationQueue.splice(0, this.validationQueue.length); - if (validationSet.length > 0) this.validateInternal(validationSet, tabMasterManager); - else this.validationLock = false; + if (validationSet.length > 0) { + this.validateInternal(validationSet, tabMasterManager); + } else { + this.validationLock = false; + } } /** @@ -131,7 +137,7 @@ export class TabErrorController { onConfirm={(editedTabSettings: TabSettingsDictionary) => { const tabsToDelete: string[] = []; for (const tab of Object.values(editedTabSettings)) { - if (tabsToFix.has(tab.id) && tab.filters!.length === 0) tabsToDelete.push(); + if (tabsToFix.has(tab.id) && tab.filters!.length === 0) tabsToDelete.push(tab.id); } finishLoading(editedTabSettings); From 6d4d09e4e3e3cc2fec81074fc5405fc58145a7bd Mon Sep 17 00:00:00 2001 From: Jesse Bofill Date: Sun, 21 Jan 2024 10:21:28 -0700 Subject: [PATCH 2/5] chore: disable tab creation/profile buttons before tabs have loaded --- src/components/QuickAccessContent.tsx | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/components/QuickAccessContent.tsx b/src/components/QuickAccessContent.tsx index 49ab725..12d0838 100644 --- a/src/components/QuickAccessContent.tsx +++ b/src/components/QuickAccessContent.tsx @@ -107,20 +107,20 @@ export const QuickAccessContent: VFC<{}> = ({ }) => { - showModalNewTab(tabMasterManager)} onOKActionDescription={'Add Tab'}> + showModalNewTab(tabMasterManager)} onOKActionDescription={'Add Tab'}> Add Tab - {tabMasterManager.hasSettingsLoaded && - - showContextMenu()} - > - - - } + + showContextMenu()} + > + + + @@ -186,6 +186,7 @@ export const QuickAccessTitleView: VFC = ({ title, ta >
{title}
showContextMenu()} From 159ca2b9c9a7d14c53b640599f439077a0e2f2a9 Mon Sep 17 00:00:00 2001 From: Jesse Bofill Date: Thu, 1 Feb 2024 10:51:28 -0700 Subject: [PATCH 3/5] fix: fixes bug where error occurs when applying profile this bug occurs when applying a profile that has hidden tabs that have not yet had their collections built. this change now builds all tabs (including hidden) collections when the plugin loads. --- src/components/CustomTabContainer.tsx | 44 +++++++++++++-------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/components/CustomTabContainer.tsx b/src/components/CustomTabContainer.tsx index 71e7d67..6bbd3e3 100644 --- a/src/components/CustomTabContainer.tsx +++ b/src/components/CustomTabContainer.tsx @@ -79,33 +79,31 @@ export class CustomTabContainer implements TabContainer { * Builds the list of apps for this tab. */ buildCollection() { - if (this.position > -1) { - const {hidden, ...catsToIncludeObj} = getIncludedCategoriesFromBitField(this.categoriesToInclude); - const visibility = hidden ? "allApps" : "visibleApps"; - let listToFilter: SteamAppOverview[] = []; - - for (const key in catsToIncludeObj) { - const category = key as keyof typeof catsToIncludeObj; - if (catsToIncludeObj[category]) listToFilter = listToFilter.concat(collectionStore.appTypeCollectionMap.get(`type-${category}`)![visibility]); + const { hidden, ...catsToIncludeObj } = getIncludedCategoriesFromBitField(this.categoriesToInclude); + const visibility = hidden ? "allApps" : "visibleApps"; + let listToFilter: SteamAppOverview[] = []; + + for (const key in catsToIncludeObj) { + const category = key as keyof typeof catsToIncludeObj; + if (catsToIncludeObj[category]) listToFilter = listToFilter.concat(collectionStore.appTypeCollectionMap.get(`type-${category}`)![visibility]); + } + + const appsList = listToFilter.filter(appItem => { + if (this.filtersMode === 'and') { + return this.filters.every(filterSettings => Filter.run(filterSettings, appItem)); + } else { + return this.filters.some(filterSettings => Filter.run(filterSettings, appItem)); } - - const appsList = listToFilter.filter(appItem => { - if (this.filtersMode === 'and') { - return this.filters.every(filterSettings => Filter.run(filterSettings, appItem)); - } else { - return this.filters.some(filterSettings => Filter.run(filterSettings, appItem)); - } - }); + }); - this.collection.allApps = appsList; - this.collection.visibleApps = [...appsList]; + this.collection.allApps = appsList; + this.collection.visibleApps = [...appsList]; - const allAppsMap = collectionStore.allAppsCollection.apps; - const appMap = new Map(); - appsList.forEach((appItem: SteamAppOverview) => appMap.set(appItem.appid, allAppsMap.get(appItem.appid)!)); + const allAppsMap = collectionStore.allAppsCollection.apps; + const appMap = new Map(); + appsList.forEach((appItem: SteamAppOverview) => appMap.set(appItem.appid, allAppsMap.get(appItem.appid)!)); - this.collection.apps = appMap; - } + this.collection.apps = appMap; } /** From a8e8c5bfbfee51c6c525415e6fa92c4285c45f61 Mon Sep 17 00:00:00 2001 From: Jesse Bofill Date: Fri, 2 Feb 2024 09:17:22 -0700 Subject: [PATCH 4/5] chore: change how profile bugfix from last commit is handled instead of ensuring hidden tabs collections are built on load now they are built at the time the profile is applied. this ensures that the collections stay up to date. --- src/components/CustomTabContainer.tsx | 4 +++- src/state/TabProfileManager.tsx | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/CustomTabContainer.tsx b/src/components/CustomTabContainer.tsx index 6bbd3e3..828695e 100644 --- a/src/components/CustomTabContainer.tsx +++ b/src/components/CustomTabContainer.tsx @@ -51,7 +51,9 @@ export class CustomTabContainer implements TabContainer { id: this.id }; - this.buildCollection(); + if (this.position > -1) { + this.buildCollection(); + } this.checkMicroSDeckDependency(); } diff --git a/src/state/TabProfileManager.tsx b/src/state/TabProfileManager.tsx index ac6b631..404a607 100644 --- a/src/state/TabProfileManager.tsx +++ b/src/state/TabProfileManager.tsx @@ -1,3 +1,4 @@ +import { CustomTabContainer } from '../components/CustomTabContainer'; import { PythonInterop } from '../lib/controllers/PythonInterop'; import { TabMasterManager } from './TabMasterManager'; @@ -32,7 +33,13 @@ export class TabProfileManager { * @param tabMasterManager The plugin manager. */ apply(tabProfileName: string, tabMasterManager: TabMasterManager) { - tabMasterManager.getTabs().tabsMap.forEach(tabContainer => tabContainer.position = -1); + const { visibleTabsList, hiddenTabsList } = tabMasterManager.getTabs(); + hiddenTabsList.forEach(tabContainer => { + if (tabContainer.filters && (tabContainer as CustomTabContainer).collection.allApps === undefined) { + (tabContainer as CustomTabContainer).buildCollection(); + } + }); + visibleTabsList.forEach(tabContainer => tabContainer.position = -1); tabMasterManager.reorderTabs(this.tabProfiles[tabProfileName]); } From 989f3b9dfc496010d2a49300a9eb514028074231 Mon Sep 17 00:00:00 2001 From: Jesse Bofill Date: Mon, 5 Feb 2024 11:21:24 -0700 Subject: [PATCH 5/5] fix: switch to dfl usage of SimpleModal and ScrollPanel to prevent errors from latest steam client --- package.json | 2 +- pnpm-lock.yaml | 8 +++--- src/components/docs/DocsPage.tsx | 19 +++++++------ src/components/docs/Scrollable.tsx | 30 --------------------- src/components/generic/ScrollableWindow.tsx | 20 +++++++++----- 5 files changed, 29 insertions(+), 50 deletions(-) delete mode 100644 src/components/docs/Scrollable.tsx diff --git a/package.json b/package.json index d10fec0..cb5237e 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "@types/react-window": "^1.8.5", "@types/uuid": "^9.0.2", "@types/webpack": "^5.28.1", - "decky-frontend-lib": "^3.21.8", + "decky-frontend-lib": "^3.24.5", "husky": "^8.0.3", "markdown-it": "^13.0.1", "rollup": "^2.79.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7481588..3b2e89b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,8 +61,8 @@ devDependencies: specifier: ^5.28.1 version: 5.28.1 decky-frontend-lib: - specifier: ^3.21.8 - version: 3.21.8 + specifier: ^3.24.5 + version: 3.24.5 husky: specifier: ^8.0.3 version: 8.0.3 @@ -960,8 +960,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /decky-frontend-lib@3.21.8: - resolution: {integrity: sha512-I45KWzoTSakUcsN7drHhiOc+rYKYygIsuYTHqc8DbpPDJvUx6xlU4t7D2TMrj9o/xS/V3WY9N/pX8eF6AcGT1g==} + /decky-frontend-lib@3.24.5: + resolution: {integrity: sha512-eYlbKDOOcIBPI0b76Rqvlryq2ym/QNiry4xf2pFrXmBa1f95dflqbQAb2gTq9uHEa5gFmeV4lUcMPGJ3M14Xqw==} dev: true /deepmerge@4.3.1: diff --git a/src/components/docs/DocsPage.tsx b/src/components/docs/DocsPage.tsx index 3fa4cac..4470f8d 100644 --- a/src/components/docs/DocsPage.tsx +++ b/src/components/docs/DocsPage.tsx @@ -1,8 +1,6 @@ import { VFC, Fragment } from "react"; - import MarkDownIt from "markdown-it"; -import { ModalPosition, Panel, ScrollPanelGroup } from "./Scrollable"; -import { gamepadDialogClasses } from "decky-frontend-lib"; +import { Focusable, gamepadDialogClasses, ModalPosition, ScrollPanelGroup } from "decky-frontend-lib"; const mdIt = new MarkDownIt({ html: true @@ -51,13 +49,18 @@ export const DocPage: VFC<{ content: string }> = ({ content }) => { `}
- - - + + + {}} noFocusRing={true} >
- + - +
diff --git a/src/components/docs/Scrollable.tsx b/src/components/docs/Scrollable.tsx deleted file mode 100644 index 3dba939..0000000 --- a/src/components/docs/Scrollable.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { findModuleChild } from "decky-frontend-lib"; -import { FC } from "react" - -interface SimpleModalProps{ - active?: boolean -} - -const ModalModule = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - if (mod.SimpleModal && mod.ModalPosition) return mod; -}) - -const ScrollingModule = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - if (mod.ScrollPanel) return mod; -}) - -export const ScrollPanelGroup = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - return mod.ScrollPanelGroup; -}) - -export const Panel = findModuleChild((mod) => { - if (typeof mod !== 'object' || !mod.__esModule) return undefined; - return mod.Panel; -}) - -export const ScrollPanel = ScrollingModule.ScrollPanel; -export const SimpleModal = ModalModule.SimpleModal as FC -export const ModalPosition = ModalModule.ModalPosition as FC diff --git a/src/components/generic/ScrollableWindow.tsx b/src/components/generic/ScrollableWindow.tsx index 87981c4..312b101 100644 --- a/src/components/generic/ScrollableWindow.tsx +++ b/src/components/generic/ScrollableWindow.tsx @@ -1,6 +1,5 @@ -import { GamepadButton, gamepadDialogClasses, scrollPanelClasses } from 'decky-frontend-lib'; +import { GamepadButton, gamepadDialogClasses, scrollPanelClasses, ModalPosition, ScrollPanelGroup, Focusable } from 'decky-frontend-lib'; import { FC, Fragment, useRef } from 'react'; -import { ModalPosition, Panel, ScrollPanelGroup } from '../docs/Scrollable'; import { useIsOverflowing } from '../../hooks/useIsOverflowing'; export interface ScrollableWindowProps { @@ -15,16 +14,23 @@ export const ScrollableWindow: FC = ({ height, fadeAmount const isOverflowing = useIsOverflowing(scrollPanelRef); const panel = ( - - + + }} + //@ts-ignore + focusable={isOverflowing} + > {children} - +
);