Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: Delete singular Cap (#773)

Ameer Al Ashhab401e5d001c68
diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsx
index 019514bb3..8179c12b9 100644
--- a/apps/web/app/(org)/dashboard/caps/Caps.tsx
+++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx
@@ -227,6 +227,16 @@ export const Caps = ({
}
};
+ const deleteCap = async (capId: string) => {
+ try {
+ await deleteVideo(capId);
+ toast.success("Cap deleted successfully");
+ refresh();
+ } catch (error) {
+ toast.error("Failed to delete cap");
+ }
+ };
+
if (count === 0) {
return <EmptyCapState />;
}
@@ -302,7 +312,13 @@ export const Caps = ({
key={cap.id}
cap={cap}
analytics={analytics[cap.id] || 0}
- onDelete={deleteSelectedCaps}
+ onDelete={async () => {
+ if (selectedCaps.length > 0) {
+ await deleteSelectedCaps();
+ } else {
+ await deleteCap(cap.id);
+ }
+ }}
userId={user?.id}
customDomain={customDomain}
domainVerified={domainVerified}