From 0f36e87ccea0d9bf2a3db8ee858f27d9d1b2d796 Mon Sep 17 00:00:00 2001 From: Travis Lane <63308171+Tormak9970@users.noreply.github.com> Date: Mon, 3 Apr 2023 17:21:31 -0400 Subject: Add plugin reordering (#378) * feat: started work on saving plugin order * feat: implemented local ReorderableList * feat: reoder complete except for usage of DFL * switched to using dfl reorderableList * fix: added missing file and removed frag * updated to newest dfl * Update defsettings.json * fix: plugin order was missing on init * fix: now await pluginOrder * fix: moved the plugin-order load to plugin-loader * chore: v6 and dfl bump --- frontend/src/components/DeckyState.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'frontend/src/components/DeckyState.tsx') diff --git a/frontend/src/components/DeckyState.tsx b/frontend/src/components/DeckyState.tsx index 283fb118..67d4b78e 100644 --- a/frontend/src/components/DeckyState.tsx +++ b/frontend/src/components/DeckyState.tsx @@ -6,6 +6,7 @@ import { VerInfo } from '../updater'; interface PublicDeckyState { plugins: Plugin[]; + pluginOrder: string[]; activePlugin: Plugin | null; updates: PluginUpdateMapping | null; hasLoaderUpdate?: boolean; @@ -15,6 +16,7 @@ interface PublicDeckyState { export class DeckyState { private _plugins: Plugin[] = []; + private _pluginOrder: string[] = []; private _activePlugin: Plugin | null = null; private _updates: PluginUpdateMapping | null = null; private _hasLoaderUpdate: boolean = false; @@ -26,6 +28,7 @@ export class DeckyState { publicState(): PublicDeckyState { return { plugins: this._plugins, + pluginOrder: this._pluginOrder, activePlugin: this._activePlugin, updates: this._updates, hasLoaderUpdate: this._hasLoaderUpdate, @@ -44,6 +47,11 @@ export class DeckyState { this.notifyUpdate(); } + setPluginOrder(pluginOrder: string[]) { + this._pluginOrder = pluginOrder; + this.notifyUpdate(); + } + setActivePlugin(name: string) { this._activePlugin = this._plugins.find((plugin) => plugin.name === name) ?? null; this.notifyUpdate(); @@ -78,6 +86,7 @@ interface DeckyStateContext extends PublicDeckyState { setVersionInfo(versionInfo: VerInfo): void; setIsLoaderUpdating(hasUpdate: boolean): void; setActivePlugin(name: string): void; + setPluginOrder(pluginOrder: string[]): void; closeActivePlugin(): void; } @@ -106,10 +115,18 @@ export const DeckyStateContextProvider: FC = ({ children, deckyState }) = 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); return ( {children} -- cgit v1.2.3