|
|
|
|
@@ -69,7 +69,9 @@ import Element_data_store from '$lib/element_data_store_v2.svelte';
|
|
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
$slct.account_id = data.account_id;
|
|
|
|
|
console.log(`*ae_root +layout.svelte* $slct.account_id = `, $slct.account_id);
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log(`*ae_root +layout.svelte* $slct.account_id = ${$slct.account_id}`);
|
|
|
|
|
}
|
|
|
|
|
let ae_acct = data[$slct.account_id];
|
|
|
|
|
// console.log(`*ae_root +layout.svelte* ae_acct = `, ae_acct);
|
|
|
|
|
// let ae_acct = data.ae_acct;
|
|
|
|
|
@@ -170,7 +172,7 @@ if ($ae_loc?.site_cfg_json.slct__event_id) {
|
|
|
|
|
// console.log(`Event ID already set:`, $events_slct.event_id);
|
|
|
|
|
$events_loc.event_id = $events_slct.event_id;
|
|
|
|
|
} else {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
if (log_lvl > 1) {
|
|
|
|
|
console.log(`No Event ID set!`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -183,7 +185,7 @@ if ($ae_loc.site_cfg_json.slct__sponsorship_cfg_id) {
|
|
|
|
|
$slct.sponsorship_cfg_id = $ae_loc.sponsorship_cfg_id;
|
|
|
|
|
$ae_loc.mod.sponsorships.cfg_id = $ae_loc.sponsorship_cfg_id;
|
|
|
|
|
} else {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
if (log_lvl > 1) {
|
|
|
|
|
console.log(`No Sponsorship Config ID set.`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -334,84 +336,13 @@ if (browser) {
|
|
|
|
|
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 (ae_acct.ds) {
|
|
|
|
|
// console.log(`ae_ds__ data:`, ae_acct.ds)
|
|
|
|
|
// for (let [key, value] of Object.entries(ae_acct.ds)) {
|
|
|
|
|
// console.log(`ae_ds__ key: ${key}, value:`, value);
|
|
|
|
|
// localStorageStore(`ae_ds__${key}`, value);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
console.log('Root: +layout.svelte');
|
|
|
|
|
|
|
|
|
|
// save_ds_to_local(ae_acct.ds);
|
|
|
|
|
|
|
|
|
|
// $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') {
|
|
|
|
|
console.log('Use iframe layout!');
|
|
|
|
|
$ae_loc.iframe = true;
|
|
|
|
|
|
|
|
|
|
document.getElementsByTagName('html')[0].classList.add('iframe');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.remove('dark');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.remove('light');
|
|
|
|
|
|
|
|
|
|
$ae_loc.hub.show_element__access_type = false;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = false;
|
|
|
|
|
} else if (iframe == 'false') {
|
|
|
|
|
$ae_loc.iframe = false;
|
|
|
|
|
|
|
|
|
|
document.getElementsByTagName('html')[0].classList.remove('iframe');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.add('light');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.add('dark');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$ae_loc.iframe && $ae_loc.trusted_access) {
|
|
|
|
|
$ae_loc.hub.show_element__access_type = true;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = true;
|
|
|
|
|
} else if ($ae_loc.iframe && $ae_loc.manager_access) {
|
|
|
|
|
$ae_loc.hub.show_element__access_type = true;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = true;
|
|
|
|
|
} else {
|
|
|
|
|
$ae_loc.hub.show_element__access_type = true;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.url.searchParams.get('event_id')) {
|
|
|
|
|
$events_slct.event_id = data.url.searchParams.get('event_id');
|
|
|
|
|
$events_loc.event_id = data.url.searchParams.get('event_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.url.searchParams.get('sponsorship_cfg_id')) {
|
|
|
|
|
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
|
|
|
|
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This is how the download and upload progress is tracked.
|
|
|
|
|
window.addEventListener('message', function(event) {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log('Message received in root +layout.svelte:');
|
|
|
|
|
console.log(event);
|
|
|
|
|
console.log('Message received in root +layout.svelte:', event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.data.type == 'api_download_blob') {
|
|
|
|
|
@@ -452,10 +383,72 @@ onMount(() => {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let iframe = data.url.searchParams.get('iframe');
|
|
|
|
|
if (iframe == 'true') {
|
|
|
|
|
console.log('Use iframe layout!');
|
|
|
|
|
$ae_loc.iframe = true;
|
|
|
|
|
|
|
|
|
|
document.getElementsByTagName('html')[0].classList.add('iframe');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.remove('dark');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.remove('light');
|
|
|
|
|
|
|
|
|
|
$ae_loc.hub.show_element__access_type = false;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = false;
|
|
|
|
|
} else if (iframe == 'false') {
|
|
|
|
|
$ae_loc.iframe = false;
|
|
|
|
|
|
|
|
|
|
document.getElementsByTagName('html')[0].classList.remove('iframe');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.add('dark');
|
|
|
|
|
// document.getElementsByTagName('html')[0].classList.add('light');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!$ae_loc.iframe && $ae_loc.trusted_access) {
|
|
|
|
|
$ae_loc.hub.show_element__access_type = true;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = true;
|
|
|
|
|
} else if ($ae_loc.iframe && $ae_loc.manager_access) {
|
|
|
|
|
$ae_loc.hub.show_element__access_type = true;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = true;
|
|
|
|
|
} else {
|
|
|
|
|
$ae_loc.hub.show_element__access_type = true;
|
|
|
|
|
$ae_loc.hub.show_element__cfg = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This is mainly for Precon CHOW
|
|
|
|
|
if (data.url.searchParams.get('event_id')) {
|
|
|
|
|
$events_slct.event_id = data.url.searchParams.get('event_id');
|
|
|
|
|
$events_loc.event_id = data.url.searchParams.get('event_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data.url.searchParams.get('sponsorship_cfg_id')) {
|
|
|
|
|
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
|
|
|
|
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $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 (ae_acct.ds) {
|
|
|
|
|
// console.log(`ae_ds__ data:`, ae_acct.ds)
|
|
|
|
|
// for (let [key, value] of Object.entries(ae_acct.ds)) {
|
|
|
|
|
// console.log(`ae_ds__ key: ${key}, value:`, value);
|
|
|
|
|
// localStorageStore(`ae_ds__${key}`, value);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
|
// console.log('Root: +layout.svelte');
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<!-- {#if ae_acct.loc.site_google_tracking_id} -->
|
|
|
|
|
{#if $ae_loc?.site_google_tracking_id && $ae_loc?.site_google_tracking_id.length > 0}
|
|
|
|
|
<Analytics bind:site_google_tracking_id={$ae_loc.site_google_tracking_id} />
|
|
|
|
|
{/if}
|
|
|
|
|
@@ -498,7 +491,6 @@ onMount(() => {
|
|
|
|
|
<Element_data_store
|
|
|
|
|
ds_code="hub__page__appshell_header_lead"
|
|
|
|
|
ds_type="html"
|
|
|
|
|
display="block"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
</svelte:fragment>
|
|
|
|
|
@@ -508,13 +500,11 @@ onMount(() => {
|
|
|
|
|
<Element_data_store
|
|
|
|
|
ds_code="hub__site__appshell_header"
|
|
|
|
|
ds_type="html"
|
|
|
|
|
display="block"
|
|
|
|
|
/>
|
|
|
|
|
<svelte:fragment slot="trail">
|
|
|
|
|
<Element_data_store
|
|
|
|
|
ds_code="hub__page__appshell_header_trail"
|
|
|
|
|
ds_type="html"
|
|
|
|
|
display="block"
|
|
|
|
|
/>
|
|
|
|
|
</svelte:fragment>
|
|
|
|
|
</AppBar>
|
|
|
|
|
@@ -543,7 +533,6 @@ onMount(() => {
|
|
|
|
|
<Element_data_store
|
|
|
|
|
ds_code="hub__site__appshell_footer"
|
|
|
|
|
ds_type="html"
|
|
|
|
|
display="block"
|
|
|
|
|
class_li="grow flex flex-row justify-between"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|