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 @@