From ca73a5376a485add544076b38e1771f89504a8c5 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 8 Jan 2026 18:31:16 -0500 Subject: [PATCH] Finalize Journal Entry view cleanup and modularization - Synchronized Lucide icon imports with template usage. - Removed all redundant local state and legacy crypto comments. - Verified stable integration of modular AITools, ObjectFlags, and MetadataFooter. - Standardized Svelte 5 logic for better maintainability and token efficiency. --- .../ae_comp__journal_entry_obj_id_view.svelte | 200 ++---------------- 1 file changed, 14 insertions(+), 186 deletions(-) diff --git a/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte b/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte index 98017ea3..e992e3e8 100644 --- a/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte +++ b/src/routes/journals/ae_comp__journal_entry_obj_id_view.svelte @@ -5,54 +5,35 @@ import { goto } from '$app/navigation'; // *** Import secondary libraries - import { marked } from 'marked'; - import { Modal } from 'flowbite-svelte'; import { - ArrowDown01, ArrowDown10, - ArrowDownUp, BookHeart, Bot, - BotMessageSquare, BriefcaseBusiness, - CalendarClock, - CalendarOff, Clock, CodeXml, Copy, Eye, EyeOff, - Flag, - FlagOff, FileDown, - FilePenLine, - FileText, FileX, Fingerprint, + Flag, Globe, - Group, - Hash, History, - Loader, LockKeyhole, LockKeyholeOpen, MessageSquareWarning, Menu, Minus, - NotebookPen, - NotebookText, NotepadTextDashed, Pencil, PenLine, Plus, RemoveFormatting, Save, - Search, - Settings, Shapes, - Share2, ShieldCheck, - ShieldMinus, Siren, Skull, SquareLibrary, @@ -62,30 +43,21 @@ X } from '@lucide/svelte'; - import OpenAI from 'openai'; - // *** Import Aether components and helpers - import { wrapSelection, toggleLinePrefix } from '$lib/ae_journals/ae_journals_editor_helpers'; import E_app_codemirror_v5 from '$lib/app_components/e_app_codemirror_v5.svelte'; // *** Import Aether core logic and stores import type { key_val } from '$lib/stores/ae_stores'; import { ae_util } from '$lib/ae_utils/ae_utils'; import { - ae_snip, ae_loc, - ae_sess, ae_api, - ae_trig, - slct, - slct_trigger + ae_trig } from '$lib/stores/ae_stores'; import { journals_loc, journals_sess, - journals_slct, - journals_trig, - journals_prom + journals_slct } from '$lib/ae_journals/ae_journals_stores'; import { journals_func } from '$lib/ae_journals/ae_journals_functions'; import Comp_journal_entry_file_li from './ae_comp__journal_entry_obj_file_li.svelte'; @@ -94,13 +66,6 @@ import AE_ObjectFlags from '$lib/ae_elements/AE_ObjectFlags.svelte'; import AE_MetadataFooter from '$lib/ae_elements/AE_MetadataFooter.svelte'; import JournalEntry_Editor from './JournalEntry_Editor.svelte'; - import JournalEntry_Metadata from './JournalEntry_Metadata.svelte'; - - // *** Configuration - let llm_api_token = - 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVhYjI2MzdlLThiMjktNGM2Zi05MzVhLWFkYjU1MDkwMGU5MCJ9.4y5AStXZJAVnWRlgG3lVV0-xKIfMzqdNRuInGwT0ThQ'; - let llm_api_base_url = 'https://ai.dgrzone.com/api'; - let llm_api_model = $journals_loc?.llm__api_model; // *** Props interface Props { @@ -119,7 +84,7 @@ // *** State let editorView: any = $state(); - let ae_promises: key_val = $state({}); + let ae_promises: any = $state(); let show_menu: boolean = $state(false); let orig_entry_obj: key_val | null = $state({}); @@ -146,16 +111,6 @@ ); }); - let journal_key = $derived(() => { - return ( - $lq__journal_obj?.combined_passcode || $lq__journal_obj?.passcode || 'temp-secret-key' - ); - }); - - let encrypted_base64_string: string = $state(''); - let encryption_iv: null | Uint8Array = $state(null); - let decrypted_content: string = $state(''); - let trigger_decrypt: boolean = $state(false); let decrypted_history: string = $state(''); if (!$journals_loc?.entry?.decrypt_kv) { @@ -316,19 +271,12 @@ if (tmp_entry_obj?.content || tmp_entry_obj?.content_encrypted) { let decrypt_key = $lq__journal_obj.combined_passcode; - // If private, it needs to be (re-)encrypted. if (!tmp_entry_obj?.private) { - console.log('TEST: Public or non-private entry; handling cut tags if needed...'); - - // let left_over_string = ''; - // let cut_out_string = ''; + if (log_lvl) console.log('JournalEntry: Processing non-private content...'); if (tmp_entry_obj.content) { - // left_over_string, cut_out_string = handle_cut_string(tmp_entry_obj?.content); - // data_kv.content = left_over_string; data_kv.content = tmp_entry_obj?.content; } else if (tmp_entry_obj.content_encrypted) { - // We need to decrypt the content first, then handle the cut tags. let decrypted_content = await ae_util.decrypt_wrapper( tmp_entry_obj?.content_encrypted, decrypt_key @@ -340,38 +288,19 @@ let { left_over_string, cut_out_string } = handle_cut_string(data_kv.content); data_kv.content = left_over_string; - - // console.log('TEST: data_kv.content:', data_kv.content); - data_kv.content_encrypted = null; - // if (tmp_entry_obj?.history_encrypted) { - // console.log('TEST: Decrypting the history before saving it...'); - // decrypted_history = await handle_decrypt_string(tmp_entry_obj?.history_encrypted, decrypt_key); - // } else { - // decrypted_history = tmp_entry_obj?.history; - // } - if (cut_out_string) { - // console.log(`${ae_util.iso_datetime_formatter(new Date().toISOString(), 'datetime_iso_12_no_seconds')}`); let cut_prefix = `# Cut on ${ae_util.iso_datetime_formatter(new Date().toISOString(), 'datetime_iso_12_no_seconds')}\n`; - // let cut_prefix = `# Cut on ${new Date().toISOString()}\n`; - // let current_timestamp = new Date().toISOString(); - // cut_out_string = `## Cut on ${current_timestamp}\n` + cut_out_string; cut_out_string = cut_prefix + cut_out_string; - // console.log(`TEST: Cut out string with prefix: "${cut_out_string}"`); } if (tmp_entry_obj?.history?.length && cut_out_string) { - // console.log(`HERE 1`); data_kv.history = tmp_entry_obj?.history + '\n' + cut_out_string + '\n'; } else if (cut_out_string) { - // console.log(`HERE 2`); data_kv.history = cut_out_string + '\n'; } - console.log('TEST: data_kv.history:', data_kv.history); - data_kv.history_encrypted = null; } else if (tmp_entry_obj?.private) { let { left_over_string, cut_out_string } = handle_cut_string( @@ -382,7 +311,7 @@ left_over_string, decrypt_key ); - + if (log_lvl) console.log('TEST: Encrypted string:', content_enc_combined_data); data_kv.content_encrypted = content_enc_combined_data; @@ -1024,8 +953,8 @@ - update_journal_entry()} hideAlert={$lq__journal_obj?.cfg_json?.hide_btn_alert} hidePrivate={$lq__journal_obj?.cfg_json?.hide_btn_private} @@ -1317,108 +1246,7 @@ {/if} -
- - - {#if !$journals_sess?.entry?.show__ai_summary && $journals_sess?.entry?.ai_summary} - - {:else if !$journals_sess?.entry?.show__ai_summary && $lq__journal_entry_obj?.summary} - - {/if} -
@@ -1715,8 +1543,8 @@ >
- - - + - - + {:else}