Making things prettier:

npx prettier --write src/routes/journals/
This commit is contained in:
Scott Idem
2026-05-05 17:27:48 -04:00
parent 8b087edeb9
commit 62cc26d1f9
16 changed files with 142 additions and 106 deletions

View File

@@ -27,10 +27,7 @@ import { ae_loc, ae_api } from '$lib/stores/ae_stores';
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
import AE_Comp_Editor_CodeMirror from '$lib/elements/element_editor_codemirror.svelte';
import AE_Object_Flags from '$lib/ae_elements/AE_Object_Flags.svelte';
import type {
ae_Journal,
ae_JournalEntryDraft
} from '$lib/types/ae_types';
import type { ae_Journal, ae_JournalEntryDraft } from '$lib/types/ae_types';
interface Props {
log_lvl?: number;
@@ -64,12 +61,17 @@ const normalize_date = (val?: string | Date | null) => {
return val.slice(0, 16);
};
const panel_class = 'space-y-4 rounded-xl border border-surface-500/20 bg-surface-500/5 p-4 shadow-sm';
const panel_title_class = 'flex items-center gap-2 border-b border-surface-500/20 pb-2 text-lg font-bold';
const field_card_class = 'bg-surface-500/5 border-surface-500/10 flex cursor-pointer items-center space-x-3 rounded-lg border p-3 transition-colors hover:bg-surface-500/10';
const panel_class =
'space-y-4 rounded-xl border border-surface-500/20 bg-surface-500/5 p-4 shadow-sm';
const panel_title_class =
'flex items-center gap-2 border-b border-surface-500/20 pb-2 text-lg font-bold';
const field_card_class =
'bg-surface-500/5 border-surface-500/10 flex cursor-pointer items-center space-x-3 rounded-lg border p-3 transition-colors hover:bg-surface-500/10';
const tab_button_base_class = 'btn btn-sm border transition-all duration-200';
const tab_button_active_class = 'border-surface-200-800 bg-surface-200-800 text-surface-950-50 shadow-sm';
const tab_button_inactive_class = 'border-transparent bg-surface-50-900/60 text-surface-600-400 hover:border-surface-200-800 hover:bg-surface-100-900 hover:text-surface-950-50';
const tab_button_active_class =
'border-surface-200-800 bg-surface-200-800 text-surface-950-50 shadow-sm';
const tab_button_inactive_class =
'border-transparent bg-surface-50-900/60 text-surface-600-400 hover:border-surface-200-800 hover:bg-surface-100-900 hover:text-surface-950-50';
function tab_button_class(is_active: boolean): string {
return `${tab_button_base_class} ${is_active ? tab_button_active_class : tab_button_inactive_class}`;
@@ -134,7 +136,11 @@ async function handle_admin_delete_action() {
return;
}
if (!confirm(`Are you sure you want to ${confirm_label} this journal entry?`)) {
if (
!confirm(
`Are you sure you want to ${confirm_label} this journal entry?`
)
) {
return;
}
@@ -149,7 +155,10 @@ async function handle_admin_delete_action() {
show = false;
await goto(`/journals/${tmp_entry_obj.journal_id}`);
} catch (error) {
console.error(`Error attempting to ${action_label} journal entry:`, error);
console.error(
`Error attempting to ${action_label} journal entry:`,
error
);
alert(`Failed to ${action_label} journal entry.`);
}
}
@@ -161,7 +170,7 @@ async function handle_admin_delete_action() {
dismissable={false}
placement="top-center"
size="lg"
class="relative mx-auto flex h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] w-full flex-col rounded-xl border border-surface-200-800 bg-surface-50-900 text-surface-950-50 shadow-xl"
class="border-surface-200-800 bg-surface-50-900 text-surface-950-50 relative mx-auto flex h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] w-full flex-col rounded-xl border shadow-xl"
headerClass="flex w-full flex-row items-center justify-between gap-2 rounded-t-xl border-b border-surface-200-800 bg-surface-100-900 p-4"
footerClass="mt-auto flex w-full shrink-0 flex-row items-center justify-center gap-2 rounded-b-xl border-t border-surface-200-800 bg-surface-100-900 p-4">
{#snippet header()}
@@ -383,7 +392,8 @@ async function handle_admin_delete_action() {
</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
{#if tmp_entry_obj.alert}
<label class="label md:col-span-2 flex flex-col items-start gap-1">
<label
class="label flex flex-col items-start gap-1 md:col-span-2">
<span class="text-sm font-bold opacity-70"
>Alert Message</span>
<textarea
@@ -434,9 +444,11 @@ async function handle_admin_delete_action() {
</div>
</label>
<label class="bg-surface-500/5 border-surface-500/10 flex items-center justify-between rounded-lg border p-3">
<label
class="bg-surface-500/5 border-surface-500/10 flex items-center justify-between rounded-lg border p-3">
<div class="flex flex-col">
<span class="text-sm font-bold">Sort Order</span>
<span class="text-sm font-bold"
>Sort Order</span>
<span class="text-xs opacity-60">
Lower numbers appear earlier in lists.
</span>
@@ -468,10 +480,13 @@ async function handle_admin_delete_action() {
<section class={panel_class}>
<h2 class={panel_title_class}>
<FingerprintPattern size="1.2em" class="text-primary-500" />
<FingerprintPattern
size="1.2em"
class="text-primary-500" />
Security and Privacy
</h2>
<div class="space-y-4 rounded-xl border border-surface-500/10 bg-surface-500/5 p-4">
<div
class="border-surface-500/10 bg-surface-500/5 space-y-4 rounded-xl border p-4">
<label class="label flex flex-col items-start gap-1">
<span class="text-sm font-bold opacity-70"
>Passcode</span>
@@ -490,7 +505,8 @@ async function handle_admin_delete_action() {
</label>
<div class="space-y-2">
<p class="text-xs font-semibold uppercase tracking-wider opacity-60">
<p
class="text-xs font-semibold tracking-wider uppercase opacity-60">
Visibility and audience
</p>
<AE_Object_Flags
@@ -501,9 +517,11 @@ async function handle_admin_delete_action() {
on_save();
}}
hide_alert={true}
hide_private={journal?.cfg_json?.hide_btn_private}
hide_private={journal?.cfg_json
?.hide_btn_private}
hide_public={journal?.cfg_json?.hide_btn_public}
hide_personal={journal?.cfg_json?.hide_btn_personal}
hide_personal={journal?.cfg_json
?.hide_btn_personal}
hide_professional={journal?.cfg_json
?.hide_btn_professional}
hide_template={true} />
@@ -536,19 +554,24 @@ async function handle_admin_delete_action() {
</section>
{/if}
<details class="rounded-xl border border-surface-500/20 bg-surface-500/5 shadow-sm">
<summary class="flex cursor-pointer items-center gap-2 border-b border-surface-500/20 px-4 py-3 text-lg font-bold">
<details
class="border-surface-500/20 bg-surface-500/5 rounded-xl border shadow-sm">
<summary
class="border-surface-500/20 flex cursor-pointer items-center gap-2 border-b px-4 py-3 text-lg font-bold">
<Settings size="1.2em" class="text-primary-500" />
Admin
</summary>
<div class="space-y-4 p-4">
<p class="text-xs opacity-60">
Trusted access and above only. Notes are for staff use; managers and admins see Delete while trusted access sees Remove.
Trusted access and above only. Notes are for staff
use; managers and admins see Delete while trusted
access sees Remove.
</p>
<div class="grid grid-cols-1 gap-4">
<label class="label">
<span class="text-sm font-bold opacity-70">Notes</span>
<span class="text-sm font-bold opacity-70"
>Notes</span>
<textarea
bind:value={tmp_entry_obj.notes}
class="textarea min-h-24"
@@ -572,15 +595,21 @@ async function handle_admin_delete_action() {
<div class="flex flex-col">
<span class="font-bold">Enabled</span>
<span class="text-xs opacity-60">
Allow default access for AE object type; essentially marked for deletion.
Allow default access for AE object
type; essentially marked for
deletion.
</span>
</div>
</label>
<button
type="button"
class="btn btn-sm mx-auto inline-flex w-fit min-w-36 justify-center gap-2 px-4 font-bold {($ae_loc.manager_access || $ae_loc.administrator_access) ? 'preset-tonal-error hover:preset-filled-error-500' : 'preset-tonal-warning hover:preset-filled-warning-500'}"
title={($ae_loc.manager_access || $ae_loc.administrator_access)
class="btn btn-sm mx-auto inline-flex w-fit min-w-36 justify-center gap-2 px-4 font-bold {$ae_loc.manager_access ||
$ae_loc.administrator_access
? 'preset-tonal-error hover:preset-filled-error-500'
: 'preset-tonal-warning hover:preset-filled-warning-500'}"
title={$ae_loc.manager_access ||
$ae_loc.administrator_access
? 'Permanently delete this journal entry'
: 'Disable this journal entry instead of deleting it'}
onclick={handle_admin_delete_action}>