diff options
| author | marios <marios8543@gmail.com> | 2025-10-06 23:54:49 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-06 23:54:49 +0300 |
| commit | 6fba20239b305e92a79b360ee87850f8f2d9b62e (patch) | |
| tree | 12dba98c397ba7c4adeaa2d7f4332092f1a5577b /frontend/src/components/settings | |
| parent | c3c0e87c6fc94cfd753ea45d623849e1b3633316 (diff) | |
| download | decky-loader-6fba20239b305e92a79b360ee87850f8f2d9b62e.tar.gz decky-loader-6fba20239b305e92a79b360ee87850f8f2d9b62e.zip | |
Feat disable plugins (#810)
* implement base frontend changes necessary for plugin disabling
* implement frontend diisable functions/ modal
---------
Co-authored-by: Jesse Bofill <jesse_bofill@yahoo.com>
Diffstat (limited to 'frontend/src/components/settings')
| -rw-r--r-- | frontend/src/components/settings/pages/plugin_list/index.tsx | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/frontend/src/components/settings/pages/plugin_list/index.tsx b/frontend/src/components/settings/pages/plugin_list/index.tsx index 9a7cb076..f13cbe2b 100644 --- a/frontend/src/components/settings/pages/plugin_list/index.tsx +++ b/frontend/src/components/settings/pages/plugin_list/index.tsx @@ -35,6 +35,7 @@ async function reinstallPlugin(pluginName: string, currentVersion?: string) { type PluginTableData = PluginData & { name: string; + disabled: boolean; frozen: boolean; onFreeze(): void; onUnfreeze(): void; @@ -54,7 +55,7 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> } return null; } - const { name, update, version, onHide, onShow, hidden, onFreeze, onUnfreeze, frozen, isDeveloper } = props.entry.data; + const { name, update, version, onHide, onShow, hidden, onFreeze, onUnfreeze, frozen, isDeveloper, disabled } = props.entry.data; const showCtxMenu = (e: MouseEvent | GamepadEvent) => { showContextMenu( @@ -82,6 +83,22 @@ function PluginInteractables(props: { entry: ReorderableEntry<PluginTableData> } > {t('PluginListIndex.uninstall')} </MenuItem> + {disabled ? <MenuItem + onSelected={() => + DeckyPluginLoader.disablePlugin( + name, + t('PluginLoader.plugin_disable.title', { name }), + t('PluginLoader.plugin_disable.button'), + t('PluginLoader.plugin_disable.desc', { name }), + ) + } + > + {t('PluginListIndex.plugin_disable')} + </MenuItem> : + // implement enabler + <> + </> + } {hidden ? ( <MenuItem onSelected={onShow}>{t('PluginListIndex.show')}</MenuItem> ) : ( @@ -147,10 +164,11 @@ type PluginData = { }; export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) { - const { plugins, updates, pluginOrder, setPluginOrder, frozenPlugins, hiddenPlugins } = useDeckyState(); + const { installedPlugins, disabled, updates, pluginOrder, setPluginOrder, frozenPlugins, hiddenPlugins } = useDeckyState(); + const [_, setPluginOrderSetting] = useSetting<string[]>( 'pluginOrder', - plugins.map((plugin) => plugin.name), + installedPlugins.map((plugin) => plugin.name), ); const { t } = useTranslation(); @@ -164,7 +182,7 @@ export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) { useEffect(() => { setPluginEntries( - plugins.map(({ name, version }) => { + installedPlugins.map(({ name, version }) => { const frozen = frozenPlugins.includes(name); const hidden = hiddenPlugins.includes(name); @@ -173,6 +191,7 @@ export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) { position: pluginOrder.indexOf(name), data: { name, + disabled: disabled.some(disabledPlugin => disabledPlugin.name === name), frozen, hidden, isDeveloper, @@ -186,9 +205,9 @@ export default function PluginList({ isDeveloper }: { isDeveloper: boolean }) { }; }), ); - }, [plugins, updates, hiddenPlugins]); + }, [installedPlugins, updates, hiddenPlugins]); - if (plugins.length === 0) { + if (installedPlugins.length === 0) { return ( <div> <p>{t('PluginListIndex.no_plugin')}</p> |
