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/modals/PluginDisablelModal.tsx | |
| 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/modals/PluginDisablelModal.tsx')
| -rw-r--r-- | frontend/src/components/modals/PluginDisablelModal.tsx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/frontend/src/components/modals/PluginDisablelModal.tsx b/frontend/src/components/modals/PluginDisablelModal.tsx new file mode 100644 index 00000000..89cda293 --- /dev/null +++ b/frontend/src/components/modals/PluginDisablelModal.tsx @@ -0,0 +1,46 @@ +import { ConfirmModal, Spinner } from '@decky/ui'; +import { FC, useState } from 'react'; + +import { disablePlugin, uninstallPlugin } from '../../plugin'; + +interface PluginUninstallModalProps { + name: string; + title: string; + buttonText: string; + description: string; + closeModal?(): void; +} + +const PluginDisableModal: FC<PluginUninstallModalProps> = ({ name, title, buttonText, description, closeModal }) => { + const [disabling, setDisabling] = useState<boolean>(false); + return ( + <ConfirmModal + closeModal={closeModal} + onOK={async () => { + setDisabling(true); + await disablePlugin(name); + + //not sure about this yet + + // uninstalling a plugin resets the hidden setting for it server-side + // we invalidate here so if you re-install it, you won't have an out-of-date hidden filter + await DeckyPluginLoader.frozenPluginsService.invalidate(); + await DeckyPluginLoader.hiddenPluginsService.invalidate(); + closeModal?.(); + }} + bOKDisabled={disabling} + bCancelDisabled={disabling} + strTitle={ + <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', width: '100%' }}> + {title} + {disabling && <Spinner width="24px" height="24px" style={{ marginLeft: 'auto' }} />} + </div> + } + strOKButtonText={buttonText} + > + {description} + </ConfirmModal> + ); +}; + +export default PluginDisableModal; |
