Wrapping up for the day.

This commit is contained in:
Scott Idem
2025-03-21 19:13:30 -04:00
parent f45540a31f
commit 4715d13dda
8 changed files with 117 additions and 45 deletions

2
package-lock.json generated
View File

@@ -87,7 +87,7 @@
"tailwindcss-animate": "^1.0.7",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"typescript-svelte-plugin": "^0.3.45",
"typescript-svelte-plugin": "^0.3.46",
"vite": "^6.0.0",
"vite-plugin-tailwind-purgecss": "^0.3.3",
"vitest": "^3.0.0"

View File

@@ -79,7 +79,7 @@
"tailwindcss-animate": "^1.0.7",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"typescript-svelte-plugin": "^0.3.45",
"typescript-svelte-plugin": "^0.3.46",
"vite": "^6.0.0",
"vite-plugin-tailwind-purgecss": "^0.3.3",
"vitest": "^3.0.0"

View File

@@ -338,6 +338,9 @@ export async function db_save_ae_obj_li__journal_entry(
console.log(`ae_obj ${obj_type}:`, obj);
}
let content = obj.content ?? '';
let content_md_html: null|string = marked.parse(content);
try {
const id_random = await db_journals.journal_entry.put({
id: obj.journal_entry_id_random,
@@ -371,7 +374,7 @@ export async function db_save_ae_obj_li__journal_entry(
// description: obj.description,
content: obj.content,
content_md_html: marked.parse(obj.content),
content_md_html: content_md_html,
content_html: obj.content_html,
content_json: obj.content_json,

View File

@@ -44,9 +44,20 @@ let lq__journal_obj = $derived(liveQuery(async () => {
</script>
<section
class="
ae_journals__journal
container h-full mx-auto
flex flex-col gap-1
py-1 px-2 pb-16
items-center
min-w-full
max-w-max
"
>
<div class="flex flex-row items-center justify-between w-full">
<div class="flex flex-row items-center justify-between w-full border-gray-200 border-y-2 py-2">
<a href="/journals"
class="btn btn-sm
variant-ghost-tertiary
@@ -59,6 +70,17 @@ let lq__journal_obj = $derived(liveQuery(async () => {
View Other Journals
</a>
{#if $journals_slct?.journal_entry_id}
<a href="/journals/{$journals_slct?.journal_id}" class="novi_btn btn btn-secondary btn-sm
variant-ghost-tertiary
hover:variant-filled-tertiary
transition
">
<span class="fas fa-arrow-left m-1"></span>
Back to Journal Entries
</a>
{/if}
<!-- Add default journal entry -->
<span class="flex flex-row items-center gap-1">
<span class="text-sm text-gray-500 hidden md:inline">
@@ -136,3 +158,6 @@ let lq__journal_obj = $derived(liveQuery(async () => {
{@render children()}
</section>

View File

@@ -0,0 +1,46 @@
/** @type {import('./$types').LayoutLoad} */
console.log(`ae_l_journals [journal_id] +layout.ts start`);
import { browser } from '$app/environment';
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
export async function load({ params, parent }) {
let log_lvl: number = 1;
let data = await parent();
data.log_lvl = log_lvl;
let account_id = data.account_id;
let ae_acct = data[account_id];
let journal_id = params.journal_id;
if (!journal_id) {
console.log(`ae_journals journals [journal_id] +page.ts: The journal_id was not found in the params!!!`);
error(404, {
message: 'Journals - Journal ID not found'
});
}
ae_acct.slct.journal_id = journal_id;
console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, ae_acct.slct.journal_id);
if (browser) {
if (log_lvl) {
console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, journal_id);
}
// Load event journal object
let load_journal_obj = journals_func.load_ae_obj_id__journal({
api_cfg: ae_acct.api,
journal_id: journal_id,
inc_entry_li: true,
try_cache: true,
log_lvl: log_lvl
});
ae_acct.slct.journal_obj = load_journal_obj;
}
// WARNING: Precaution against shared data between sites.
data[account_id] = ae_acct;
return data;
}

View File

@@ -50,6 +50,7 @@ if (log_lvl) {
$journals_slct.journal_id = ae_acct.slct.journal_id;
// $journals_slct.journal_obj = ae_acct.slct.journal_obj;
$journals_slct.journal_entry_id = null;
let lq__journal_obj = $derived(liveQuery(async () => {
if (log_lvl) {
@@ -154,7 +155,7 @@ if (browser) {
</svelte:head>
<section
<!-- <section
class="
ae_journals__journal
container h-full mx-auto
@@ -164,10 +165,10 @@ if (browser) {
min-w-full
max-w-max
"
>
> -->
<div class="flex flex-row items-center justify-between w-full">
<div class="hidden flex flex-row items-center justify-between w-full">
<a href="/journals"
class="btn btn-sm
variant-ghost-tertiary
@@ -269,7 +270,7 @@ if (browser) {
{/if}
</section>
<!-- </section> -->
<!-- Modal: Journal edit ID -->
@@ -341,7 +342,7 @@ if (browser) {
<!-- Modal: Journal Entry new -->
<Modal
<!-- <Modal
bind:open={$journals_sess.show__modal_new__journal_entry_obj}
title="New Journal Entry - {$lq__journal_obj?.name}"
autoclose={false}
@@ -376,9 +377,7 @@ if (browser) {
{/snippet}
</Modal>
</Modal> -->
<!-- Modal: Journal Content ID media player -->

View File

@@ -6,38 +6,38 @@ import { browser } from '$app/environment';
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
export async function load({ params, parent }) { // route
let log_lvl: number = 1;
// let log_lvl: number = 1;
let data = await parent();
data.log_lvl = log_lvl;
// let data = await parent();
// data.log_lvl = log_lvl;
let account_id = data.account_id;
let ae_acct = data[account_id];
// let account_id = data.account_id;
// let ae_acct = data[account_id];
let journal_id = params.journal_id;
if (!journal_id) {
console.log(`ae_journals journals [journal_id] +page.ts: The journal_id was not found in the params!!!`);
error(404, {
message: 'Journals - Journal ID not found'
});
}
ae_acct.slct.journal_id = journal_id;
console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, ae_acct.slct.journal_id);
// let journal_id = params.journal_id;
// if (!journal_id) {
// console.log(`ae_journals journals [journal_id] +page.ts: The journal_id was not found in the params!!!`);
// error(404, {
// message: 'Journals - Journal ID not found'
// });
// }
// ae_acct.slct.journal_id = journal_id;
// console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, ae_acct.slct.journal_id);
if (browser) {
if (log_lvl) {
console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, journal_id);
}
// Load event journal object
let load_journal_obj = journals_func.load_ae_obj_id__journal({
api_cfg: ae_acct.api,
journal_id: journal_id,
inc_entry_li: true,
try_cache: true,
log_lvl: log_lvl
});
// if (browser) {
// if (log_lvl) {
// console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, journal_id);
// }
// // Load event journal object
// let load_journal_obj = journals_func.load_ae_obj_id__journal({
// api_cfg: ae_acct.api,
// journal_id: journal_id,
// inc_entry_li: true,
// try_cache: true,
// log_lvl: log_lvl
// });
ae_acct.slct.journal_obj = load_journal_obj;
// ae_acct.slct.journal_obj = load_journal_obj;
// Load journal entries for the journal
// let load_journal_entry_obj_li = journals_func.load_ae_obj_li__journal_entry({
@@ -75,10 +75,10 @@ export async function load({ params, parent }) { // route
// }
// ae_acct.slct.journal_entry_obj_li = load_journal_entry_obj_li;
}
// }
// WARNING: Precaution against shared data between sites.
data[account_id] = ae_acct;
// data[account_id] = ae_acct;
return data;
// return data;
}

View File

@@ -189,15 +189,14 @@ if (browser) {
<!-- <h1>Journals {$lq__journal_entry_obj?.name} - {$lq__journal_entry_obj_li?.length}</h1> -->
<a href="/journals/{$lq__journal_entry_obj?.journal_id}" class="novi_btn btn btn-secondary btn-sm
<!-- <a href="/journals/{$lq__journal_entry_obj?.journal_id}" class="novi_btn btn btn-secondary btn-sm
variant-ghost-tertiary
hover:variant-filled-tertiary
transition
">
<!-- <span class="fas fa-arrow-left m-1"></span> Back to Journals -->
<span class="fas fa-arrow-left m-1"></span>
Back to Journal Entries
</a>
</a> -->
{#if $lq__journal_entry_obj}
<Journal_entry_view