Refine journal entry config
Polish the Journal Entry Config modal to match the desired section outline, hide alert messaging unless enabled, update the shared draft typing for entry flows, and replace deprecated privacy icons. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -5,10 +5,11 @@ import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||
import { ae_api } from '$lib/stores/ae_stores';
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import type { ae_JournalEntryDraft } from '$lib/types/ae_types';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
journal_entry: key_val;
|
||||
journal_entry: ae_JournalEntryDraft;
|
||||
journal_config: key_val; // The cfg_json from the journal object
|
||||
mode?: 'append' | 'prepend' | 'auto';
|
||||
on_close: () => void;
|
||||
@@ -26,7 +27,7 @@ let {
|
||||
log_lvl = 0
|
||||
}: Props = $props();
|
||||
// Local State
|
||||
let tmp_entry_obj: key_val = $state({});
|
||||
let tmp_entry_obj: ae_JournalEntryDraft = $state({});
|
||||
|
||||
// Header Options
|
||||
let add_timestamp_header: boolean = $state(true);
|
||||
@@ -50,7 +51,8 @@ $effect(() => {
|
||||
});
|
||||
|
||||
async function handle_save() {
|
||||
let current_entry_content = tmp_entry_obj?.content || '';
|
||||
let current_entry_content =
|
||||
typeof tmp_entry_obj?.content === 'string' ? tmp_entry_obj.content : '';
|
||||
let add_content = '';
|
||||
let new_content = current_entry_content;
|
||||
|
||||
@@ -109,11 +111,16 @@ async function handle_save() {
|
||||
new_content = new_content.trim() + '\n';
|
||||
|
||||
let data_kv = { content: new_content };
|
||||
const journal_entry_id = tmp_entry_obj.journal_entry_id;
|
||||
if (!journal_entry_id) {
|
||||
console.error('Journal entry ID missing for append save.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
let update_result = await journals_func.update_ae_obj__journal_entry({
|
||||
api_cfg: $ae_api,
|
||||
journal_entry_id: tmp_entry_obj?.journal_entry_id,
|
||||
journal_entry_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user