From ddc1e02431d1ad4c5a0e89d59f9d7dd5d5ab604f Mon Sep 17 00:00:00 2001
From: Alex Gleason
Date: Fri, 3 Apr 2026 13:56:16 -0500
Subject: [PATCH] Add Delete App button under Advanced when editing an existing
app
---
src/components/AppDialog.tsx | 73 ++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/src/components/AppDialog.tsx b/src/components/AppDialog.tsx
index cc03d5f6..4d75ae76 100644
--- a/src/components/AppDialog.tsx
+++ b/src/components/AppDialog.tsx
@@ -204,6 +204,7 @@ export function AppDialog({ projectId, open, onOpenChange }: AppDialogProps) {
const [formData, setFormData] = useState(emptyFormData(projectId));
const [isSaving, setIsSaving] = useState(false);
const [submitted, setSubmitted] = useState(false);
+ const [confirmDelete, setConfirmDelete] = useState(false);
const [newKind, setNewKind] = useState('');
const [newHandlerUrl, setNewHandlerUrl] = useState('');
const [newHandlerType, setNewHandlerType] = useState('');
@@ -404,6 +405,37 @@ export function AppDialog({ projectId, open, onOpenChange }: AppDialogProps) {
}
};
+ const handleDelete = async () => {
+ if (!event) return;
+ setIsSaving(true);
+ try {
+ // Publish NIP-09 deletion event
+ await publishEvent({
+ kind: 5,
+ content: 'Deleted app',
+ tags: [['e', event.id], ['a', `31990:${event.pubkey}:${formData.dTag}`]],
+ });
+
+ // Remove the local app config
+ const dotAI = new DotAI(fs, cwd);
+ await dotAI.writeAppConfig({ a: '' });
+
+ await queryClient.invalidateQueries({ queryKey: ['app-event'] });
+
+ toast({ title: 'App deleted', description: `"${formData.name}" has been deleted.` });
+ onOpenChange(false);
+ } catch (error) {
+ toast({
+ title: 'Failed to delete',
+ description: error instanceof Error ? error.message : 'An unexpected error occurred',
+ variant: 'destructive',
+ });
+ } finally {
+ setIsSaving(false);
+ setConfirmDelete(false);
+ }
+ };
+
if (!user) {
return (
+ {/* Delete App */}
+ {hasApp && (
+
+ {confirmDelete ? (
+
+
Are you sure? This will publish a deletion event to Nostr.
+
+
+
+
+
+ ) : (
+
+ )}
+
+ )}