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/components/Header.tsx | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

(limited to 'renderer/src/components/Header.tsx')

diff --git a/renderer/src/components/Header.tsx b/renderer/src/components/Header.tsx
index 3dcbba9..b6bed26 100644
--- a/renderer/src/components/Header.tsx
+++ b/renderer/src/components/Header.tsx
@@ -10,6 +10,8 @@ interface HeaderProps {
   onSelectSession: (session: Session | null) => void;
   onCreateProject: () => void;
   onCreateSession: () => void;
+  onDeleteProject?: (id: string) => void;
+  onDeleteSession?: (id: string) => void;
 }
 
 const phaseLabels: Record<Phase, string> = {
@@ -29,7 +31,23 @@ export function Header({
   onSelectSession,
   onCreateProject,
   onCreateSession,
+  onDeleteProject,
+  onDeleteSession,
 }: HeaderProps) {
+  const handleDeleteProject = () => {
+    if (!selectedProject || !onDeleteProject) return;
+    if (confirm(`Delete project "${selectedProject.name}"? This cannot be undone.`)) {
+      onDeleteProject(selectedProject.id);
+    }
+  };
+
+  const handleDeleteSession = () => {
+    if (!selectedSession || !onDeleteSession) return;
+    if (confirm(`Delete session "${selectedSession.name}"? This cannot be undone.`)) {
+      onDeleteSession(selectedSession.id);
+    }
+  };
+
   return (
     <header className="header">
       <div className="header-left">
@@ -49,6 +67,15 @@ export function Header({
           ))}
         </select>
         <button onClick={onCreateProject}>+ Project</button>
+        {selectedProject && onDeleteProject && (
+          <button
+            onClick={handleDeleteProject}
+            className="btn-delete"
+            title="Delete project"
+          >
+            🗑️
+          </button>
+        )}
 
         {selectedProject && (
           <>
@@ -67,6 +94,15 @@ export function Header({
               ))}
             </select>
             <button onClick={onCreateSession}>+ Session</button>
+            {selectedSession && onDeleteSession && (
+              <button
+                onClick={handleDeleteSession}
+                className="btn-delete"
+                title="Delete session"
+              >
+                🗑️
+              </button>
+            )}
           </>
         )}
       </div>
-- 
cgit v1.2.3

