A quick save while the new exports are fully working. The prepend and append also work now.

This commit is contained in:
Scott Idem
2026-01-14 12:29:47 -05:00
parent 228f0ecf06
commit b80cbb7c2b
6 changed files with 68 additions and 15 deletions

View File

@@ -29,6 +29,7 @@
onChangeJournal: () => void;
onAppend?: () => void;
onPrepend?: () => void;
onShowExport?: () => void;
save_status?: 'saved' | 'unsaved' | 'saving';
log_lvl?: number;
}
@@ -45,6 +46,7 @@
onChangeJournal,
onAppend,
onPrepend,
onShowExport,
save_status = 'saved',
log_lvl = 0
}: Props = $props();
@@ -257,6 +259,7 @@ p-2 md:p-3 rounded-lg shadow-md
{onChangeJournal}
{onAppend}
{onPrepend}
{onShowExport}
{log_lvl}
/>
</div>

View File

@@ -10,7 +10,7 @@
Clock, X, Trash2, Settings, Shapes,
Copy, RemoveFormatting, CodeXml, TypeOutline,
History, Pencil, PenLine, FileX, SquareLibrary,
ArrowUpToLine, ArrowDownToLine
ArrowUpToLine, ArrowDownToLine, FileDown
} from '@lucide/svelte';
import { ae_loc, ae_api } from '$lib/stores/ae_stores';
import { journals_slct, journals_loc, journals_sess } from '$lib/ae_journals/ae_journals_stores';
@@ -29,6 +29,7 @@
onChangeJournal: () => void;
onAppend?: () => void;
onPrepend?: () => void;
onShowExport?: () => void;
log_lvl?: number;
}
@@ -42,6 +43,7 @@
onChangeJournal,
onAppend,
onPrepend,
onShowExport,
log_lvl = 0
}: Props = $props();
@@ -98,6 +100,22 @@
</button>
</div>
<!-- Export Action -->
<button
class="btn btn-sm variant-soft-secondary w-full"
onclick={() => {
console.log('JournalEntry_SettingsMenu: Export Entry clicked');
if (onShowExport) {
onShowExport();
} else {
console.warn('JournalEntry_SettingsMenu: onShowExport prop is undefined');
}
}}
title="Export this Entry"
>
<FileDown size="1.2em" class="mr-2"/> Export Entry
</button>
<!-- Category selection -->
<div class="flex items-center gap-2">
<Shapes size="1.1em" class="text-surface-500" />

View File

@@ -329,16 +329,7 @@
"
> -->
<Journal_view {lq__journal_obj} {lq__journal_entry_obj_li} />
<!-- Export Toolbar -->
{#if $lq__journal_entry_obj_li && $lq__journal_entry_obj_li.length > 0}
<div class="flex justify-end w-full max-w-(--breakpoint-lg) px-2 pb-2">
<button class="btn btn-sm variant-soft-secondary hover:variant-filled-secondary" onclick={() => show_export_modal = true}>
<FileDown class="mr-2" size="1em" /> Export Entries
</button>
</div>
{/if}
<Journal_view {lq__journal_obj} {lq__journal_entry_obj_li} onShowExport={() => show_export_modal = true} />
{#if $lq__journal_entry_obj_li && $lq__journal_entry_obj_li?.length}
<Journal_entry_obj_li {lq__journal_obj} {lq__journal_entry_obj_li} />

View File

@@ -36,6 +36,7 @@
import Journal_entry_view from './../../../ae_comp__journal_entry_obj_id_view.svelte';
// import Journal_page_menu from './session_page_menu.svelte';
// import Element_data_store from '$lib/element_data_store_v2.svelte';
import AeCompModalJournalExport from '../../../ae_comp__modal_journal_export.svelte';
interface Props {
data: any;
@@ -50,6 +51,8 @@
// Variables
// *** Quickly pull out data from parent(s)
let ae_acct = data[$slct.account_id];
let show_export_modal = $state(false);
$effect(() => {
if (log_lvl) {
console.log(`ae_acct = `, ae_acct);
@@ -315,9 +318,15 @@
"
>
<!-- {#if $lq__journal_entry_obj} -->
<Journal_entry_view {lq__journal_obj} {lq__journal_obj_li} {lq__journal_entry_obj} />
<Journal_entry_view {lq__journal_obj} {lq__journal_obj_li} {lq__journal_entry_obj} onShowExport={() => show_export_modal = true} />
<!-- {/if} -->
</section>
<AeCompModalJournalExport
bind:open={show_export_modal}
entries={$lq__journal_entry_obj ? [$lq__journal_entry_obj] : []}
onClose={() => show_export_modal = false}
/>
{:else}
<section class="main_content grow px-1 md:px-2 pb-28 flex flex-col gap-1 items-center">
<p class="text-center">You must be logged in as the owner to view this Journal Entry.</p>

View File

@@ -39,15 +39,25 @@
lq__journal_obj: any;
lq__journal_obj_li: any;
lq__journal_entry_obj: any;
onShowExport?: () => void;
}
let {
log_lvl = 0,
lq__journal_obj,
lq__journal_obj_li,
lq__journal_entry_obj
lq__journal_entry_obj,
onShowExport
}: Props = $props();
$effect(() => {
if (onShowExport) {
console.log('ae_comp__journal_entry_obj_id_view: onShowExport prop is defined');
} else {
console.warn('ae_comp__journal_entry_obj_id_view: onShowExport prop is UNDEFINED');
}
});
// *** State
let editorView: any = $state();
let ae_promises: any = $state();
@@ -555,6 +565,7 @@
onChangeJournal={change_journal_id}
onAppend={handle_append_start}
onPrepend={handle_prepend_start}
{onShowExport}
{save_status}
{log_lvl}
/>

View File

@@ -3,7 +3,7 @@
import { goto } from '$app/navigation';
// *** Import other supporting libraries
import { BookPlus, BookOpenText, FilePlus, Menu, Pencil } from '@lucide/svelte';
import { BookPlus, BookOpenText, FilePlus, Menu, Pencil, FileDown } from '@lucide/svelte';
// *** Import Aether specific variables and functions
import { ae_util } from '$lib/ae_utils/ae_utils';
@@ -29,9 +29,10 @@
log_lvl?: number;
lq__journal_obj: any;
lq__journal_entry_obj_li: any;
onShowExport?: () => void;
}
let { log_lvl = 0, lq__journal_obj, lq__journal_entry_obj_li }: Props = $props();
let { log_lvl = 0, lq__journal_obj, lq__journal_entry_obj_li, onShowExport }: Props = $props();
// let ae_promises: key_val = {};
// let ae_tmp: key_val = {};
@@ -265,6 +266,26 @@
<Pencil />
<span class="hidden md:inline"> Edit Journal </span>
</button>
{#if $lq__journal_entry_obj_li && $lq__journal_entry_obj_li.length > 0}
<button
type="button"
onclick={() => {
show_menu = false;
onShowExport?.();
}}
class="
btn btn-sm
preset-tonal-secondary border border-secondary-500
hover:preset-filled-secondary-500
transition
"
title="Export journal entries"
>
<FileDown />
<span class="hidden md:inline"> Export Entries </span>
</button>
{/if}
</div>
<!-- Set Journal private_passcode (string) -->