From 9ea6b17617868713252e9ef2d313f9545f31251d Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 18 Nov 2025 18:18:25 -0500 Subject: [PATCH] feat: Fix event list and add module links This commit fixes the event list on the /events page by correcting the data fetching logic. It also adds links to the 'Pres Mgmt', 'Badges', 'Leads', and 'Launcher' modules for each event, and updates the main event link to use the random string ID. --- GEMINI.md | 16 ++++++++++++++++ src/routes/events/+page.svelte | 33 ++++++++++++++++++++++++++------- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/GEMINI.md b/GEMINI.md index 6634ae7e..a75c2c2d 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -84,3 +84,19 @@ Following the initial migration to CodeMirror, several issues were identified an - **Save Button Enablement:** The logic for enabling the "Save" button was fixed in `ae_idaa_comp__post_obj_id_edit.svelte` to correctly detect changes in the CodeMirror editor. - **Editor Buttons:** A `TypeError` in the editor's formatting buttons was fixed by using `EditorSelection.range()` to correctly create selection ranges. - **Component Renaming:** The `Tiptap_editor` component alias was renamed to `CodeMirror_wrapper` across the project for clarity, and the wrapper file was renamed to `element_codemirror_editor_wrapper.svelte`. + +### Badge Search Refactoring (2025-11-18) + +The new Badge Search functionality was refactored to resolve several issues related to Svelte 5 reactivity and IndexedDB schema design. + +- **Svelte 5 Reactivity Fixes:** + - A `store_invalid_shape` error was fixed by removing the `$` prefix from Svelte 5 state variables in templates. + - A Svelte 5 compilation error (`illegal variable name`) was resolved by using `$derived` to create a local reactive variable from a store. + - A 500 Internal Error was resolved by moving Dexie `liveQuery` calls into an `onMount` block to ensure they only run on the client-side. +- **IndexedDB Schema Refactoring:** + - The primary key for the `badge` table was changed from a numeric `id` to the string-based `event_badge_id_random`. + - All related components were updated to use the new primary key for data retrieval, allowing for more efficient lookups using `get()` and `bulkGet()`. +- **Data Flow Simplification:** + - The badge search data flow was refactored to pass full badge objects from the search component to the list component, simplifying the logic and resolving reactivity issues. +- **Link Generation:** + - Badge links were updated to use the string-based random IDs for both the event and the badge, ensuring consistency and avoiding the exposure of internal numeric IDs. diff --git a/src/routes/events/+page.svelte b/src/routes/events/+page.svelte index c8d3ede5..fa4c010d 100644 --- a/src/routes/events/+page.svelte +++ b/src/routes/events/+page.svelte @@ -10,6 +10,8 @@ import { events_loc, events_slct, events_trigger } from '$lib/stores/ae_events_stores'; import { ae_util } from '$lib/ae_utils/ae_utils'; + import { page } from '$app/stores'; + interface Props { data: any; } @@ -18,13 +20,13 @@ // import Element_data_store from '$lib/element_data_store_v2.svelte'; - let ae_acct = data[$slct.account_id]; - let lq__event_obj_li = $derived( liveQuery(async () => { + const account_id = $page.data.account_id; + if (!account_id) return []; let results = await db_events.event .where('account_id') - .equals(ae_acct.slct.account_id) + .equals(account_id) .reverse() .sortBy('start_datetime'); return results; @@ -113,9 +115,8 @@
  • {#if new Date(event_obj.start_datetime ?? '').getTime() > new Date().getTime() - 1000 * 60 * 60 * 24 * 30 * 8 || $ae_loc.trusted_access} - {ae_util.iso_datetime_formatter(event_obj.start_datetime, 'date_long')} @@ -133,10 +134,28 @@ {#if $ae_loc.trusted_access} - Manage + Pres Mgmt + + + Badges + + + Leads + + + Launcher {/if}