Work on the new Journals. Just saving things while they are working well.

This commit is contained in:
Scott Idem
2025-03-21 11:03:38 -04:00
parent 596986afb7
commit 35354a9d0f
10 changed files with 630 additions and 118 deletions

View File

@@ -1,13 +1,18 @@
<script lang="ts">
let log_lvl: number = 1;
// *** Import Svelte specific
import { goto, invalidate, pushState, replaceState } from '$app/navigation';
import { NotebookText, Shapes } from '@lucide/svelte';
// *** Import Aether specific variables and functions
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { api } from '$lib/api';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { journals_loc, journals_sess, journals_slct } from '$lib/ae_journals/ae_journals_stores';
import { journals_loc, journals_sess, journals_slct, journals_trig } from '$lib/ae_journals/ae_journals_stores';
interface Props {
lq__journal_entry_obj_li: any;
@@ -40,25 +45,68 @@ let ae_promises: key_val = $state({});
class:bg-warning-100={!journals_journal_entry_obj?.enable}
>
<header class="ae_header flex flex-row gap-2 items-center">
<header class="ae_header flex flex-row gap-2 items-center justify-between w-full">
<a
href="/journals/{journals_journal_entry_obj?.journal_id}/entry/{journals_journal_entry_obj?.journal_entry_id}"
class="btn btn-secondary variant-ghost-primary hover:variant-filled-primary transition"
title={`View: ${journals_journal_entry_obj?.name}`}
>
<NotebookText class="m-1"/>
<span class="hidden md:inline">
View
</span>
</a>
{#if journals_journal_entry_obj.category_code}
<!-- When clicked, this will filter by the category code. -->
<button
type="button"
onclick={() => {
if (log_lvl) {
console.log('$journals_loc.filter__category_code', $journals_loc.filter__category_code);
}
if ($journals_loc.filter__category_code == journals_journal_entry_obj.category_code) {
$journals_loc.filter__category_code = null;
} else {
$journals_loc.filter__category_code = journals_journal_entry_obj.category_code;
}
// $journals_loc = {
// ...$journals_loc,
// };
$journals_trig.journal_entry_li = true;
if (log_lvl) {
console.log('$journals_loc.filter__category_code', $journals_loc.filter__category_code);
}
}}
class="btn variant-ghost-secondary hover:variant-filled-secondary transition"
title={`Filter by category: ${journals_journal_entry_obj.category_code}`}
>
<Shapes class="m-1 inline-block"/>
{journals_journal_entry_obj.category_code ?? '-- no category --'}
</button>
{/if}
<h3 class="journal__name h4">
<span class="journal__name">{@html journals_journal_entry_obj.name}</span>
<span class="journal__name">{@html journals_journal_entry_obj.name ?? ae_util.iso_datetime_formatter(journals_journal_entry_obj.created_on, 'datetime_iso_12_no_seconds')}</span>
</h3>
</header>
{#if journals_journal_entry_obj.content}<pre class="journal__content p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html journals_journal_entry_obj.content}</pre>{/if}
<div class="ae_options flex flex-row flex-wrap gap-2 items-center justify-center">
<!-- <div class="ae_options flex flex-row flex-wrap gap-2 items-center justify-center"> -->
<a
<!-- <a
href="/journals/{journals_journal_entry_obj?.journal_id}/entry/{journals_journal_entry_obj?.journal_entry_id}"
class="btn btn-secondary btn-md variant-ghost-primary hover:variant-filled-primary transition"
title={`View: ${journals_journal_entry_obj?.name}`}
>
<span class="fas fa-eye m-1"></span> View
</a>
<NotebookText class="m-1"/> View
</a> -->
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
<!-- {#if $ae_loc.trusted_access && $ae_loc.edit_mode}
<button
type="button"
disabled={!$ae_loc.trusted_access}
@@ -74,11 +122,11 @@ let ae_promises: key_val = $state({});
>
<span class="fas fa-edit m-1"></span> Edit
</button>
{/if}
</div>
{/if} -->
<!-- </div> -->
<section class="ae_section journal_entry__entry">
{#if journals_journal_entry_obj?.description}
<!-- {#if journals_journal_entry_obj?.description}
<div
class="journal_entry__description ae_description"
>
@@ -87,9 +135,9 @@ let ae_promises: key_val = $state({});
{@html journals_journal_entry_obj?.description}
</div>
</div>
{/if}
{/if} -->
{#if journals_journal_entry_obj?.entry_html}
<!-- {#if journals_journal_entry_obj?.entry_html}
<div
class="journal_entry__entry_html ae_entry_html"
>
@@ -98,7 +146,7 @@ let ae_promises: key_val = $state({});
{@html journals_journal_entry_obj?.entry_html}
</div>
</div>
{/if}
{/if} -->
<div
class="ae_group"