feat(journals): implement bulk Markdown import with multiple parsing strategies
- Added 'ae_journals_parsers.ts' with Standard, Personal Log, and Amazon Vine parsers (ported from Python) - Created 'AeCompModalJournalImport' for file selection, preview, and API submission - Integrated Import button into Journals list view
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { BookPlus, FolderPlus, Library, Loader, SquareLibrary, Wrench } from '@lucide/svelte';
|
||||
import { BookPlus, FolderPlus, Library, Loader, SquareLibrary, Wrench, FileUp } from '@lucide/svelte';
|
||||
import { liveQuery } from 'dexie';
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
|
||||
@@ -33,10 +33,19 @@
|
||||
import Modal_journals_cfg from './modal_journals_config.svelte';
|
||||
import Journal_obj_li from './ae_comp__journal_obj_li.svelte';
|
||||
import AeCompJournalEntryQuickAdd from './ae_comp__journal_entry_quick_add.svelte';
|
||||
import AeCompModalJournalImport from './ae_comp__modal_journal_import.svelte';
|
||||
|
||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
|
||||
let ae_acct = data[$slct.account_id];
|
||||
let show_import_modal = $state(false);
|
||||
|
||||
function handle_import_complete() {
|
||||
// Trigger a refresh of the journal list?
|
||||
// Usually liveQuery handles it if data changed in IDB.
|
||||
// But if we just created entries, we might want to refresh the selected journal view if active.
|
||||
// $journals_trig.journal_entry_li = true;
|
||||
}
|
||||
// $journals_slct.journal_obj = ae_acct.slct.journal_obj;
|
||||
// $journals_slct.journal_obj_li = ae_acct.slct.journal_obj_li;
|
||||
|
||||
@@ -204,6 +213,24 @@
|
||||
<span class="hidden md:inline"> New Journal </span>
|
||||
</button>
|
||||
|
||||
<!-- Import Entries button -->
|
||||
<button
|
||||
type="button"
|
||||
class="
|
||||
btn btn-sm
|
||||
preset-tonal-secondary border border-secondary-500
|
||||
hover:preset-filled-secondary-500
|
||||
transition
|
||||
"
|
||||
onclick={() => {
|
||||
show_import_modal = true;
|
||||
}}
|
||||
title="Import entries from Markdown files"
|
||||
>
|
||||
<FileUp class="mx-1" />
|
||||
<span class="hidden md:inline"> Import </span>
|
||||
</button>
|
||||
|
||||
<!-- Show Journals Config button -->
|
||||
<button
|
||||
type="button"
|
||||
@@ -326,5 +353,11 @@
|
||||
<Modal_journals_cfg show={$journals_sess.show__modal__journals_config} />
|
||||
{/if}
|
||||
|
||||
<AeCompModalJournalImport
|
||||
bind:open={show_import_modal}
|
||||
onClose={() => (show_import_modal = false)}
|
||||
onImportComplete={handle_import_complete}
|
||||
/>
|
||||
|
||||
<style lang="postcss">
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user