diff options
| author | Jonas Dellinger <jonas@dellinger.dev> | 2023-06-07 07:35:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-06 22:35:05 -0700 |
| commit | 47bc910a8482d3d2cc882e28e862ca5ad61063b6 (patch) | |
| tree | acc75a2892150df5fd0d151d46d8f75caa062504 /frontend/src/components/DeckyState.tsx | |
| parent | 1c6270ccd67f271968a3ab8a30c29f19548765f0 (diff) | |
| download | decky-loader-47bc910a8482d3d2cc882e28e862ca5ad61063b6.tar.gz decky-loader-47bc910a8482d3d2cc882e28e862ca5ad61063b6.zip | |
Add functionality to hide plugins from quick access menu (#468)
Diffstat (limited to 'frontend/src/components/DeckyState.tsx')
| -rw-r--r-- | frontend/src/components/DeckyState.tsx | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/frontend/src/components/DeckyState.tsx b/frontend/src/components/DeckyState.tsx index 67d4b78e..53ef6d2d 100644 --- a/frontend/src/components/DeckyState.tsx +++ b/frontend/src/components/DeckyState.tsx @@ -7,6 +7,7 @@ import { VerInfo } from '../updater'; interface PublicDeckyState { plugins: Plugin[]; pluginOrder: string[]; + hiddenPlugins: string[]; activePlugin: Plugin | null; updates: PluginUpdateMapping | null; hasLoaderUpdate?: boolean; @@ -17,6 +18,7 @@ interface PublicDeckyState { export class DeckyState { private _plugins: Plugin[] = []; private _pluginOrder: string[] = []; + private _hiddenPlugins: string[] = []; private _activePlugin: Plugin | null = null; private _updates: PluginUpdateMapping | null = null; private _hasLoaderUpdate: boolean = false; @@ -29,6 +31,7 @@ export class DeckyState { return { plugins: this._plugins, pluginOrder: this._pluginOrder, + hiddenPlugins: this._hiddenPlugins, activePlugin: this._activePlugin, updates: this._updates, hasLoaderUpdate: this._hasLoaderUpdate, @@ -52,6 +55,11 @@ export class DeckyState { this.notifyUpdate(); } + setHiddenPlugins(hiddenPlugins: string[]) { + this._hiddenPlugins = hiddenPlugins; + this.notifyUpdate(); + } + setActivePlugin(name: string) { this._activePlugin = this._plugins.find((plugin) => plugin.name === name) ?? null; this.notifyUpdate(); @@ -111,11 +119,11 @@ export const DeckyStateContextProvider: FC<Props> = ({ children, deckyState }) = return () => deckyState.eventBus.removeEventListener('update', onUpdate); }, []); - const setIsLoaderUpdating = (hasUpdate: boolean) => deckyState.setIsLoaderUpdating(hasUpdate); - const setVersionInfo = (versionInfo: VerInfo) => deckyState.setVersionInfo(versionInfo); - const setActivePlugin = (name: string) => deckyState.setActivePlugin(name); - const closeActivePlugin = () => deckyState.closeActivePlugin(); - const setPluginOrder = (pluginOrder: string[]) => deckyState.setPluginOrder(pluginOrder); + const setIsLoaderUpdating = deckyState.setIsLoaderUpdating.bind(deckyState); + const setVersionInfo = deckyState.setVersionInfo.bind(deckyState); + const setActivePlugin = deckyState.setActivePlugin.bind(deckyState); + const closeActivePlugin = deckyState.closeActivePlugin.bind(deckyState); + const setPluginOrder = deckyState.setPluginOrder.bind(deckyState); return ( <DeckyStateContext.Provider |
