Bug fixes and clean up for the recent history of Journal Entries.

This commit is contained in:
Scott Idem
2025-09-10 17:31:04 -04:00
parent efa7833fb3
commit cc6186467a
4 changed files with 117 additions and 49 deletions

View File

@@ -48,7 +48,6 @@ import Journal_entry_obj_qry from './../ae_comp__journal_entry_obj_qry.svelte';
// let tmp_journal_obj_changed: boolean = $state(false);
// let tmp_journal_obj: key_val = $state({});
let ae_acct = data[$slct.account_id];
if (log_lvl) {
console.log(`ae_acct = `, ae_acct);
@@ -183,8 +182,23 @@ let lq__journal_obj = $derived(liveQuery(async () => {
"
>
<!-- If middle click then open the all journals page in a new tab. Otherwise show/hide the menu. -->
<button
type="button"
onmousedown={
(event) => {
if (event.button === 1) {
// Middle click - open in new tab
// window.open('/journals', '_blank');
window.open('/journals');
// } else {
// // Left click - toggle menu
// event.preventDefault(); // Prevent default middle-click behavior
// show_menu__all_journals = !show_menu__all_journals;
}
}
}
onclick={() => {
show_menu__all_journals = !show_menu__all_journals;
}}
@@ -196,7 +210,7 @@ let lq__journal_obj = $derived(liveQuery(async () => {
hover:preset-filled-tertiary-300-700
transition-all
"
title="View all journals menu: {$ae_loc.account_name}"
title={`View all journals menu: "${$ae_loc?.user?.name}"\nMiddle-click to open in new tab`}
>
<!-- <BookHeart /> -->
<!-- <Library /> -->
@@ -207,6 +221,7 @@ let lq__journal_obj = $derived(liveQuery(async () => {
{/if}
<span class="hidden md:inline">
Journals
<!-- for {$ae_loc?.user?.name} -->
</span>
</button>
@@ -245,9 +260,10 @@ let lq__journal_obj = $derived(liveQuery(async () => {
</a>
<!-- $journals_slct?.journal_id && -->
<!-- List of recent entries here... -->
<!-- $journals_loc.entry_view_history_li -->
{#if $journals_loc?.entry_view_history_li?.length > 0}
{#if $journals_loc.entry_view_history_kv && Object.keys($journals_loc.entry_view_history_kv).length > 0}
<select
bind:value={$journals_slct.journal_entry_id}
onchange={() => {
@@ -264,11 +280,12 @@ let lq__journal_obj = $derived(liveQuery(async () => {
"
>
<option value="" disabled selected>
Recent Entries...
{Object.keys($journals_loc.entry_view_history_kv).length}&times; Recent Entries...
</option>
{#each $journals_loc.entry_view_history_li as entry (entry.id)}
<option value={entry.id}>
{entry.name}
<!-- loop through each key value -->
{#each Object.entries($journals_loc.entry_view_history_kv).reverse() as [journal_entry_id, journal_entry_obj]}
<option value={journal_entry_obj.id}>
{(journal_entry_obj?.name || journal_entry_obj?.id) ?? 'NONE'}
</option>
{/each}
</select>