Mostly working before major fix for data shared.
This commit is contained in:
@@ -29,9 +29,10 @@ const modalRegistry: Record<string, ModalComponent> = {
|
||||
// Highlight JS
|
||||
import hljs from 'highlight.js/lib/core';
|
||||
import 'highlight.js/styles/github-dark.css';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import { get } from 'svelte/store';
|
||||
import { page } from "$app/stores";
|
||||
// import type { Writable } from 'svelte/store';
|
||||
// import { get } from 'svelte/store';
|
||||
import { browser } from '$app/environment';
|
||||
// import { page } from "$app/stores";
|
||||
import { localStorageStore, storeHighlightJs } from '@skeletonlabs/skeleton';
|
||||
import xml from 'highlight.js/lib/languages/xml'; // for HTML
|
||||
import css from 'highlight.js/lib/languages/css';
|
||||
@@ -60,7 +61,7 @@ import Element_access_type from '$lib/element_access_type.svelte';
|
||||
import Element_app_cfg from '$lib/element_app_cfg.svelte';
|
||||
import Element_data_store from '$lib/element_data_store.svelte';
|
||||
|
||||
// Quickly save the data passed from the parent to the Svelte stores.
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. This should catch anything that is a child of this layout.svelte file.
|
||||
$ae_loc = data.ae_loc;
|
||||
$ae_api = data.ae_api;
|
||||
|
||||
@@ -77,6 +78,26 @@ if ($ae_loc.site_cfg_json.slct__event_id) {
|
||||
console.log(`No Event ID set.`);
|
||||
}
|
||||
|
||||
if (browser) {
|
||||
// Waiting until the browser exists.
|
||||
// save_ds_to_local(data.ae_ds);
|
||||
let ae_ds = data.ae_ds;
|
||||
console.log(`ae_ds__ data:`, ae_ds)
|
||||
for (let [key, value] of Object.entries(ae_ds)) {
|
||||
console.log(`ae_ds__ key: ${key}, value:`, value);
|
||||
localStorage.setItem(`ae_ds__${key}`, JSON.stringify(value));
|
||||
|
||||
// This should not be needed here anymore.
|
||||
// if (key == 'hub__site__appshell_header') {
|
||||
// $ae_sess.site_appshell_header = value;
|
||||
// console.log(`$ae_sess.site_appshell_header = `, $ae_sess.site_appshell_header);
|
||||
// }
|
||||
}
|
||||
|
||||
// $ae_sess.site_appshell_header = JSON.parse(localStorage.getItem('ae_ds__hub__site__appshell_header'));
|
||||
// console.log(`$ae_sess.site_appshell_header = `, $ae_sess.site_appshell_header);
|
||||
}
|
||||
|
||||
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
|
||||
// $: if (data.ae_ds) {
|
||||
// console.log(`ae_ds__ data:`, data.ae_ds)
|
||||
@@ -86,26 +107,7 @@ if ($ae_loc.site_cfg_json.slct__event_id) {
|
||||
// }
|
||||
// }
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// async function save_ds_to_local (ae_ds: any) {
|
||||
// console.log(`ae_ds__ data:`, ae_ds)
|
||||
// for (let [key, value] of Object.entries(ae_ds)) {
|
||||
// console.log(`ae_ds__ key: ${key}, value:`, value);
|
||||
// localStorage.setItem(`ae_ds__${key}`, JSON.stringify(value));
|
||||
// }
|
||||
// }
|
||||
|
||||
if (browser) {
|
||||
// Waiting until the browser exists.
|
||||
// save_ds_to_local(data.ae_ds);
|
||||
let ae_ds = data.ae_ds;
|
||||
console.log(`ae_ds__ data:`, ae_ds)
|
||||
for (let [key, value] of Object.entries(ae_ds)) {
|
||||
console.log(`ae_ds__ key: ${key}, value:`, value);
|
||||
localStorage.setItem(`ae_ds__${key}`, JSON.stringify(value));
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
console.log('Root: +layout.svelte');
|
||||
@@ -113,18 +115,9 @@ onMount(() => {
|
||||
// Waiting until the browser exists.
|
||||
// save_ds_to_local(data.ae_ds);
|
||||
|
||||
|
||||
// console.log(`ae_ds_testing = `, $ds_testing);
|
||||
// $ds_testing = {'test': 'Changed by Scott'};
|
||||
|
||||
|
||||
// if (data.ae_ds) {
|
||||
// console.log(`ae_ds__ data:`, data.ae_ds)
|
||||
// for (let [key, value] of Object.entries(data.ae_ds)) {
|
||||
// console.log(`ae_ds__ key: ${key}, value:`, value);
|
||||
// localStorageStore(`ae_ds__${key}`, value);
|
||||
// }
|
||||
// }
|
||||
// $ae_sess.site_appshell_header = JSON.parse(localStorage.getItem('ae_ds__hub__site__appshell_header'));
|
||||
// console.log(`$ae_sess.site_appshell_header = `, $ae_sess.site_appshell_header);
|
||||
// $ae_sess = $ae_sess;
|
||||
|
||||
let iframe = data.url.searchParams.get('iframe');
|
||||
if (iframe == 'true') {
|
||||
@@ -164,21 +157,15 @@ onMount(() => {
|
||||
});
|
||||
|
||||
|
||||
// let data_store_obj_get_promises: key_val = {};
|
||||
// let get_ds_hub_page_access_code_li_json_promise = handle_get_data_store_obj_w_code({code: 'hub__page__access_code_li_json', data_type: 'json', trigger: 'set_access_code_li'});
|
||||
// let get_ds_hub_site_header_promise = handle_get_data_store_obj_w_code({code: 'hub_site_header'});
|
||||
// let get_ds_hub_site_footer_promise = handle_get_data_store_obj_w_code({code: 'hub_site_footer'});
|
||||
// $slct_trigger = 'set_access_code_li';
|
||||
// $: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_code_li_json']) {
|
||||
// console.log(`$ae_loc.ds['hub__page__access_code_li_json'] = `, $ae_loc.ds['hub__page__access_code_li_json']);
|
||||
// $slct_trigger = null; // Reset the trigger to prevent loops
|
||||
|
||||
|
||||
$slct_trigger = 'set_access_code_li';
|
||||
$: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_code_li_json']) {
|
||||
console.log(`$ae_loc.ds['hub__page__access_code_li_json'] = `, $ae_loc.ds['hub__page__access_code_li_json']);
|
||||
$slct_trigger = null; // Reset the trigger to prevent loops
|
||||
|
||||
$ae_loc.page_access_code_li = $ae_loc.ds['hub__page__access_code_li_json'];
|
||||
$ae_loc = $ae_loc; // Trigger Svelte just in case
|
||||
// console.log($ae_loc);
|
||||
}
|
||||
// $ae_loc.page_access_code_li = $ae_loc.ds['hub__page__access_code_li_json'];
|
||||
// $ae_loc = $ae_loc; // Trigger Svelte just in case
|
||||
// // console.log($ae_loc);
|
||||
// }
|
||||
</script>
|
||||
|
||||
|
||||
@@ -237,6 +224,8 @@ $: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_c
|
||||
|
||||
</svelte:fragment>
|
||||
<!-- OSIT's Aether App -->
|
||||
<!-- {@html (browser ? JSON.parse(localStorage.getItem('ae_ds__hub__site__appshell_header')) : 'not found')} -->
|
||||
<!-- {@html $ae_sess.site_appshell_header} -->
|
||||
<Element_data_store
|
||||
ds_code="hub__site__appshell_header"
|
||||
ds_type="html"
|
||||
|
||||
Reference in New Issue
Block a user