From a60b4077ec7a231a7cd766ca7d1ba84d6fabfd13 Mon Sep 17 00:00:00 2001
From: Clawd <ai@clawd.bot>
Date: Sat, 28 Feb 2026 08:15:03 -0800
Subject: Add delete functionality for projects and sessions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- Add delete buttons (🗑️) next to project/session dropdowns
- Add confirmation dialogs before deletion
- Add onDeleteProject and onDeleteSession props to Header
- Implement delete handlers in App.tsx with error handling
- Clear selection and related state after deletion
- Add CSS styling for delete button with hover effect
---
 renderer/src/App.tsx | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

(limited to 'renderer/src/App.tsx')

diff --git a/renderer/src/App.tsx b/renderer/src/App.tsx
index d5a2efd..26ac252 100644
--- a/renderer/src/App.tsx
+++ b/renderer/src/App.tsx
@@ -237,6 +237,38 @@ export function App() {
     setOriginalContent("");
   };
 
+  const handleDeleteProject = async (id: string) => {
+    try {
+      await api.deleteProject(id);
+      setProjects((prev) => prev.filter((p) => p.id !== id));
+      if (selectedProject?.id === id) {
+        setSelectedProject(null);
+        setSelectedSession(null);
+        setSessions([]);
+        setMessages([]);
+        setDocumentContent("");
+        setOriginalContent("");
+      }
+    } catch (err) {
+      setError(err instanceof Error ? err.message : "Failed to delete project");
+    }
+  };
+
+  const handleDeleteSession = async (id: string) => {
+    try {
+      await api.deleteSession(id);
+      setSessions((prev) => prev.filter((s) => s.id !== id));
+      if (selectedSession?.id === id) {
+        setSelectedSession(null);
+        setMessages([]);
+        setDocumentContent("");
+        setOriginalContent("");
+      }
+    } catch (err) {
+      setError(err instanceof Error ? err.message : "Failed to delete session");
+    }
+  };
+
   return (
     <div className="app">
       <Header
@@ -248,6 +280,8 @@ export function App() {
         onSelectSession={setSelectedSession}
         onCreateProject={handleCreateProject}
         onCreateSession={handleCreateSession}
+        onDeleteProject={handleDeleteProject}
+        onDeleteSession={handleDeleteSession}
       />
 
       <div className="main-content">
-- 
cgit v1.2.3

