Quickly saving good looking and mostly working config menus.

This commit is contained in:
Scott Idem
2026-01-14 18:27:46 -05:00
parent cdf318e744
commit 9caeb91394
2 changed files with 128 additions and 32 deletions

View File

@@ -32,7 +32,9 @@
BetweenVerticalEnd, BetweenVerticalEnd,
BetweenVerticalStart, BetweenVerticalStart,
X, X,
Settings Settings,
CalendarClock,
MousePointerClick
} from '@lucide/svelte'; } from '@lucide/svelte';
import { Modal } from 'flowbite-svelte'; import { Modal } from 'flowbite-svelte';
import { goto } from '$app/navigation'; import { goto } from '$app/navigation';
@@ -65,15 +67,15 @@
// *** Internal State // *** Internal State
let tab: 'general' | 'security' | 'ui' | 'json' = $state('general'); let tab: 'general' | 'security' | 'ui' | 'json' = $state('general');
let tmp__journal_obj = $state($journals_slct.journal_obj ?? {}); let tmp__journal_obj: any = $state({});
// Deep copy on mount or when lq changes to ensure we have a working copy // Deep copy on mount or when lq changes to ensure we have a working copy
$effect(() => { $effect(() => {
if (show && lq__journal_obj) { if (show && $lq__journal_obj) {
const source_id = lq__journal_obj.journal_id; const source_id = $lq__journal_obj.journal_id;
untrack(() => { untrack(() => {
if (!tmp__journal_obj.journal_id || tmp__journal_obj.journal_id !== source_id) { if (!tmp__journal_obj.journal_id || tmp__journal_obj.journal_id !== source_id) {
tmp__journal_obj = JSON.parse(JSON.stringify(lq__journal_obj)); tmp__journal_obj = JSON.parse(JSON.stringify($lq__journal_obj));
// Ensure cfg_json exists // Ensure cfg_json exists
if (!tmp__journal_obj.cfg_json) tmp__journal_obj.cfg_json = {}; if (!tmp__journal_obj.cfg_json) tmp__journal_obj.cfg_json = {};
} }
@@ -88,10 +90,41 @@
} }
try { try {
// DEFINITIVE BASE TABLE COLUMNS ONLY
const data_kv = {
name: tmp__journal_obj.name,
short_name: tmp__journal_obj.short_name,
type_code: tmp__journal_obj.type_code,
description: tmp__journal_obj.description,
summary: tmp__journal_obj.summary,
outline: tmp__journal_obj.outline,
passcode: tmp__journal_obj.passcode,
private_passcode: tmp__journal_obj.private_passcode,
public_passcode: tmp__journal_obj.public_passcode,
passcode_timeout: tmp__journal_obj.passcode_timeout,
auth_key: tmp__journal_obj.auth_key,
allow_auth: tmp__journal_obj.allow_auth,
cfg_json: tmp__journal_obj.cfg_json,
data_json: tmp__journal_obj.data_json,
enable: tmp__journal_obj.enable,
hide: tmp__journal_obj.hide,
priority: tmp__journal_obj.priority,
sort: tmp__journal_obj.sort,
group: tmp__journal_obj.group,
notes: tmp__journal_obj.notes,
alert: tmp__journal_obj.alert,
alert_msg: tmp__journal_obj.alert_msg,
archive_on: tmp__journal_obj.archive_on,
default_private: tmp__journal_obj.default_private,
default_public: tmp__journal_obj.default_public,
default_personal: tmp__journal_obj.default_personal,
default_professional: tmp__journal_obj.default_professional
};
await journals_func.update_ae_obj__journal({ await journals_func.update_ae_obj__journal({
api_cfg: $ae_api, api_cfg: $ae_api,
journal_id: lq__journal_obj?.journal_id, journal_id: $lq__journal_obj?.journal_id,
data_kv: tmp__journal_obj, data_kv: data_kv,
log_lvl: log_lvl log_lvl: log_lvl
}); });
show = false; show = false;
@@ -102,11 +135,11 @@
} }
async function delete_journal() { async function delete_journal() {
if (confirm(`CRITICAL WARNING: Are you sure you want to delete the journal "${lq__journal_obj.name}"? This will delete all entries associated with it.`)) { if (confirm(`CRITICAL WARNING: Are you sure you want to delete the journal "${$lq__journal_obj.name}"? This will delete all entries associated with it.`)) {
try { try {
await journals_func.delete_ae_obj_id__journal({ await journals_func.delete_ae_obj_id__journal({
api_cfg: $ae_api, api_cfg: $ae_api,
journal_id: lq__journal_obj?.journal_id, journal_id: $lq__journal_obj?.journal_id,
log_lvl: log_lvl log_lvl: log_lvl
}); });
alert('Journal deleted successfully!'); alert('Journal deleted successfully!');
@@ -142,7 +175,7 @@
<Layout size="1.1em" class="mr-1" /> General <Layout size="1.1em" class="mr-1" /> General
</button> </button>
<button class="btn btn-sm transition-all {tab === 'security' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'security')}> <button class="btn btn-sm transition-all {tab === 'security' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'security')}>
<ShieldCheck size="1.1em" class="mr-1" /> Security <ShieldCheck size="1.1em" class="mr-1" /> Status & Security
</button> </button>
<button class="btn btn-sm transition-all {tab === 'ui' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'ui')}> <button class="btn btn-sm transition-all {tab === 'ui' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'ui')}>
<Palette size="1.1em" class="mr-1" /> UI/Visuals <Palette size="1.1em" class="mr-1" /> UI/Visuals
@@ -208,6 +241,49 @@
{:else if tab === 'security'} {:else if tab === 'security'}
<div class="space-y-6 animate-in fade-in duration-300"> <div class="space-y-6 animate-in fade-in duration-300">
<!-- Status & Lifecycle -->
<section class="space-y-4 p-2">
<h2 class="text-lg font-bold flex items-center gap-2 border-b border-surface-500/30 pb-2">
<Fingerprint size="1.2em" class="text-primary-500" />
Status & Lifecycle
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp__journal_obj.enable} class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Enabled</span>
<span class="text-xs opacity-60">Allow access to this journal</span>
</div>
</label>
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp__journal_obj.hide} class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Hidden</span>
<span class="text-xs opacity-60">Hide from standard lists</span>
</div>
</label>
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp__journal_obj.priority} class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Priority Journal</span>
<span class="text-xs opacity-60">Star or pin to top</span>
</div>
</label>
<div class="flex items-center justify-between p-3 rounded-lg bg-surface-500/5 border border-surface-500/10">
<div class="flex flex-col">
<span class="font-bold text-sm">Sort Order</span>
<span class="text-xs opacity-60">Manual list position</span>
</div>
<div class="flex items-center gap-2">
<button class="btn-icon btn-icon-sm variant-soft-surface" onclick={() => { tmp__journal_obj.sort = (tmp__journal_obj.sort ?? 0) - 1; }}><Minus size="1em"/></button>
<span class="font-mono font-bold w-8 text-center text-lg">{tmp__journal_obj.sort ?? 0}</span>
<button class="btn-icon btn-icon-sm variant-soft-surface" onclick={() => { tmp__journal_obj.sort = (tmp__journal_obj.sort ?? 0) + 1; }}><Plus size="1em"/></button>
</div>
</div>
</div>
</section>
<!-- Encryption Passcodes -->
<section class="space-y-4 p-2"> <section class="space-y-4 p-2">
<h2 class="text-lg font-bold flex items-center gap-2 border-b border-surface-500/30 pb-2"> <h2 class="text-lg font-bold flex items-center gap-2 border-b border-surface-500/30 pb-2">
<LockKeyhole size="1.2em" class="text-primary-500" /> <LockKeyhole size="1.2em" class="text-primary-500" />
@@ -234,27 +310,6 @@
</div> </div>
</section> </section>
<section class="space-y-4 p-2">
<h2 class="text-lg font-bold flex items-center gap-2 border-b border-surface-500/30 pb-2">
<Fingerprint size="1.2em" class="text-primary-500" />
Status & Lifecycle
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp__journal_obj.enable} class="checkbox checkbox-primary" />
<span class="font-bold">Enabled</span>
</label>
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp__journal_obj.hide} class="checkbox checkbox-primary" />
<span class="font-bold">Hidden</span>
</label>
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp__journal_obj.priority} class="checkbox checkbox-primary" />
<span class="font-bold">Priority Journal</span>
</label>
</div>
</section>
<section class="pt-8"> <section class="pt-8">
<button class="btn btn-sm variant-filled-error w-full shadow-lg" onclick={delete_journal}> <button class="btn btn-sm variant-filled-error w-full shadow-lg" onclick={delete_journal}>
<Trash2 size="1.1em" class="mr-2" /> Delete Entire Journal <Trash2 size="1.1em" class="mr-2" /> Delete Entire Journal

View File

@@ -86,7 +86,7 @@
<Shapes size="1.1em" class="mr-1" /> Metadata <Shapes size="1.1em" class="mr-1" /> Metadata
</button> </button>
<button class="btn btn-sm transition-all {tab === 'security' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'security')}> <button class="btn btn-sm transition-all {tab === 'security' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'security')}>
<ShieldCheck size="1.1em" class="mr-1" /> Security <ShieldCheck size="1.1em" class="mr-1" /> Status & Security
</button> </button>
<button class="btn btn-sm transition-all {tab === 'json' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'json')}> <button class="btn btn-sm transition-all {tab === 'json' ? 'variant-filled-primary' : 'variant-soft-surface'}" onclick={() => (tab = 'json')}>
<CodeXml size="1.1em" class="mr-1" /> JSON <CodeXml size="1.1em" class="mr-1" /> JSON
@@ -163,6 +163,47 @@
{:else if tab === 'security'} {:else if tab === 'security'}
<div class="space-y-6 animate-in fade-in duration-300"> <div class="space-y-6 animate-in fade-in duration-300">
<section class="space-y-4">
<h2 class="text-lg font-bold flex items-center gap-2 border-b border-surface-500/30 pb-2">
<Fingerprint size="1.2em" class="text-primary-500" />
Status & Lifecycle
</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp_entry_obj.enable} class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Enabled</span>
<span class="text-xs opacity-60">Allow access to this entry</span>
</div>
</label>
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp_entry_obj.hide} class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Hidden</span>
<span class="text-xs opacity-60">Hide from standard lists</span>
</div>
</label>
<label class="flex items-center space-x-3 cursor-pointer p-3 rounded-lg bg-surface-500/5 border border-surface-500/10 transition-colors hover:bg-surface-500/10">
<input type="checkbox" bind:checked={tmp_entry_obj.priority} class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Priority Entry</span>
<span class="text-xs opacity-60">Star or pin to top</span>
</div>
</label>
<div class="flex items-center justify-between p-3 rounded-lg bg-surface-500/5 border border-surface-500/10">
<div class="flex flex-col">
<span class="font-bold text-sm">Sort Order</span>
<span class="text-xs opacity-60">Manual list position</span>
</div>
<div class="flex items-center gap-2">
<button class="btn-icon btn-icon-sm variant-soft-surface" onclick={() => { tmp_entry_obj.sort = (tmp_entry_obj.sort ?? 0) - 1; }}><Minus size="1em"/></button>
<span class="font-mono font-bold w-8 text-center text-lg">{tmp_entry_obj.sort ?? 0}</span>
<button class="btn-icon btn-icon-sm variant-soft-surface" onclick={() => { tmp_entry_obj.sort = (tmp_entry_obj.sort ?? 0) + 1; }}><Plus size="1em"/></button>
</div>
</div>
</div>
</section>
<section class="space-y-4"> <section class="space-y-4">
<h4 class="text-xs font-bold uppercase opacity-50">Privacy Flags</h4> <h4 class="text-xs font-bold uppercase opacity-50">Privacy Flags</h4>
<AE_ObjectFlags <AE_ObjectFlags