diff --git a/apps/desktop/src/components/finder/views/contact-view.tsx b/apps/desktop/src/components/finder/views/contact-view.tsx
index dcc36be786..0259c213fa 100644
--- a/apps/desktop/src/components/finder/views/contact-view.tsx
+++ b/apps/desktop/src/components/finder/views/contact-view.tsx
@@ -1,6 +1,6 @@
import { RiCornerDownLeftLine } from "@remixicon/react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { Building2, CircleMinus, FileText, Pencil, Plus, SearchIcon, User } from "lucide-react";
+import { Building2, CircleMinus, FileText, Pencil, Plus, SearchIcon, TrashIcon, User } from "lucide-react";
import { useEffect, useRef, useState } from "react";
import { commands as dbCommands } from "@hypr/plugin-db";
@@ -130,6 +130,27 @@ export function ContactView({ userId, initialPersonId, initialOrgId }: ContactVi
setEditingOrg(organizationId);
};
+ const deletePersonMutation = useMutation({
+ mutationFn: (personId: string) => dbCommands.deleteHuman(personId),
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ["all-people"] });
+ queryClient.invalidateQueries({ queryKey: ["organization-members"] });
+
+ if (selectedPerson === selectedPersonData?.id) {
+ setSelectedPerson(null);
+ }
+ },
+ });
+
+ const handleDeletePerson = async (personId: string) => {
+ const userConfirmed = await confirm(
+ "Are you sure you want to delete this contact? This action cannot be undone.",
+ );
+ if (userConfirmed) {
+ deletePersonMutation.mutate(personId);
+ }
+ };
+
return (
@@ -295,12 +316,29 @@ export function ContactView({ userId, initialPersonId, initialOrgId }: ContactVi
)}
-
+
+
+ {!selectedPersonData.is_user && (
+
+ )}
+
diff --git a/plugins/db/js/bindings.gen.ts b/plugins/db/js/bindings.gen.ts
index 12263630df..cc32a9d2e0 100644
--- a/plugins/db/js/bindings.gen.ts
+++ b/plugins/db/js/bindings.gen.ts
@@ -91,6 +91,9 @@ async upsertHuman(human: Human) : Promise {
async listHumans(filter: ListHumanFilter | null) : Promise {
return await TAURI_INVOKE("plugin:db|list_humans", { filter });
},
+async deleteHuman(id: string) : Promise {
+ return await TAURI_INVOKE("plugin:db|delete_human", { id });
+},
async getOrganization(id: string) : Promise {
return await TAURI_INVOKE("plugin:db|get_organization", { id });
},
diff --git a/plugins/db/src/lib.rs b/plugins/db/src/lib.rs
index 909c11a7ec..334027233c 100644
--- a/plugins/db/src/lib.rs
+++ b/plugins/db/src/lib.rs
@@ -50,6 +50,7 @@ fn make_specta_builder() -> tauri_specta::Builder {
commands::humans::get_human,
commands::humans::upsert_human,
commands::humans::list_humans,
+ commands::humans::delete_human,
commands::organizations::get_organization,
commands::organizations::get_organization_by_user_id,
commands::organizations::upsert_organization,