From 4daf028e7acb49932e274ad5c32cd98045c7474a Mon Sep 17 00:00:00 2001
From: botato <63275405+botatooo@users.noreply.github.com>
Date: Fri, 1 Jul 2022 23:43:17 +0000
Subject: Uninstall functionality (#97)

* feat: POC uninstallation feature

* Fixes, placeholder

* bugfix: wrong function call

* add oncancel and change function called

* clean up plugin uninstall code

* bugfix, uninstall in store

* Limit scope of feature branch

* feat: PluginLoader.unloadPlugin

* problematic logs
---
 .../src/components/settings/pages/PluginList.tsx   | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 frontend/src/components/settings/pages/PluginList.tsx

(limited to 'frontend/src/components/settings/pages/PluginList.tsx')

diff --git a/frontend/src/components/settings/pages/PluginList.tsx b/frontend/src/components/settings/pages/PluginList.tsx
new file mode 100644
index 00000000..4fd2c063
--- /dev/null
+++ b/frontend/src/components/settings/pages/PluginList.tsx
@@ -0,0 +1,32 @@
+import { DialogButton, staticClasses } from 'decky-frontend-lib';
+import { FaTrash } from 'react-icons/fa';
+
+export default function PluginList() {
+  const plugins = window.DeckyPluginLoader?.getPlugins();
+
+  if (plugins.length === 0) {
+    return (
+      <div>
+        <p>No plugins installed</p>
+      </div>
+    );
+  }
+
+  return (
+    <ul style={{ listStyleType: 'none' }}>
+      {window.DeckyPluginLoader?.getPlugins().map(({ name }) => (
+        <li style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
+          <span>{name}</span>
+          <div className={staticClasses.Title} style={{ marginLeft: 'auto', boxShadow: 'none' }}>
+            <DialogButton
+              style={{ height: '40px', width: '40px', padding: '10px 12px' }}
+              onClick={() => window.DeckyPluginLoader.uninstall_plugin(name)}
+            >
+              <FaTrash />
+            </DialogButton>
+          </div>
+        </li>
+      ))}
+    </ul>
+  );
+}
-- 
cgit v1.2.3

