From c16173ea0fdbf6cc47b13756c0a77e8399669055 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Sat, 12 Oct 2024 16:47:22 +0000
Subject: feature: Introduce a mechanism to cleanup dangling assets

---
 .../components/dashboard/admin/AdminActions.tsx    | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(limited to 'apps/web/components/dashboard/admin/AdminActions.tsx')

diff --git a/apps/web/components/dashboard/admin/AdminActions.tsx b/apps/web/components/dashboard/admin/AdminActions.tsx
index dfdf65eb..e5d6ed69 100644
--- a/apps/web/components/dashboard/admin/AdminActions.tsx
+++ b/apps/web/components/dashboard/admin/AdminActions.tsx
@@ -52,6 +52,21 @@ export default function AdminActions() {
     },
   });
 
+  const { mutateAsync: tidyAssets, isPending: isTidyAssetsPending } =
+    api.admin.tidyAssets.useMutation({
+      onSuccess: () => {
+        toast({
+          description: "Tidy assets request has been enqueued!",
+        });
+      },
+      onError: (e) => {
+        toast({
+          variant: "destructive",
+          description: e.message,
+        });
+      },
+    });
+
   return (
     <div>
       <div className="mb-2 mt-8 text-xl font-medium">Actions</div>
@@ -97,6 +112,13 @@ export default function AdminActions() {
         >
           Reindex All Bookmarks
         </ActionButton>
+        <ActionButton
+          variant="destructive"
+          loading={isTidyAssetsPending}
+          onClick={() => tidyAssets()}
+        >
+          Compact Assets
+        </ActionButton>
       </div>
     </div>
   );
-- 
cgit v1.2.3-70-g09d2

