Now with a description and basic color scheme. Saving before making some more changes.

This commit is contained in:
Scott Idem
2025-04-03 18:27:59 -04:00
parent 2ab026611f
commit e022645f64
7 changed files with 125 additions and 8 deletions

View File

@@ -58,6 +58,7 @@ async function handle_update_journal() {
let data_kv = {
// account: $slct.account_id,
name: $journals_slct.tmp_journal_obj.name,
description: $journals_slct.tmp_journal_obj.description ?? '', // Ensure description is at least an empty string
type_code: $journals_slct.tmp_journal_obj.type_code,
passcode: $journals_slct.tmp_journal_obj.passcode,
passcode_timeout: $journals_slct.tmp_journal_obj.passcode_timeout,
@@ -171,6 +172,7 @@ async function handle_update_journal() {
onclick={() => {
$journals_slct.tmp_journal_obj = {
name: $lq__journal_obj?.name,
description: $lq__journal_obj?.description,
type_code: $lq__journal_obj?.type_code,
passcode: $lq__journal_obj?.passcode,
passcode_timeout: $lq__journal_obj?.passcode_timeout,
@@ -258,7 +260,10 @@ async function handle_update_journal() {
"
bind:value={$journals_loc.qry__category_code}
onchange={(event) => {
// WARNING: This will cause pages to reset if the journal entry list is being filtered by category. This is a bug that should be fixed.
$journals_loc.qry__category_code = event.target.value;
$journals_loc.filter__category_code = event.target.value;
$journals_trig.journal_entry_li = true;
console.log('Selected category:', $journals_loc.qry__category_code);
}}
title="Select a category for the new journal entry"
@@ -297,6 +302,15 @@ async function handle_update_journal() {
<!-- <h3 class="font-bold text-lg">Edit Journal</h3> -->
<div class="py-4">
<input type="text" placeholder="Journal Name" bind:value={$journals_slct.tmp_journal_obj.name} class="input input-bordered w-full mb-2" />
<!-- Journal Description (Markdown) -->
<textarea
placeholder="Journal Description (Markdown format)"
bind:value={$journals_slct.tmp_journal_obj.description}
class="input input-bordered w-full mb-2 h-32 resize-none"
title="Description of the journal (supports Markdown)"
></textarea>
<input type="text" placeholder="Journal Type" bind:value={$journals_slct.tmp_journal_obj.type_code} class="input input-bordered w-full mb-2" />
<!-- input for passcode -->
@@ -393,7 +407,34 @@ async function handle_update_journal() {
</select>
</div>
<!-- Select color scheme for the journal entries -->
<!-- Should select from the common Tailwind CSS options. Examples: slate, blue, gray, green, orange, red, yellow, etc. -->
<!-- Saves to cfg_json.color_scheme -->
<div>
<span class="text-sm text-gray-500 hidden sm:inline">
Color Scheme:
</span>
<select
class="btn btn-sm variant-ghost-surface hover:variant-filled-surface transition text-xs w-full mb-2 max-w-96"
bind:value={$journals_slct.tmp_journal_obj.cfg_json.color_scheme}
title="Select color scheme for journal entries"
onchange={(event) => {
$journals_slct.tmp_journal_obj.cfg_json.color_scheme = event.target.value;
console.log('Selected color scheme:', $journals_slct.tmp_journal_obj.cfg_json.color_scheme);
}}
>
<option value="">Default (auto)</option>
<option value="slate">Slate</option>
<option value="gray">Gray</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
<option value="orange">Orange</option>
<option value="red">Red</option>
<option value="yellow">Yellow</option>
</select>
</div>
<!-- JSON configuration editor for advanced users -->
<!-- textarea for json_cfg editing -->
</div>