Working to make the dark mode look better. Work on the help tech component. General clean up.

This commit is contained in:
Scott Idem
2025-08-12 17:59:37 -04:00
parent 496eea48ee
commit 231462e3ad
17 changed files with 350 additions and 87 deletions

View File

@@ -122,11 +122,12 @@ const ae_app_local_data_defaults: key_val = {
// Added 2025-04-04
person_id: null, // The current person_id of the logged-in user (if any)
person: {
// WARNING: We need to add some logic on sign in to only include needed fields. 2025-08-12
id: null, // The current person_id of the logged-in user
// profile_id: null, // The current person_profile_id of the logged-in user
// pronouns: null,
// informal_name: null,
// given_name: null,
given_name: null,
// family_name: null,
// professional_title: null,
full_name: null, // convenience

View File

@@ -7,6 +7,8 @@ interface Props {
e_class?: string;
e_title?: string;
e_text?: string;
e_class_h1?: string;
e_class_h2?: string;
e_class_form_hidden?: string;
e_class_form_showing?: string;
btn_text?: string;
@@ -23,6 +25,8 @@ let {
e_class = '',
e_title = 'Technical Help',
e_text = 'Request technical help for this application.',
e_class_h1 = $bindable(''),
e_class_h2 = $bindable(''),
e_class_form_hidden = $bindable(''),
e_class_form_showing = $bindable(''),
btn_text = 'Technical Help',
@@ -33,11 +37,13 @@ let {
}: Props = $props();
// *** Import Svelte specific
import { goto } from '$app/navigation';
// *** Import other supporting libraries
import {
// ArrowBigRight,
BadgeQuestionMark,
ChevronDown, ChevronRight,
// CircleX,
// Copy,
// Eye, EyeOff,
@@ -46,8 +52,9 @@ import {
// LogIn, LogOut, LockKeyhole,
// Mail, MailCheck,
// Menu,
// RefreshCw, RefreshCcw, RefreshCcwDot,
RefreshCw, RefreshCcw, RefreshCcwDot,
// ShieldEllipsis, ShieldMinus, ShieldPlus, ShieldUser,
SquareX,
// User, UserCheck
} from '@lucide/svelte';
@@ -130,13 +137,10 @@ function send_help_tech_email() {
<div
class="
m-2
mx-auto
p-2
flex flex-row
items-center justify-center
rounded-lg shadow-2xl
border-2 border-transparent
border-1 border-transparent
transition-all
{e_class}
{!$ae_sess.show_help_tech ? e_class_form_hidden : e_class_form_showing}
@@ -144,6 +148,9 @@ function send_help_tech_email() {
"
class:w-xl={$ae_sess.show_help_tech}
class:w-fit={!$ae_sess.show_help_tech}
class:mx-auto={$ae_sess.show_help_tech}
class:m-2={$ae_sess.show_help_tech}
class:p-2={$ae_sess.show_help_tech}
class:hover:border-blue-400={$ae_sess.show_help_tech}
class:hover:dark:border-blue-600={$ae_sess.show_help_tech}
class:hover:shadow-blue-200={$ae_sess.show_help_tech}
@@ -168,20 +175,21 @@ function send_help_tech_email() {
w-full
"
>
<h3
<h1
class="
h1
text-base font-semibold text-gray-800 dark:text-gray-200
w-fit
{e_class_h1}
"
>
{#if e_success}
<span class="text-green-800 dark:text-green-200 font-semibold">
<span class="text-lg text-green-800 dark:text-green-200 font-semibold">
<BadgeQuestionMark class="inline-block mr-2" />
Help Requested
</span>
{:else}
<span class="text-gray-800 dark:text-gray-200 font-semibold">
<span class="text-lg text-gray-800 dark:text-gray-200 font-semibold">
<BadgeQuestionMark class="inline-block mr-2" />
<!-- Request Technical Help -->
Notify Technical Support
@@ -192,16 +200,22 @@ function send_help_tech_email() {
{/if}
<!-- Cancel button -->
</h3>
</h1>
<button
type="button"
onclick={() => ($ae_sess.show_help_tech = false)}
class="
btn btn-base preset-tonal-tertiary
btn btn-base
preset-tonal-tertiary
preset-outlined-tertiary-100-900
hover:preset-filled-tertiary-200-800
transition-all
{btn_class}
"
title="Close Help Request Form"
>
<span class="fas fa-times"></span>
<!-- <span class="fas fa-times"></span> -->
<SquareX size="1em" />
<span class="sr-only">Close</span>
</button>
</div>
@@ -223,19 +237,31 @@ function send_help_tech_email() {
alert('Notification sent to the IT team.');
})}
>
<textarea
class="w-full max-w-lg h-24 p-2 border border-gray-300 rounded text-gray-950 dark:text-gray-50"
class="
form-control
w-full max-w-lg h-24 p-2
border border-gray-300 rounded
text-gray-950 dark:text-gray-50
bg-white dark:bg-gray-500
hover:dark:bg-gray-50
hover:dark:text-gray-950
"
placeholder="Send with or without a description...."
bind:value={help_tech_text}
></textarea>
<button
type="submit"
class="
btn btn-lg
m-1
preset-tonal-warning
hover:preset-tonal-success
preset-outlined-warning-600-400
preset-outlined-warning-100-900
hover:preset-filled-warning-200-800
transition-all
{btn_class}
"
@@ -278,19 +304,20 @@ function send_help_tech_email() {
w-full
"
>
<h4
<h2
class="
novi_white
h2
text-base font-semibold text-gray-800 dark:text-gray-200
flex flex-row gap-1 items-center justify-center
{e_class_h2}
"
>
<span class="text-base font-semibold text-gray-800 dark:text-gray-200">
Additional Information Included
</h4>
</span>
</h2>
<!-- Button to expand and show additional information -->
<button
type="button"
class="
btn btn-sm preset-tonal-tertiary
{btn_class}
@@ -300,46 +327,48 @@ function send_help_tech_email() {
>
<span>
{#if hide_additional_info}
<span class="fas fa-caret-right"></span>
<!-- <span class="fas fa-caret-right"></span> -->
<ChevronRight size="1em" class="inline-block" />
Show
{:else}
<span class="fas fa-caret-down"></span>
<!-- <span class="fas fa-caret-down"></span> -->
<ChevronDown size="1em" class="inline-block" />
Hide
{/if}
</span>
</button>
</div>
<ul
class="list-disc list-inside text-gray-800 text-sm"
class="list-disc list-inside text-sm text-gray-800 dark:text-gray-200"
class:hidden={hide_additional_info}
>
<li><span class="text-sm text-gray-500">Datetime =</span> {new Date().toISOString()}</li>
<li><span class="text-sm text-gray-500">URL =</span> {window.location.href}</li>
<li><span class="text-sm text-gray-500">Browser =</span> {navigator.userAgent}</li>
<li><span class="text-sm text-gray-500">Viewport Size =</span> {window.innerWidth} x {window.innerHeight}</li>
<li><span class="text-sm text-gray-500">Screen Resolution =</span> {window.screen.width} x {window.screen.height}</li>
<li><span class="text-sm text-gray-500">Dark mode =</span> {window?.matchMedia?.('(prefers-color-scheme:dark)')?.matches ?? false}</li>
<li><span class="text-sm text-gray-500">In iframe =</span> {$ae_loc?.iframe}</li>
<li><span class="text-sm text-gray-500">Theme Mode =</span> {$ae_loc?.theme_mode}</li>
<li><span class="text-sm text-gray-500">Theme Name =</span> {$ae_loc?.theme_name}</li>
<li><span class="text-sm text-gray-500">Account ID =</span> {$slct.account_id}</li>
<li><span class="text-sm text-gray-500">Access Type =</span> {$ae_loc?.access_type}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Datetime =</span> {new Date().toISOString()}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">URL =</span> {window.location.href}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Browser =</span> {navigator.userAgent}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Viewport Size =</span> {window.innerWidth} x {window.innerHeight}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Screen Resolution =</span> {window.screen.width} x {window.screen.height}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Dark mode =</span> {window?.matchMedia?.('(prefers-color-scheme:dark)')?.matches ?? false}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">In iframe =</span> {$ae_loc?.iframe}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Theme Mode =</span> {$ae_loc?.theme_mode}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Theme Name =</span> {$ae_loc?.theme_name}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Account ID =</span> {$slct.account_id}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">Access Type =</span> {$ae_loc?.access_type}</li>
{#if $ae_loc?.person_id}
<li><span class="text-sm text-gray-500">person_id =</span> {$ae_loc?.person_id}</li>
<li><span class="text-sm text-gray-500">full_name =</span> {$ae_loc?.full_name}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">person_id =</span> {$ae_loc?.person_id}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">full_name =</span> {$ae_loc?.full_name}</li>
{/if}
{#if $ae_loc?.user_id}
<li><span class="text-sm text-gray-500">user_id =</span> {$ae_loc?.user_id}</li>
<li><span class="text-sm text-gray-500">username =</span> {$ae_loc?.username}</li>
<li><span class="text-sm text-gray-500">email =</span> {$ae_loc?.email}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">user_id =</span> {$ae_loc?.user_id}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">username =</span> {$ae_loc?.username}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">email =</span> {$ae_loc?.email}</li>
{/if}
<li><span class="text-sm text-gray-500">API Base URL =</span> {$ae_api.base_url}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">API Base URL =</span> {$ae_api.base_url}</li>
{#if additional_kv && Object.keys(additional_kv).length > 0}
<h2 class="text-base font-semibold text-gray-800">Component Info:</h2>
<ul class="list-disc list-inside text-gray-800 text-sm">
{#each Object.entries(additional_kv) as [key, value]}
<li><span class="text-sm text-gray-500">{key} =</span> {value ?? '-- not set --'}</li>
<li><span class="text-sm text-gray-500 dark:text-gray-400">{key} =</span> {value ?? '-- not set --'}</li>
{/each}
</ul>
{/if}
@@ -351,31 +380,115 @@ function send_help_tech_email() {
</div>
<!-- Cancel button -->
<button
onclick={() => ($ae_sess.show_help_tech = false)}
class="
btn btn-sm preset-tonal-tertiary
m-1
{btn_class}
"
title="Close Help Request Form"
>
<span class="fas fa-times"></span>
<span class="">Cancel</span>
</button>
<div
class="
flex flex-row gap-2 items-center justify-around
w-full
mt-2
"
>
<button
type="button"
onclick={() => {
if ($ae_loc.edit_mode) {
// Confirm before clearing
if (!confirm("Are you sure you want to clear IndexedDB databases, localStorage, and sessionStorage? This will also reload the page.")) {
return;
}
console.log("Clearing IndexedDB, localStorage, sessionStorage, and reloading the page...");
// Clear Indexed DB
indexedDB.deleteDatabase('ae_archives_db'); // Archives module
indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_events_db'); // Events module
indexedDB.deleteDatabase('ae_journals_db'); // Journals module
indexedDB.deleteDatabase('ae_posts_db'); // Posts module
indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module
// Clear localStorage and sessionStorage
// Clearing the localStorage will force it to be re-created.
localStorage.clear();
sessionStorage.clear();
goto('/', {invalidateAll: true});
// window.location.reload(true);
} else {
// Confirm before clearing
if (!confirm("Are you sure you want to clear IndexedDB databases and some caches? This will also reload the page.")) {
return;
}
console.log("Clearing IndexedDB, localStorage, sessionStorage, and reloading the page...");
// Clear Indexed DB
indexedDB.deleteDatabase('ae_archives_db'); // Archives module
indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_events_db'); // Events module
indexedDB.deleteDatabase('ae_journals_db'); // Journals module
indexedDB.deleteDatabase('ae_posts_db'); // Posts module
indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module
window.location.reload(true);
}
// This does not seem to work fast enough or something?
// goto('/', {invalidateAll: true});
// The page does usually seem to reload correctly?
// window.location.reload(true); // true only works with Firefox
// alert('Local and Session Storage cleared and Indexed DBs deleted. You will probably want to refresh the page.');
}}
class="
btn btn-sm
preset-tonal-surface
preset-outlined-warning-100-900
hover:preset-filled-warning-200-800
transition-all
{btn_class}
"
title="Clear App Data & Settings: Clear IndexedDB and reload. If in edit mode localStorage and sessionStorage will also be cleared."
>
<!-- <span class="fas fa-eraser mx-1"></span> -->
<!-- <span class="fas fa-sync mx-1"></span> -->
<RefreshCw size="1em" class="inline-block" />
<span class="md:inline">Clear & Reload</span>
</button>
<!-- Cancel button -->
<button
type="button"
onclick={() => ($ae_sess.show_help_tech = false)}
class="
btn btn-sm
preset-tonal-tertiary
preset-outlined-tertiary-100-900
hover:preset-filled-tertiary-100-900
transition-all
{btn_class}
"
title="Close Help Request Form"
>
<!-- <span class="fas fa-times"></span> -->
<SquareX size="1em" class="inline-block" />
<span class="">Cancel</span>
</button>
</div>
</div>
{:else}
<button
type="button"
onclick={() => ($ae_sess.show_help_tech = true)}
class="
btn btn-sm
border border-blue-400 dark:border-blue-600
preset-filled-tertiary-400-600
preset-outlined-tertiary-100-900
hover:preset-filled-warning-500
transition-all
{btn_class}
{show_btn_class}