Wrapping up for the night at 4 AM. Made lots of progress with the Journals module. Should have saved more often.
This commit is contained in:
104
src/lib/ae_journals/ae_journals_stores.ts
Normal file
104
src/lib/ae_journals/ae_journals_stores.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
import { localStorageStore } from '@skeletonlabs/skeleton';
|
||||
import { writable } from 'svelte/store';
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize journals_local_data_struct */
|
||||
// This is for longer term or sticky app data. This should be stored to *local* storage.
|
||||
// Updated 2024-08-20
|
||||
let journals_local_data_struct: key_val = {
|
||||
ver: '2024-08-20_19',
|
||||
// Shared
|
||||
name: 'Aether - Journals (SvelteKit 2.x Svelte 4.x)',
|
||||
title: `OSIT's Æ Journals`, // Æ
|
||||
|
||||
mode__edit: false,
|
||||
mode__debug: false,
|
||||
|
||||
qry__enabled: 'enabled', // all, disabled, enabled
|
||||
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
||||
qry__limit: 20,
|
||||
qry__order_by_li: {
|
||||
// 'created_on': 'desc',
|
||||
// 'updated_on': 'desc',
|
||||
},
|
||||
qry__offset: 0,
|
||||
qry__journal_id: null,
|
||||
|
||||
};
|
||||
// console.log(`AE Stores - App Journals Local Storage Data:`, journals_local_data_struct);
|
||||
|
||||
// This works and uses *local* storage:
|
||||
export let journals_loc: Writable<key_val> = localStorageStore('ae_journals_loc', journals_local_data_struct);
|
||||
// console.log(`AE Stores - App Local Storage Data:`, get(ae_loc));
|
||||
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize journals_session_data_struct */
|
||||
// Temporary app data. This is lost if the page is refreshed or using different tabs/windows. This should be stored to *session* storage.
|
||||
// Updated 2024-08-20
|
||||
let journals_session_data_struct: key_val = {
|
||||
ver: '2024-08-20_19',
|
||||
log_lvl: 1,
|
||||
|
||||
// Shared Triggers
|
||||
trigger: null,
|
||||
trigger__journal_id: null,
|
||||
// trigger__journal_li: null,
|
||||
|
||||
show__modal_edit__journal_id: false,
|
||||
show__modal_view__journal_id: null,
|
||||
show_list__journal_entry_li_group: true,
|
||||
show__modal_view__journal_entry_id: null,
|
||||
show__modal_edit__journal_entry_id: null,
|
||||
};
|
||||
// console.log(`AE Stores - App Journals Session Storage Data:`, journals_session_data_struct);
|
||||
export let journals_sess = writable(journals_session_data_struct);
|
||||
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize journals_slct and journals_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 journals, badges, exhibits, etc. */
|
||||
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2024-08-20
|
||||
let journals_slct_obj_template: key_val = {
|
||||
// Top level
|
||||
'journal_id': null,
|
||||
'journal_obj': {},
|
||||
'journal_obj_li': [],
|
||||
|
||||
'lq__journal_obj': {}, // Testing passing a LiveQuery object around...
|
||||
};
|
||||
// console.log(`AE Stores - Selected Journals Objects:`, journals_slct_obj_template);
|
||||
|
||||
// This works, and uses *session* (not local) storage:
|
||||
export let journals_slct = writable(journals_slct_obj_template);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize journals_trig */
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2025-03-16
|
||||
let journals_trig_template: key_val = {
|
||||
archive_id: false,
|
||||
archive_content_li: false,
|
||||
event_id: false,
|
||||
post_id: false,
|
||||
};
|
||||
export let journals_trig: any = writable(journals_trig_template);
|
||||
// console.log(`AE Journals Stores - Journals Trigger:`, journals_trig);
|
||||
|
||||
|
||||
/* *** BEGIN *** Initialize journals_prom */
|
||||
// Intended for temporary session storage.
|
||||
// Updated 2025-03-16
|
||||
let journals_prom_template: key_val = {
|
||||
archive_id: false,
|
||||
archive_content_li: false,
|
||||
event_id: false,
|
||||
post_id: false,
|
||||
};
|
||||
export let journals_prom: any = writable(journals_prom_template);
|
||||
// console.log(`AE Journals Stores - Journals Trigger:`, journals_prom);
|
||||
Reference in New Issue
Block a user