From f4020e78348e978ec0f01ac4ed6ec51d4536df57 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 16 Mar 2026 15:23:22 -0400 Subject: [PATCH] =?UTF-8?q?refactor(stores):=20phase=201=20cleanup=20?= =?UTF-8?q?=E2=80=94=20ae=5Fidaa=5Fstores.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unused `import { offset } from '@floating-ui/dom'` - Remove ver_idb constant and field (same as ae_stores / ae_events_stores) - Remove commented-out personal Novi UUIDs (security hygiene — these belong in site_cfg_json on the server, not in source; idaa layout already reads them from $ae_loc.site_cfg_json and writes to idaa_loc at mount) - Add comment explaining novi_admin/trusted/jitsi_mod_li are server-driven - Remove dead writable/persisted alternatives and console.log lines - Remove stale 'Updated 20xx-xx-xx' date comments - Condense redundant tracking comments to single-line form --- src/lib/stores/ae_idaa_stores.ts | 78 ++++++++------------------------ 1 file changed, 19 insertions(+), 59 deletions(-) diff --git a/src/lib/stores/ae_idaa_stores.ts b/src/lib/stores/ae_idaa_stores.ts index a451aad3..6190b470 100644 --- a/src/lib/stores/ae_idaa_stores.ts +++ b/src/lib/stores/ae_idaa_stores.ts @@ -3,22 +3,17 @@ import { writable } from 'svelte/store'; import type { Writable } from 'svelte/store'; import type { key_val } from '$lib/stores/ae_stores'; -import { offset } from '@floating-ui/dom'; -// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page. const ver = '2024-08-21_1646'; -const ver_idb = '2024-08-21_1645'; /* *** BEGIN *** Initialize idaa_local_data_struct */ -// Longer-term app data. This should be stored to *local* storage. -// Updated 2024-03-06 +// Persisted to localStorage. Retains Novi identity, auth state, and IDAA +// query preferences across sessions. Wiped on schema change via store_versions.ts. const idaa_local_data_struct: key_val = { ver: ver, - ver_idb: ver_idb, - // Shared - name: 'Aether - IDAA (SvelteKit 2.x Svelte 4.x)', - title: `OSIT's Æ IDAA`, // - Dev SvelteKit`, // Æ + name: 'Aether - IDAA', + title: `OSIT's Æ IDAA`, novi_uuid: null, novi_email: null, @@ -26,17 +21,11 @@ const idaa_local_data_struct: key_val = { // True after a successful Novi API verification (UUID confirmed to be a real Novi member). // False on load, on verification failure, or for non-Novi sign-in paths. novi_verified: false, - novi_admin_li: [ - // '2b078deb-b4e7-4203-99da-9f7cd621xxxx', // Scott - '2b078deb-b4e7-4203-99da-9f7cd62159a5' - ], - novi_trusted_li: [ - // 'c9ea07b5-06b0-4a43-a2d0-8d06558c8a82', // Michelle - 'c9ea07b5-06b0-4a43-a2d0-8d06558c8a82' - // '58db22ee-4b0a-49a7-9f34-53d2ba85a84b', // Brie - '58db22ee-4b0a-49a7-9f34-53d2ba85a84b' - // '2b078deb-b4e7-4203-99da-9f7cd62159a5', // Scott - '2b078deb-b4e7-4203-99da-9f7cd62159a5' - ], - novi_jitsi_mod_li: [ - // '5724aad7-6d89-47e7-8943-966fd22911bd', // '5724aad7-6d89-47e7-8943-966fd22911bd' - ], + // Populated from $ae_loc.site_cfg_json at IDAA layout mount — not managed here. + // See routes/idaa/(idaa)/+layout.svelte for the override logic. + novi_admin_li: [], + novi_trusted_li: [], + novi_jitsi_mod_li: [], novi_archives_base_url: 'https://www.idaa.org/idaa-archives', novi_bb_base_url: 'https://www.idaa.org/idaa-bulletin-board', @@ -59,12 +48,9 @@ const idaa_local_data_struct: key_val = { limit: 150, offset: 0, - edit_kv: {}, // Used to track which archive objects are being edited + edit_kv: {}, // Tracks which archive objects are being edited. edit__archive_obj: null, edit__archive_content_obj: null - - // qry__order_by: 'updated_on', // For the IDB index query - // qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query }, bb: { @@ -73,7 +59,7 @@ const idaa_local_data_struct: key_val = { limit: 50, offset: 0, - edit_kv: {}, // Used to track which post objects are being edited + edit_kv: {}, // Tracks which post objects are being edited. edit__post_obj: null, edit__post_comment_obj: null, @@ -88,7 +74,7 @@ const idaa_local_data_struct: key_val = { }, recovery_meetings: { - edit_kv: {}, // Used to track which event objects are being edited + edit_kv: {}, // Tracks which meeting objects are being edited. edit__event_obj: null, qry__enabled: 'enabled', // all, disabled, enabled @@ -110,21 +96,13 @@ const idaa_local_data_struct: key_val = { qry__virtual: null } }; -// console.log(`AE Stores - App IDAA Local Storage Data:`, idaa_local_data_struct); -// This works, but does not uses local storage: -// export let ae_loc = writable(idaa_local_data_struct); - -// This works and uses *local* storage: export const idaa_loc: Writable = persisted('ae_idaa_loc', idaa_local_data_struct); -// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc)); /* *** BEGIN *** Initialize idaa_session_data_struct */ -// Temporary app data. This should be stored to session storage. -// Updated 2024-03-06 +// In-memory only (not persisted). Resets on page load. const idaa_session_data_struct: key_val = { ver: ver, - ver_idb: ver_idb, log_lvl: 1, archives: { @@ -133,7 +111,7 @@ const idaa_session_data_struct: key_val = { show__modal_view__archive_id: null, show__modal_edit__archive_content_id: null, show__modal_view__archive_content_id: null, - obj_changed: false // Used to track if the archive object has been changed in the edit view + obj_changed: false }, bb: { @@ -144,8 +122,7 @@ const idaa_session_data_struct: key_val = { show__inline_edit__post_obj: null, show__modal_edit__post_id: null, show__modal_view__post_id: null, - obj_changed: false // Used to track if the post object has been changed in the edit view - // edit_kv: {}, // Used to track which post objects are being edited + obj_changed: false }, recovery_meetings: { @@ -160,19 +137,14 @@ const idaa_session_data_struct: key_val = { show__modal_view: false, show__modal_edit__event_id: null, show__modal_view__event_id: null, - obj_changed: false, // Used to track if the event object has been changed in the edit view + obj_changed: false, attend_platform: null // 'Zoom', 'Google Meet', 'Microsoft Teams', etc. } }; -// console.log(`AE Stores - App IDAA Session Storage Data:`, idaa_session_data_struct); export const idaa_sess = writable(idaa_session_data_struct); -/* *** BEGIN *** Initialize idaa_slct and idaa_trig */ -/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different idaa, badges, exhibits, etc. */ - -// Intended for temporary session storage. -// Updated 2024-03-06 +// In-memory only — tabs can have different IDAA object selections. const idaa_slct_obj_template: key_val = { // Top level event_id: null, @@ -195,17 +167,9 @@ const idaa_slct_obj_template: key_val = { post_comment_obj: {}, post_comment_obj_li: [] }; -// console.log(`AE Stores - Selected IDAA Objects:`, idaa_slct_obj_template); - -// This works, and uses *session* (not local) storage: export const idaa_slct = writable(idaa_slct_obj_template); -// This works and uses *local* storage: -// export let idaa_slct: Writable = persisted('ae_idaa_slct', idaa_slct_obj_template); - -/* *** BEGIN *** Initialize idaa_trig */ -// Intended for temporary session storage. -// Updated 2024-11-19 +// Fine-grained triggers — set an ID to signal that object type needs re-fetching. const idaa_trig_template: key_val = { archive_id: false, archive_content_li: false, @@ -213,11 +177,8 @@ const idaa_trig_template: key_val = { post_id: false }; export const idaa_trig: any = writable(idaa_trig_template); -// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_trig); -/* *** BEGIN *** Initialize idaa_prom */ -// Intended for temporary session storage. -// Updated 2024-11-19 +// Promise map — keyed by object type; used to track in-flight async operations. const idaa_prom_template: key_val = { archive_id: false, archive_content_li: false, @@ -225,4 +186,3 @@ const idaa_prom_template: key_val = { post_id: false }; export const idaa_prom: any = writable(idaa_prom_template); -// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_prom);