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:
@@ -35,11 +35,16 @@
|
||||
|
||||
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 };
|
||||
}
|
||||
}
|
||||
@@ -50,11 +55,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}`,
|
||||
@@ -99,7 +107,8 @@
|
||||
"
|
||||
>
|
||||
<!-- If middle click then open the all journals page in a new tab. Otherwise show/hide the menu. -->
|
||||
<button type="button"
|
||||
<button
|
||||
type="button"
|
||||
onmousedown={(event) => {
|
||||
if (event.button === 1) {
|
||||
// Middle click - open in new tab
|
||||
@@ -107,7 +116,7 @@
|
||||
window.open('/journals');
|
||||
// } else {
|
||||
// // Left click - toggle menu
|
||||
// event.preventDefault(); // Prevent default middle-click behavior
|
||||
// event.prevent_default(); // Prevent default middle-click behavior
|
||||
// show_menu__all_journals = !show_menu__all_journals;
|
||||
}
|
||||
}}
|
||||
@@ -191,13 +200,15 @@ Middle-click to open in new tab`}
|
||||
"
|
||||
>
|
||||
<option value="" disabled selected>
|
||||
{Object.keys($journals_loc.entry_view_history_kv).length}× Recent
|
||||
Entries...
|
||||
{Object.keys($journals_loc.entry_view_history_kv)
|
||||
.length}× Recent Entries...
|
||||
</option>
|
||||
<!-- loop through each key value -->
|
||||
{#each Object.entries($journals_loc.entry_view_history_kv as Record<string, ae_JournalEntry>).reverse() as [journal_entry_id, journal_entry_obj]}
|
||||
{#each Object.entries($journals_loc.entry_view_history_kv as Record).reverse() as [journal_entry_id, journal_entry_obj]}
|
||||
<option value={journal_entry_obj.id}>
|
||||
{(journal_entry_obj?.name || journal_entry_obj?.id) ?? 'NONE'}
|
||||
{(journal_entry_obj?.name ||
|
||||
journal_entry_obj?.id) ??
|
||||
'NONE'}
|
||||
</option>
|
||||
{/each}
|
||||
</select>
|
||||
@@ -237,7 +248,8 @@ Middle-click to open in new tab`}
|
||||
<!-- <span class="text-sm text-gray-500 hidden md:inline">
|
||||
New entry:
|
||||
</span> -->
|
||||
<button type="button"
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
// $journals_sess.show__modal_new__journal_entry_obj = true;
|
||||
|
||||
@@ -245,10 +257,14 @@ Middle-click to open in new tab`}
|
||||
category_code: null
|
||||
};
|
||||
if ($journals_loc.entry.qry__category_code) {
|
||||
data_kv.category_code = $journals_loc.entry.qry__category_code;
|
||||
data_kv.category_code =
|
||||
$journals_loc.entry.qry__category_code;
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('Creating new journal entry with data_kv:', data_kv);
|
||||
console.log(
|
||||
'Creating new journal entry with data_kv:',
|
||||
data_kv
|
||||
);
|
||||
}
|
||||
journals_func
|
||||
.create_ae_obj__journal_entry({
|
||||
@@ -259,16 +275,24 @@ Middle-click to open in new tab`}
|
||||
})
|
||||
.then((results) => {
|
||||
if (log_lvl) {
|
||||
console.log('New journal entry created:', results);
|
||||
console.log(
|
||||
'New journal entry created:',
|
||||
results
|
||||
);
|
||||
}
|
||||
$journals_slct.journal_entry_id = results?.journal_entry_id_random;
|
||||
$journals_slct.journal_entry_id =
|
||||
results?.journal_entry_id_random;
|
||||
// $journals_loc.entry.edit = true;
|
||||
$journals_loc.entry.edit_kv[$journals_slct.journal_entry_id] =
|
||||
'current';
|
||||
$journals_loc.entry.edit_kv[
|
||||
$journals_slct.journal_entry_id
|
||||
] = 'current';
|
||||
// alert(`Journal entry created successfully! ${$journals_slct.journal_entry_id}`);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error updating journal entry:', error);
|
||||
console.error(
|
||||
'Error updating journal entry:',
|
||||
error
|
||||
);
|
||||
alert('Failed to update journal entry.');
|
||||
})
|
||||
.finally(() => {
|
||||
@@ -299,6 +323,6 @@ Middle-click to open in new tab`}
|
||||
</div>
|
||||
|
||||
<div class="overflow-auto">
|
||||
{@render children?.()}
|
||||
{@render children?.()}
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user