General clean up and improvements.

This commit is contained in:
Scott Idem
2025-04-02 13:42:14 -04:00
parent b9f4189a95
commit 7fa0d5cc5b
6 changed files with 41 additions and 7 deletions

View File

@@ -599,7 +599,7 @@ export function db_save_ae_obj_li__journal(
// tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
// From SQL view
// journal_other_count: obj.journal_other_count,
journal_entry_count: obj.journal_entry_count,
// A key value list of the others
// journal_other_kv: obj.journal_other_kv,

View File

@@ -97,6 +97,8 @@ export interface Journal {
journal_location_code?: null|string;
journal_location_name?: null|string;
journal_entry_count?: null|number;
// A key value list of the entries
journal_entry_kv?: null|key_val;
journal_entry_li?: null|[];

View File

@@ -8,7 +8,11 @@ import { onMount } from 'svelte';
import { goto } from '$app/navigation';
// *** Import other supporting libraries
import { BookPlus, FolderPlus } from '@lucide/svelte';
import {
BookPlus,
FolderPlus, Library,
SquareLibrary
} from '@lucide/svelte';
import { liveQuery } from "dexie";
import { Modal } from 'flowbite-svelte';
@@ -82,6 +86,14 @@ onMount(() => {
});
async function create_journal() {
// Confirm before creating a new journal
if (confirm('Are you sure you want to create a new journal?')) {
console.log('Creating new journal...');
} else {
console.log('Journal creation cancelled.');
return;
}
if ($journals_sess.journal.new_journal_name && $journals_sess.journal.new_journal_type_code) {
$journals_slct.journal_id = null;
try {
@@ -130,7 +142,11 @@ async function create_journal() {
<section class="ae_journals md:container h-full mx-auto space-y-2">
<h1 class="h1 text-center">Journals for {$ae_loc.account_name ?? 'Æ loading...'}</h1>
<h1 class="h1 text-center">
<!-- <Library size="1em" class="mx-1 inline-block" /> -->
<SquareLibrary size="1em" class="mx-1 inline-block text-gray-500"/>
Journals for {$ae_loc.account_name ?? 'Æ loading...'}
</h1>
<div class="flex flex-row items-center justify-center w-full border-gray-200 border-y-2 py-2">
<!-- Add new journal button -->
@@ -233,8 +249,16 @@ async function create_journal() {
<input type="text" placeholder="Journal Type" bind:value={$journals_sess.journal.new_journal_type_code} class="input input-bordered w-full mb-2" />
</div>
<div class="modal-action">
<button class="btn btn-primary" onclick={create_journal}>Create</button>
<button class="btn" onclick={$journals_sess.show__modal_new__journal_obj ?? false}>
<button class="btn variant-glass-primary"
onclick={create_journal}>Create</button>
<button
type="button"
onclick={() => {
// Close the modal
$journals_sess.show__modal_new__journal_obj = false;
}}
class="btn variant-glass-secondary"
>
Cancel
</button>
</div>

View File

@@ -10,6 +10,7 @@ import {
Check,
FilePlus, Library,
Minus, Notebook, Pencil, Plus,
SquareLibrary,
X
} from '@lucide/svelte';
@@ -130,7 +131,8 @@ async function handle_update_journal() {
title="View all journals"
>
<!-- <BookHeart /> -->
<Library />
<!-- <Library /> -->
<SquareLibrary class="text-gray-500"/>
<span class="hidden md:inline">
All Journals
</span>

View File

@@ -1,6 +1,11 @@
<script lang="ts">
// *** Import Svelte specific
// *** Import other supporting libraries
import {
BookPlus, BookOpenText
} from '@lucide/svelte';
// *** Import Aether specific variables and functions
import { ae_util } from '$lib/ae_utils/ae_utils';
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
@@ -28,6 +33,7 @@ let { log_lvl = 0, lq__journal_obj, lq__journal_entry_obj_li }: Props = $props()
<header class="ae_header journal__header">
<h2 class="journal__name h3">
<BookOpenText class="inline-block" />
{@html $lq__journal_obj?.name ?? 'Loading...'}
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
({$lq__journal_entry_obj_li?.length ?? '0'}&times;)

View File

@@ -59,7 +59,7 @@ let { lq__journal_obj_li }: Props = $props();
{#if journals_journal_obj?.journal_entry_count}
<span class="ae_badge ae_info journal__journal_entry_count">
<span class="fas fa-content"></span> {(journals_journal_obj?.journal_entry_count == 1 ? `${journals_journal_obj?.journal_entry_count} entry` : `${journals_journal_obj?.journal_entry_count} entries` )}
{@html (journals_journal_obj?.journal_entry_count == 1 ? `${journals_journal_obj?.journal_entry_count}&times; entry` : `${journals_journal_obj?.journal_entry_count}&times; entries` )}
</span>
{/if}
</a>