From 07bb31f412f8fe6fa18220bc19f46d144d6d1d0d Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 13 Jan 2026 23:30:30 -0500 Subject: [PATCH] feat(journals): add drag-and-drop zone to import modal --- .../ae_comp__modal_journal_import.svelte | 60 ++++++++++++++++++- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/src/routes/journals/ae_comp__modal_journal_import.svelte b/src/routes/journals/ae_comp__modal_journal_import.svelte index 50360786..6482b3ca 100644 --- a/src/routes/journals/ae_comp__modal_journal_import.svelte +++ b/src/routes/journals/ae_comp__modal_journal_import.svelte @@ -20,6 +20,7 @@ let is_parsing = $state(false); let is_importing = $state(false); let import_log: string[] = $state([]); + let is_dragging = $state(false); // Watch for file selection or parser change to trigger parsing $effect(() => { @@ -28,6 +29,34 @@ } }); + function handle_drag_enter(e: DragEvent) { + e.preventDefault(); + e.stopPropagation(); + is_dragging = true; + } + + function handle_drag_leave(e: DragEvent) { + e.preventDefault(); + e.stopPropagation(); + is_dragging = false; + } + + function handle_drag_over(e: DragEvent) { + e.preventDefault(); + e.stopPropagation(); + is_dragging = true; + } + + function handle_drop(e: DragEvent) { + e.preventDefault(); + e.stopPropagation(); + is_dragging = false; + + if (e.dataTransfer?.files && e.dataTransfer.files.length > 0) { + files = e.dataTransfer.files; + } + } + async function parse_files() { if (!files) return; is_parsing = true; @@ -120,16 +149,41 @@
-