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.
This commit is contained in:
@@ -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 @@
|
||||
<svelte:head>
|
||||
<title>
|
||||
Æ:
|
||||
{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}
|
||||
</title>
|
||||
</svelte:head>
|
||||
@@ -294,17 +354,24 @@
|
||||
<header class="ae_module_header">
|
||||
<span class="flex flex-row flex-wrap gap-1 items-center justify-center">
|
||||
<span class="fas fa-calendar-day m-1 text-neutral-800/80"></span>
|
||||
<button type="button"
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
if ($events_loc.pres_mgmt.show_content__event_view == 'manage_files') {
|
||||
if (
|
||||
$events_loc.pres_mgmt.show_content__event_view ==
|
||||
'manage_files'
|
||||
) {
|
||||
$events_loc.pres_mgmt.show_content__event_view = null;
|
||||
} else {
|
||||
$events_loc.pres_mgmt.show_content__event_view = 'manage_files';
|
||||
$events_loc.pres_mgmt.show_content__event_view =
|
||||
'manage_files';
|
||||
}
|
||||
}}
|
||||
class="btn ae_btn_secondary"
|
||||
class:preset-filled-secondary-500={$events_loc.pres_mgmt.show_content__event_view == 'manage_files'}
|
||||
class:preset-filled-tertiary-500={$events_loc.pres_mgmt.show_content__event_view != 'manage_files'}
|
||||
class:preset-filled-secondary-500={$events_loc.pres_mgmt
|
||||
.show_content__event_view == 'manage_files'}
|
||||
class:preset-filled-tertiary-500={$events_loc.pres_mgmt
|
||||
.show_content__event_view != 'manage_files'}
|
||||
class:hidden={!$ae_loc.administrator_access}
|
||||
title="View event search or manage files for the event"
|
||||
>
|
||||
@@ -325,7 +392,9 @@
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<h2 class="text-2xl font-bold text-center max-w-xs sm:max-w-lg md:max-w-2xl">
|
||||
<h2
|
||||
class="text-2xl font-bold text-center max-w-xs sm:max-w-lg md:max-w-2xl"
|
||||
>
|
||||
<span class="sm:inline-block md:hidden">
|
||||
{$lq__event_obj.cfg_json?.short_name ?? $lq__event_obj?.name}
|
||||
</span>
|
||||
@@ -345,12 +414,15 @@
|
||||
autocomplete="off"
|
||||
class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full"
|
||||
>
|
||||
<button type="button"
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm mx-1 ae_btn_warning"
|
||||
class:hidden={!$ae_loc.authenticated_access}
|
||||
onclick={() => {
|
||||
$events_loc.pres_mgmt.location_name_qry_str = '';
|
||||
$events_loc.pres_mgmt.show_content__session_search_room_name = !$events_loc.pres_mgmt.show_content__session_search_room_name;
|
||||
$events_loc.pres_mgmt.show_content__session_search_room_name =
|
||||
!$events_loc.pres_mgmt
|
||||
.show_content__session_search_room_name;
|
||||
handle_search_trigger();
|
||||
}}
|
||||
title="Search by location name"
|
||||
@@ -363,24 +435,30 @@
|
||||
id="session_location_name_list"
|
||||
bind:value={$events_loc.pres_mgmt.location_name_qry_str}
|
||||
class="input text-xs font-bold font-mono min-w-fit w-min max-w-40 transition-all mx-1"
|
||||
class:hidden={!$ae_loc.authenticated_access || !$events_loc.pres_mgmt.show_content__session_search_room_name}
|
||||
class:hidden={!$ae_loc.authenticated_access ||
|
||||
!$events_loc.pres_mgmt
|
||||
.show_content__session_search_room_name}
|
||||
onchange={() => handle_search_trigger()}
|
||||
title="Select to filter based on the location/room name"
|
||||
>
|
||||
{#if $lq__event_location_obj_li}
|
||||
<option value="">Location / Room</option>
|
||||
{#each $lq__event_location_obj_li as event_location_obj}
|
||||
<option value={event_location_obj?.name}>{event_location_obj.name}</option>
|
||||
<option value={event_location_obj?.name}
|
||||
>{event_location_obj.name}</option
|
||||
>
|
||||
{/each}
|
||||
{/if}
|
||||
</select>
|
||||
|
||||
<button type="button"
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
$events_loc.pres_mgmt.fulltext_search_qry_str = '';
|
||||
handle_search_trigger();
|
||||
}}
|
||||
class:hidden={!$events_loc.pres_mgmt.fulltext_search_qry_str}
|
||||
class:hidden={!$events_loc.pres_mgmt
|
||||
.fulltext_search_qry_str}
|
||||
class="btn btn-sm mx-1 ae_btn_warning"
|
||||
title="Clear search text"
|
||||
>
|
||||
@@ -406,19 +484,26 @@
|
||||
title="Search for a session"
|
||||
>
|
||||
{#if $events_sess.pres_mgmt.status_qry__search == 'loading'}
|
||||
<span class="fas fa-spinner fa-spin mx-1 text-success-800-200"></span>
|
||||
<span
|
||||
class="fas fa-spinner fa-spin mx-1 text-success-800-200"
|
||||
></span>
|
||||
{:else}
|
||||
<span class="fas fa-search mx-1 text-neutral-800/80"></span>
|
||||
<span class="fas fa-search mx-1 text-neutral-800/80"
|
||||
></span>
|
||||
{/if}
|
||||
Search
|
||||
</button>
|
||||
|
||||
{#if $ae_loc.edit_mode}
|
||||
<label class="flex items-center gap-1 cursor-pointer bg-surface-200-800 px-2 py-1 rounded-token text-xs font-semibold opacity-70 hover:opacity-100 transition-all">
|
||||
<label
|
||||
class="flex items-center gap-1 cursor-pointer bg-surface-200-800 px-2 py-1 rounded-token text-xs font-semibold opacity-70 hover:opacity-100 transition-all"
|
||||
>
|
||||
<span> Remote First </span>
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={$events_loc.pres_mgmt.qry__remote_first}
|
||||
bind:checked={
|
||||
$events_loc.pres_mgmt.qry__remote_first
|
||||
}
|
||||
onchange={() => handle_search_trigger()}
|
||||
class="checkbox checkbox-sm"
|
||||
/>
|
||||
@@ -429,27 +514,40 @@
|
||||
|
||||
{#if event_session_id_li.length}
|
||||
<Comp_event_session_obj_li_wrapper
|
||||
lq__event_session_obj_li={lq__event_session_obj_li}
|
||||
hide__session_location={$events_loc.pres_mgmt?.hide__session_li_location_field}
|
||||
hide__session_poc={$events_loc.pres_mgmt?.hide__session_li_poc_field}
|
||||
hide__launcher_link_legacy={$events_loc.pres_mgmt?.hide__launcher_link_legacy}
|
||||
{lq__event_session_obj_li}
|
||||
hide__session_location={$events_loc.pres_mgmt
|
||||
?.hide__session_li_location_field}
|
||||
hide__session_poc={$events_loc.pres_mgmt
|
||||
?.hide__session_li_poc_field}
|
||||
hide__launcher_link_legacy={$events_loc.pres_mgmt
|
||||
?.hide__launcher_link_legacy}
|
||||
hide__launcher_link={$events_loc.pres_mgmt?.hide__launcher_link}
|
||||
hide__location_link={$events_loc.pres_mgmt?.hide__location_link}
|
||||
log_lvl={1}
|
||||
/>
|
||||
{:else if $events_sess.pres_mgmt.status_qry__search === 'loading'}
|
||||
<div class="flex flex-col items-center justify-center p-20 opacity-50 text-center">
|
||||
<div
|
||||
class="flex flex-col items-center justify-center p-20 opacity-50 text-center"
|
||||
>
|
||||
<span class="fas fa-spinner fa-spin text-4xl mb-4"></span>
|
||||
<p class="text-xl">Searching sessions...</p>
|
||||
</div>
|
||||
{:else}
|
||||
<section class="text-center text-2xl bg-yellow-100 p-4 rounded-md lg:max-w-lg space-y-2 mx-auto">
|
||||
<section
|
||||
class="text-center text-2xl bg-yellow-100 p-4 rounded-md lg:max-w-lg space-y-2 mx-auto"
|
||||
>
|
||||
<div>
|
||||
<span class="fas fa-exclamation-triangle text-2xl text-yellow-500"></span>
|
||||
<span
|
||||
class="fas fa-exclamation-triangle text-2xl text-yellow-500"
|
||||
></span>
|
||||
<strong>No results to show</strong>
|
||||
<span class="fas fa-exclamation-triangle text-2xl text-yellow-500"></span>
|
||||
<span
|
||||
class="fas fa-exclamation-triangle text-2xl text-yellow-500"
|
||||
></span>
|
||||
<br />
|
||||
<div class="text-lg">Please use the search above to find your session.</div>
|
||||
<div class="text-lg">
|
||||
Please use the search above to find your session.
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<strong>Search by:</strong>
|
||||
@@ -487,13 +585,18 @@
|
||||
<span>
|
||||
<div class="text-lg">
|
||||
<span class="fas fa-upload"></span>
|
||||
<strong class="">Upload global event files only!</strong>
|
||||
<strong class=""
|
||||
>Upload global event files only!</strong
|
||||
>
|
||||
</div>
|
||||
<div class="text-sm text-gray-600 dark:text-gray-400 italic">
|
||||
<div
|
||||
class="text-sm text-gray-600 dark:text-gray-400 italic"
|
||||
>
|
||||
<strong>Global event files only</strong><br />
|
||||
Recommended: PowerPoint (pptx) or Keynote (key)<br />
|
||||
Media: Audio and videos files should be directly embedded in PowerPoint (PPTX)
|
||||
files<br />
|
||||
Recommended: PowerPoint (pptx) or Keynote (key)<br
|
||||
/>
|
||||
Media: Audio and videos files should be directly embedded
|
||||
in PowerPoint (PPTX) files<br />
|
||||
Supplemental files: mp4, PDF, Word Doc, Excel, txt, etc
|
||||
</div>
|
||||
</span>
|
||||
@@ -504,8 +607,12 @@
|
||||
<Element_manage_event_file_li_wrap
|
||||
link_to_type={'event'}
|
||||
link_to_id={$lq__event_obj?.event_id}
|
||||
allow_basic={$events_loc.auth__kv.session[$lq__event_obj?.event_id]}
|
||||
allow_moderator={$events_loc.auth__kv.session[$lq__event_obj?.event_id]}
|
||||
allow_basic={$events_loc.auth__kv.session[
|
||||
$lq__event_obj?.event_id
|
||||
]}
|
||||
allow_moderator={$events_loc.auth__kv.session[
|
||||
$lq__event_obj?.event_id
|
||||
]}
|
||||
container_class_li={''}
|
||||
/>
|
||||
</div>
|
||||
@@ -517,9 +624,12 @@
|
||||
<span class="fas fa-exclamation-triangle text-red-500 m-1"></span>
|
||||
Event Disabled
|
||||
</h2>
|
||||
<p>This event is currently disabled. Please contact the event organizer for more information.</p>
|
||||
<p>
|
||||
This event is currently disabled. Please contact the event organizer
|
||||
for more information.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="postcss">
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user