style(journals): apply expanded 80-width formatting and snake_case
- Batch formatted all Journals module files using Prettier with printWidth: 80. - Refactored preventDefault to prevent_default across all Svelte components. - Standardized line breaks for imports and long attribute lists for better readability. - Ensured consistent snake_case naming for internal identifiers.
This commit is contained in:
@@ -59,11 +59,16 @@
|
||||
$journals_slct.journal_id = ae_acct.slct.journal_id;
|
||||
let lq__journal_obj = $derived(
|
||||
liveQuery(async () => {
|
||||
let results = await db_journals.journal.get($journals_slct?.journal_id ?? ''); // null or undefined does not reset things like '' does
|
||||
let results = await db_journals.journal.get(
|
||||
$journals_slct?.journal_id ?? ''
|
||||
); // null or undefined does not reset things like '' does
|
||||
|
||||
// Check if results are different than the current session version stored under $journals_slct
|
||||
if ($journals_slct.journal_obj && results) {
|
||||
if (JSON.stringify($journals_slct.journal_obj) !== JSON.stringify(results)) {
|
||||
if (
|
||||
JSON.stringify($journals_slct.journal_obj) !==
|
||||
JSON.stringify(results)
|
||||
) {
|
||||
$journals_slct.journal_obj = { ...results };
|
||||
}
|
||||
}
|
||||
@@ -74,11 +79,14 @@
|
||||
|
||||
$effect(() => {
|
||||
if (log_lvl) {
|
||||
console.log(`lq__journal_obj: journal_id = ${$journals_slct?.journal_id}`);
|
||||
console.log(
|
||||
`lq__journal_obj: journal_id = ${$journals_slct?.journal_id}`
|
||||
);
|
||||
console.log(`lq__journal_obj: results = `, lq__journal_obj);
|
||||
if ($journals_slct.journal_obj && lq__journal_obj) {
|
||||
if (
|
||||
JSON.stringify($journals_slct.journal_obj) !== JSON.stringify(lq__journal_obj)
|
||||
JSON.stringify($journals_slct.journal_obj) !==
|
||||
JSON.stringify(lq__journal_obj)
|
||||
) {
|
||||
console.log(
|
||||
`Session slct stored version has changed for ID = ${$journals_slct.journal_id}`,
|
||||
@@ -104,7 +112,8 @@
|
||||
// Check if results are different than the current session version stored under $journals_slct
|
||||
if (
|
||||
$journals_slct.journal_obj_li &&
|
||||
JSON.stringify($journals_slct.journal_obj_li) !== JSON.stringify(results)
|
||||
JSON.stringify($journals_slct.journal_obj_li) !==
|
||||
JSON.stringify(results)
|
||||
) {
|
||||
$journals_slct.journal_obj_li = [...results];
|
||||
}
|
||||
@@ -119,7 +128,8 @@
|
||||
console.log(`lq__journal_obj_li: results = `, lq__journal_obj_li);
|
||||
if (
|
||||
$journals_slct.journal_obj_li &&
|
||||
JSON.stringify($journals_slct.journal_obj_li) !== JSON.stringify(lq__journal_obj_li)
|
||||
JSON.stringify($journals_slct.journal_obj_li) !==
|
||||
JSON.stringify(lq__journal_obj_li)
|
||||
) {
|
||||
console.log(
|
||||
`Session slct li stored version has changed for ID = ${$ae_loc.person_id}`,
|
||||
@@ -147,7 +157,10 @@
|
||||
|
||||
// Check if results are different than the current session version stored under $journals_slct
|
||||
if ($journals_slct.journal_entry_obj && results) {
|
||||
if (JSON.stringify($journals_slct.journal_entry_obj) !== JSON.stringify(results)) {
|
||||
if (
|
||||
JSON.stringify($journals_slct.journal_entry_obj) !==
|
||||
JSON.stringify(results)
|
||||
) {
|
||||
$journals_slct.journal_entry_obj = { ...results };
|
||||
}
|
||||
}
|
||||
@@ -161,7 +174,10 @@
|
||||
console.log(
|
||||
`lq__journal_entry_obj: journal_entry_id = ${$journals_slct?.journal_entry_id}`
|
||||
);
|
||||
console.log(`lq__journal_entry_obj: results = `, lq__journal_entry_obj);
|
||||
console.log(
|
||||
`lq__journal_entry_obj: results = `,
|
||||
lq__journal_entry_obj
|
||||
);
|
||||
if ($journals_slct.journal_entry_obj && lq__journal_entry_obj) {
|
||||
if (
|
||||
JSON.stringify($journals_slct.journal_entry_obj) !==
|
||||
@@ -180,11 +196,12 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$effect(() => {
|
||||
if (browser && $lq__journal_entry_obj?.journal_entry_id) {
|
||||
// Start with the current KV or convert the LI to a KV if needed
|
||||
let history_kv = { ...($journals_loc?.entry_view_history_kv ?? {}) };
|
||||
let history_kv = {
|
||||
...($journals_loc?.entry_view_history_kv ?? {})
|
||||
};
|
||||
|
||||
// Add or update the current entry
|
||||
const entry_id = $lq__journal_entry_obj?.journal_entry_id ?? 'NONE';
|
||||
@@ -220,7 +237,8 @@
|
||||
|
||||
// Only update if changed
|
||||
if (
|
||||
JSON.stringify(history_kv) !== JSON.stringify($journals_loc?.entry_view_history_kv)
|
||||
JSON.stringify(history_kv) !==
|
||||
JSON.stringify($journals_loc?.entry_view_history_kv)
|
||||
) {
|
||||
$journals_loc.entry_view_history_kv = history_kv;
|
||||
console.log(
|
||||
@@ -229,7 +247,9 @@
|
||||
);
|
||||
} else {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`$journals_loc.entry_view_history_kv has not changed.`);
|
||||
console.log(
|
||||
`$journals_loc.entry_view_history_kv has not changed.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +281,12 @@
|
||||
"
|
||||
>
|
||||
<!-- {#if $lq__journal_entry_obj} -->
|
||||
<Journal_entry_view {lq__journal_obj} {lq__journal_obj_li} {lq__journal_entry_obj} on_show_export={() => show_export_modal = true} />
|
||||
<Journal_entry_view
|
||||
{lq__journal_obj}
|
||||
{lq__journal_obj_li}
|
||||
{lq__journal_entry_obj}
|
||||
on_show_export={() => (show_export_modal = true)}
|
||||
/>
|
||||
<!-- {/if} -->
|
||||
</section>
|
||||
|
||||
@@ -269,10 +294,14 @@
|
||||
bind:open={show_export_modal}
|
||||
entries={$lq__journal_entry_obj ? [$lq__journal_entry_obj] : []}
|
||||
journal={$lq__journal_obj}
|
||||
on_close={() => show_export_modal = false}
|
||||
on_close={() => (show_export_modal = false)}
|
||||
/>
|
||||
{:else}
|
||||
<section class="main_content grow px-1 md:px-2 pb-28 flex flex-col gap-1 items-center">
|
||||
<p class="text-center">You must be logged in as the owner to view this Journal Entry.</p>
|
||||
<section
|
||||
class="main_content grow px-1 md:px-2 pb-28 flex flex-col gap-1 items-center"
|
||||
>
|
||||
<p class="text-center">
|
||||
You must be logged in as the owner to view this Journal Entry.
|
||||
</p>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
@@ -4,7 +4,10 @@ console.log(`ae_p_journals [journal_entry_id] +page.ts start`);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||
import { db_journals, journal_entry_field_li } from '$lib/ae_journals/db_journals';
|
||||
import {
|
||||
db_journals,
|
||||
journal_entry_field_li
|
||||
} from '$lib/ae_journals/db_journals';
|
||||
import { load_ae_obj_id } from '$lib/ae_core/core__crud_generic';
|
||||
|
||||
export async function load({ params, parent }) {
|
||||
@@ -18,7 +21,9 @@ export async function load({ params, parent }) {
|
||||
let ae_acct = data[account_id];
|
||||
|
||||
if (!ae_acct) {
|
||||
console.warn(`ae Journals [journal_entry_id] +page.ts: Account ${account_id} not found. Initializing ghost acct.`);
|
||||
console.warn(
|
||||
`ae Journals [journal_entry_id] +page.ts: Account ${account_id} not found. Initializing ghost acct.`
|
||||
);
|
||||
ae_acct = {
|
||||
api: data.ae_api || {},
|
||||
slct: {
|
||||
@@ -72,7 +77,9 @@ export async function load({ params, parent }) {
|
||||
});
|
||||
|
||||
if (!load_journal_entry_obj) {
|
||||
console.warn(`ae Journals [journal_entry_id] +page.ts: Entry ${journal_entry_id} not found via API or Cache.`);
|
||||
console.warn(
|
||||
`ae Journals [journal_entry_id] +page.ts: Entry ${journal_entry_id} not found via API or Cache.`
|
||||
);
|
||||
// error(404, {
|
||||
// message: 'Journals - Journal Entry not found'
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user