From aaa928661216ee3325acd3920db20b5a226b1c67 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 24 Mar 2026 11:20:55 +0100 Subject: [PATCH] feat(comments): warn before deleting annotation with comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Show a native confirm() dialog when the annotation has ≥1 comment, listing the count so the user knows what will be lost. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/lib/components/AnnotationLayer.svelte | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/lib/components/AnnotationLayer.svelte b/frontend/src/lib/components/AnnotationLayer.svelte index 5f8e57f8..316e649a 100644 --- a/frontend/src/lib/components/AnnotationLayer.svelte +++ b/frontend/src/lib/components/AnnotationLayer.svelte @@ -136,6 +136,14 @@ const containerStyle = $derived( aria-label="Annotation löschen" onclick={(e) => { e.stopPropagation(); + const count = commentCounts?.[annotation.id] ?? 0; + if (count > 0) { + const msg = + count === 1 + ? 'Diese Annotation hat 1 Kommentar. Beim Löschen wird er ebenfalls entfernt. Fortfahren?' + : `Diese Annotation hat ${count} Kommentare. Beim Löschen werden sie ebenfalls entfernt. Fortfahren?`; + if (!window.confirm(msg)) return; + } onDelete(annotation.id); }} style="