diff options
Diffstat (limited to 'frontend/src')
| -rw-r--r-- | frontend/src/components/DeckyQAMState.tsx | 5 | ||||
| -rw-r--r-- | frontend/src/hooks/tabs.tsx | 27 |
2 files changed, 20 insertions, 12 deletions
diff --git a/frontend/src/components/DeckyQAMState.tsx b/frontend/src/components/DeckyQAMState.tsx index 48dd8971..539dd278 100644 --- a/frontend/src/components/DeckyQAMState.tsx +++ b/frontend/src/components/DeckyQAMState.tsx @@ -1,5 +1,6 @@ import { QuickAccessTab } from '@decky/ui'; import { FC, ReactNode, createContext, useContext, useEffect, useState } from 'react'; + import Logger from '../logger'; export interface Tab { @@ -115,9 +116,7 @@ export const DeckyQAMStateContextProvider: FC<Props> = ({ children, deckyQAMStat const removePatch = deckyQAMState.removePatch.bind(deckyQAMState); return ( - <DeckyQAMStateContext.Provider - value={{ ...publicDeckyQAMState, add, removeById, addPatch, removePatch, visible }} - > + <DeckyQAMStateContext.Provider value={{ ...publicDeckyQAMState, add, removeById, addPatch, removePatch, visible }}> {children} </DeckyQAMStateContext.Provider> ); diff --git a/frontend/src/hooks/tabs.tsx b/frontend/src/hooks/tabs.tsx index 802f2371..5b8ba298 100644 --- a/frontend/src/hooks/tabs.tsx +++ b/frontend/src/hooks/tabs.tsx @@ -9,11 +9,18 @@ import { findModuleScopeByVar, getReactRoot, } from '@decky/ui'; +import { ReactNode, cloneElement, createElement } from 'react'; +import { + DeckyQAMState, + DeckyQAMStateContextProvider, + Tab, + TabData, + TabPatch, + useDeckyQAMState, +} from '../components/DeckyQAMState'; import { QuickAccessVisibleStateProvider } from '../components/QuickAccessVisibleState'; import Logger from '../logger'; -import { DeckyQAMState, DeckyQAMStateContextProvider, Tab, TabData, TabPatch, useDeckyQAMState } from '../components/DeckyQAMState'; -import { cloneElement, createElement, ReactNode } from 'react'; declare global { interface Window { @@ -54,9 +61,11 @@ class TabsHook extends Logger { if (ret._decky) { return ret; } - const returnVal = <DeckyQAMStateContextProvider deckyQAMState={this.qamState} visible={args[0].visible}> - <DeckyQAMWrapper>{ret}</DeckyQAMWrapper> - </DeckyQAMStateContextProvider> + const returnVal = ( + <DeckyQAMStateContextProvider deckyQAMState={this.qamState} visible={args[0].visible}> + <DeckyQAMWrapper>{ret}</DeckyQAMWrapper> + </DeckyQAMStateContextProvider> + ); (returnVal as any)._decky = true; return returnVal; }, @@ -106,7 +115,7 @@ class TabsHook extends Logger { return this.qamState.removePatch(tab, patch); } - private render({children}: {children: any[]}) { + private render({ children }: { children: any[] }) { const { tabs, patches, visible } = useDeckyQAMState(); const existingTabs = findInReactTree(children, (x) => x?.props?.tabs).props.tabs; let deckyTabAmount = existingTabs.reduce((prev: any, cur: any) => (cur.decky ? prev + 1 : prev), 0); @@ -137,8 +146,8 @@ class TabsHook extends Logger { existingTabs[tabKey].panel[isPatched] = true; }); } - - if (patches.has(tab?.key)){ + + if (patches.has(tab?.key)) { const patchList = patches.get(tab?.key)!; for (const patch of patchList) { existingTabs[tabKey] = tab = patch(tab); @@ -165,7 +174,7 @@ class TabsHook extends Logger { tab: icon, decky: true, initialVisibility: visible, - panel: null + panel: null, }; tab.panel = ( <ErrorBoundary> |
