182 lines
5.3 KiB
TypeScript
182 lines
5.3 KiB
TypeScript
import { localStorageStore } from '@skeletonlabs/skeleton';
|
|
import { writable } from 'svelte/store';
|
|
import type { Writable } from 'svelte/store';
|
|
|
|
import type { key_val } from '$lib/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.
|
|
let ver = '2024-08-21_1646';
|
|
let 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
|
|
let 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`, // Æ
|
|
|
|
novi_uuid: null,
|
|
novi_email: null,
|
|
novi_full_name: null,
|
|
novi_admin_li: [
|
|
"2b078deb-b4e7-4203-99da-9f7cd62159a5"
|
|
],
|
|
novi_trusted_li: [
|
|
"c9ea07b5-06b0-4a43-a2d0-8d06558c8a82",
|
|
"58db22ee-4b0a-49a7-9f34-53d2ba85a84b",
|
|
],
|
|
|
|
novi_archives_base_url: "https://www.idaa.org/idaa-archives",
|
|
novi_bb_base_url: "https://www.idaa.org/idaa-bulletin-board",
|
|
novi_meetings_base_url: "https://www.idaa.org/idaa-meetings",
|
|
|
|
'ds': {},
|
|
|
|
'idaa_cfg_json': {},
|
|
|
|
// all, disabled, enabled
|
|
'qry__enabled': 'enabled',
|
|
// all, hidden, not_hidden
|
|
'qry__hidden': 'not_hidden',
|
|
'qry__limit': 20,
|
|
'qry__offset': 0,
|
|
|
|
archives: {
|
|
enabled: 'enabled', // all, disabled, enabled
|
|
hidden: 'not_hidden', // all, hidden, not_hidden
|
|
limit: 150,
|
|
offset: 0,
|
|
},
|
|
|
|
bb: {
|
|
enabled: 'enabled', // all, disabled, enabled
|
|
hidden: 'not_hidden', // all, hidden, not_hidden
|
|
limit: 50,
|
|
offset: 0,
|
|
show_list__post_obj_li: true,
|
|
|
|
qry__enabled: 'enabled', // all, disabled, enabled
|
|
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
|
qry__limit: 50,
|
|
qry__offset: 0,
|
|
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
|
},
|
|
|
|
recovery_meetings: {
|
|
qry__enabled: 'enabled', // all, disabled, enabled
|
|
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
|
qry__limit: 150,
|
|
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
|
|
qry__offset: 0,
|
|
|
|
qry__fulltext_str: null,
|
|
qry__physical: null,
|
|
qry__type: null,
|
|
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 let idaa_loc: Writable<key_val> = localStorageStore('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
|
|
let idaa_session_data_struct: key_val = {
|
|
ver: ver,
|
|
ver_idb: ver_idb,
|
|
log_lvl: 1,
|
|
|
|
archives: {
|
|
qry__status: null,
|
|
},
|
|
|
|
bb: {
|
|
qry__status: null,
|
|
},
|
|
|
|
recovery_meetings: {
|
|
qry__status: null,
|
|
// qry__fulltext_str: null,
|
|
|
|
show__modal_edit: false,
|
|
show__modal_view: false,
|
|
},
|
|
|
|
};
|
|
// console.log(`AE Stores - App IDAA Session Storage Data:`, idaa_session_data_struct);
|
|
export let 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
|
|
let idaa_slct_obj_template: key_val = {
|
|
// Top level
|
|
'event_id': null,
|
|
'event_obj': {},
|
|
'event_obj_li': [],
|
|
|
|
'archive_id': null,
|
|
'archive_obj': {},
|
|
'archive_obj_li': [],
|
|
|
|
'archive_content_id': null,
|
|
'archive_content_obj': {},
|
|
'archive_content_obj_li': [],
|
|
|
|
'post_id': null,
|
|
'post_obj': {},
|
|
'post_obj_li': [],
|
|
|
|
'post_comment_id': null,
|
|
'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 let idaa_slct = writable(idaa_slct_obj_template);
|
|
|
|
// This works and uses *local* storage:
|
|
// export let idaa_slct: Writable<key_val> = localStorageStore('ae_idaa_slct', idaa_slct_obj_template);
|
|
|
|
|
|
/* *** BEGIN *** Initialize idaa_trig */
|
|
// Intended for temporary session storage.
|
|
// Updated 2024-11-19
|
|
let idaa_trig_template: key_val = {
|
|
archive_id: false,
|
|
archive_content_li: false,
|
|
event_id: false,
|
|
post_id: false,
|
|
};
|
|
export let 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
|
|
let idaa_prom_template: key_val = {
|
|
archive_id: false,
|
|
archive_content_li: false,
|
|
event_id: false,
|
|
post_id: false,
|
|
};
|
|
export let idaa_prom: any = writable(idaa_prom_template);
|
|
// console.log(`AE IDAA Stores - IDAA Trigger:`, idaa_prom);
|