From 47bc910a8482d3d2cc882e28e862ca5ad61063b6 Mon Sep 17 00:00:00 2001
From: Jonas Dellinger <jonas@dellinger.dev>
Date: Wed, 7 Jun 2023 07:35:05 +0200
Subject: Add functionality to hide plugins from quick access menu (#468)

---
 .../src/components/modals/PluginUninstallModal.tsx | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 frontend/src/components/modals/PluginUninstallModal.tsx

(limited to 'frontend/src/components/modals/PluginUninstallModal.tsx')

diff --git a/frontend/src/components/modals/PluginUninstallModal.tsx b/frontend/src/components/modals/PluginUninstallModal.tsx
new file mode 100644
index 00000000..e7ecbc99
--- /dev/null
+++ b/frontend/src/components/modals/PluginUninstallModal.tsx
@@ -0,0 +1,30 @@
+import { ConfirmModal } from 'decky-frontend-lib';
+import { FC } from 'react';
+
+interface PluginUninstallModalProps {
+  name: string;
+  title: string;
+  buttonText: string;
+  description: string;
+  closeModal?(): void;
+}
+
+const PluginUninstallModal: FC<PluginUninstallModalProps> = ({ name, title, buttonText, description, closeModal }) => {
+  return (
+    <ConfirmModal
+      closeModal={closeModal}
+      onOK={async () => {
+        await window.DeckyPluginLoader.callServerMethod('uninstall_plugin', { name });
+        // 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 window.DeckyPluginLoader.hiddenPluginsService.invalidate();
+      }}
+      strTitle={title}
+      strOKButtonText={buttonText}
+    >
+      {description}
+    </ConfirmModal>
+  );
+};
+
+export default PluginUninstallModal;
-- 
cgit v1.2.3

