From f8476e11331e87bf72f3a22cc61c509711beb3f6 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 6 Feb 2026 15:04:55 -0500 Subject: [PATCH] refactor(events): finalize formatting and fix remaining native calls - Corrected missed native 'event.preventDefault()' calls in badge form components. - Applied batch formatting (printWidth: 80) to top-level event route files. --- .../badges/ae_comp__badge_create_form.svelte | 2 +- .../badges/ae_comp__badge_upload_form.svelte | 2 +- src/routes/events/[event_id]/+page.svelte | 266 +++++++++++++----- .../events/[event_id]/event_page_menu.svelte | 141 +++++++--- .../events/[event_id]/sign_in_out.svelte | 59 ++-- 5 files changed, 328 insertions(+), 142 deletions(-) diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_create_form.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_create_form.svelte index 5261c6a5..8c17586b 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_create_form.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_create_form.svelte @@ -40,7 +40,7 @@ ]; async function handle_submit(event: Event) { - event.prevent_default(); + event.preventDefault(); submit_status = 'loading'; const data_to_create: key_val = { full_name_override, diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_upload_form.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_upload_form.svelte index ac9e7868..b05aabbc 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_upload_form.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_upload_form.svelte @@ -48,7 +48,7 @@ } async function handle_upload(event: Event) { - event.prevent_default(); + event.preventDefault(); if (!selected_file) { upload_message = 'Please select a file first.'; upload_status = 'error'; diff --git a/src/routes/events/[event_id]/+page.svelte b/src/routes/events/[event_id]/+page.svelte index ca44d7ee..27eedc78 100644 --- a/src/routes/events/[event_id]/+page.svelte +++ b/src/routes/events/[event_id]/+page.svelte @@ -45,15 +45,24 @@ // *** Initialization & Store Guard *** if ($events_loc.pres_mgmt) { - if (typeof $events_loc.pres_mgmt.search_version === 'undefined') $events_loc.pres_mgmt.search_version = 0; - if (typeof $events_loc.pres_mgmt.qry__remote_first === 'undefined') $events_loc.pres_mgmt.qry__remote_first = false; - if (typeof $events_loc.pres_mgmt.fulltext_search_qry_str === 'undefined') $events_loc.pres_mgmt.fulltext_search_qry_str = ''; - if (typeof $events_loc.pres_mgmt.location_name_qry_str === 'undefined') $events_loc.pres_mgmt.location_name_qry_str = ''; + if (typeof $events_loc.pres_mgmt.search_version === 'undefined') + $events_loc.pres_mgmt.search_version = 0; + if (typeof $events_loc.pres_mgmt.qry__remote_first === 'undefined') + $events_loc.pres_mgmt.qry__remote_first = false; + if ( + typeof $events_loc.pres_mgmt.fulltext_search_qry_str === 'undefined' + ) + $events_loc.pres_mgmt.fulltext_search_qry_str = ''; + if (typeof $events_loc.pres_mgmt.location_name_qry_str === 'undefined') + $events_loc.pres_mgmt.location_name_qry_str = ''; } let lq__event_obj = $derived( liveQuery(async () => { - if (log_lvl) console.log(`*** LiveQuery: lq__event_obj *** event_id=${$events_slct.event_id}`); + if (log_lvl) + console.log( + `*** LiveQuery: lq__event_obj *** event_id=${$events_slct.event_id}` + ); return await db_events.event.get($events_slct?.event_id ?? ''); }) ); @@ -78,18 +87,26 @@ let lq__event_session_obj_li = $derived.by(() => { const ids = event_session_id_li; const event_id = $events_slct?.event_id; - + return liveQuery(async () => { // SCENARIO 1: Specific IDs provided (Search Results) if (Array.isArray(ids) && ids.length > 0) { - if (log_lvl) console.log(`Session Page LQ: bulkGet ${ids.length} IDs`); + if (log_lvl) + console.log(`Session Page LQ: bulkGet ${ids.length} IDs`); const results = await db_events.session.bulkGet(ids); - return results.filter(item => item !== undefined); + return results.filter((item) => item !== undefined); } - + // SCENARIO 2: Fallback broad search (Only if no active filters) - if (event_id && !$events_loc.pres_mgmt.fulltext_search_qry_str && !$events_loc.pres_mgmt.location_name_qry_str) { - if (log_lvl) console.log(`Session Page LQ: Fallback search for event: ${event_id}`); + if ( + event_id && + !$events_loc.pres_mgmt.fulltext_search_qry_str && + !$events_loc.pres_mgmt.location_name_qry_str + ) { + if (log_lvl) + console.log( + `Session Page LQ: Fallback search for event: ${event_id}` + ); return await db_events.session .where('event_id') .equals(event_id) @@ -114,7 +131,9 @@ // Standardized Reactive Search Pattern (Aether UI V3) let search_params = $derived({ v: $events_loc.pres_mgmt.search_version, - str: ($events_loc.pres_mgmt.fulltext_search_qry_str ?? '').toLowerCase().trim(), + str: ($events_loc.pres_mgmt.fulltext_search_qry_str ?? '') + .toLowerCase() + .trim(), location: $events_loc.pres_mgmt.location_name_qry_str, event_id: $events_slct?.event_id, remote_first: $events_loc.pres_mgmt.qry__remote_first @@ -140,9 +159,12 @@ const current_search_id = ++last_search_id; const event_id = params.event_id; const remote_first = params.remote_first; - - if (log_lvl) console.log(`[Session Search #${current_search_id}] Refreshing (remote=${remote_first}, event=${event_id}, str=${params.str})...`); - + + if (log_lvl) + console.log( + `[Session Search #${current_search_id}] Refreshing (remote=${remote_first}, event=${event_id}, str=${params.str})...` + ); + untrack(() => { $events_sess.pres_mgmt.status_qry__search = 'loading'; }); @@ -157,34 +179,52 @@ let local_results = await db_events.session .where('event_id') .equals(event_id) - .filter(session => { - if (location_name && session.event_location_name !== location_name) return false; - + .filter((session) => { + if ( + location_name && + session.event_location_name !== location_name + ) + return false; + if (qry_str) { const name = (session.name ?? '').toLowerCase(); const code = (session.code ?? '').toLowerCase(); - const description = (session.description ?? '').toLowerCase(); - const qry_string = (session.default_qry_str ?? '').toLowerCase(); - - const match = name.includes(qry_str) || - code.includes(qry_str) || - description.includes(qry_str) || - qry_string.includes(qry_str); - + const description = ( + session.description ?? '' + ).toLowerCase(); + const qry_string = ( + session.default_qry_str ?? '' + ).toLowerCase(); + + const match = + name.includes(qry_str) || + code.includes(qry_str) || + description.includes(qry_str) || + qry_string.includes(qry_str); + if (!match) return false; } return true; }) .toArray(); - local_results.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')); - const local_ids = local_results.map(s => s.id || s.event_session_id).filter(Boolean); + local_results.sort((a, b) => + (a.name ?? '').localeCompare(b.name ?? '') + ); + const local_ids = local_results + .map((s) => s.id || s.event_session_id) + .filter(Boolean); if (current_search_id === last_search_id) { - if (log_lvl) console.log(`[Session Search #${current_search_id}] Fast Path found ${local_ids.length} items locally.`); + if (log_lvl) + console.log( + `[Session Search #${current_search_id}] Fast Path found ${local_ids.length} items locally.` + ); untrack(() => { event_session_id_li = local_ids; - if (local_ids.length > 0) $events_sess.pres_mgmt.status_qry__search = 'done'; + if (local_ids.length > 0) + $events_sess.pres_mgmt.status_qry__search = + 'done'; }); } } @@ -214,32 +254,46 @@ if (current_search_id === last_search_id) { let api_results = results || []; - + // Client-side Filter Guard: Ensure API results match local criteria (Backup filter) - api_results = api_results.filter(session => { - if (location_name && session.event_location_name !== location_name) return false; + api_results = api_results.filter((session) => { + if ( + location_name && + session.event_location_name !== location_name + ) + return false; if (qry_str) { const name = (session.name ?? '').toLowerCase(); const code = (session.code ?? '').toLowerCase(); - const description = (session.description ?? '').toLowerCase(); - const qry_string = (session.default_qry_str ?? '').toLowerCase(); - const match = name.includes(qry_str) || - code.includes(qry_str) || - description.includes(qry_str) || - qry_string.includes(qry_str); + const description = ( + session.description ?? '' + ).toLowerCase(); + const qry_string = ( + session.default_qry_str ?? '' + ).toLowerCase(); + const match = + name.includes(qry_str) || + code.includes(qry_str) || + description.includes(qry_str) || + qry_string.includes(qry_str); if (!match) return false; } return true; }); - const api_ids = api_results.map((s: any) => s.id || s.event_session_id).filter(Boolean); - + const api_ids = api_results + .map((s: any) => s.id || s.event_session_id) + .filter(Boolean); + untrack(() => { $events_slct.event_session_obj_li = api_results; event_session_id_li = api_ids; $events_sess.pres_mgmt.status_qry__search = 'done'; }); - if (log_lvl) console.log(`[Session Search #${current_search_id}] Revalidation Complete. Found ${api_ids.length} items.`); + if (log_lvl) + console.log( + `[Session Search #${current_search_id}] Revalidation Complete. Found ${api_ids.length} items.` + ); } } catch (error) { if (current_search_id === last_search_id) { @@ -251,7 +305,10 @@ } } - if ($events_loc.pres_mgmt?.save_search_text && $events_loc.pres_mgmt?.saved_search__session) { + if ( + $events_loc.pres_mgmt?.save_search_text && + $events_loc.pres_mgmt?.saved_search__session + ) { $events_loc.pres_mgmt.fulltext_search_qry_str = $events_loc.pres_mgmt.saved_search__session; } @@ -278,7 +335,10 @@ Æ: - {ae_util.shorten_string({ string: $lq__event_obj?.name, max_length: 12 })} + {ae_util.shorten_string({ + string: $lq__event_obj?.name, + max_length: 12 + })} - Pres Mgmt - {$events_loc?.title} @@ -294,17 +354,24 @@
- -

+

{$lq__event_obj.cfg_json?.short_name ?? $lq__event_obj?.name} @@ -345,12 +414,15 @@ autocomplete="off" class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full" > - {#if $ae_loc.edit_mode} -

-

This event is currently disabled. Please contact the event organizer for more information.

+

+ This event is currently disabled. Please contact the event organizer + for more information. +

{/if} \ No newline at end of file + diff --git a/src/routes/events/[event_id]/event_page_menu.svelte b/src/routes/events/[event_id]/event_page_menu.svelte index 86b935b2..ca91f952 100644 --- a/src/routes/events/[event_id]/event_page_menu.svelte +++ b/src/routes/events/[event_id]/event_page_menu.svelte @@ -43,7 +43,9 @@
-
+
- - -
-
+
- {:else if $ae_loc.manager_access} -
-
+
- - - - - - {:else if $events_sess.auth__person.presenter_id || $events_sess.auth__person.session_id} -
+
- Use the link that was sent to your email address to sign in or enter your key and - passcode to sign in. + Use the link that was sent to your email address to sign in or + enter your key and passcode to sign in.
($events_sess.auth__entered_key = e.target?.value)} + oninput={(e) => + ($events_sess.auth__entered_key = e.target?.value)} /> ($events_sess.auth__entered_passcode = e.target?.value)} + oninput={(e) => + ($events_sess.auth__entered_passcode = e.target?.value)} /> -