|
|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
/** @type {import('./$types').LayoutData} */
|
|
|
|
|
// /** @type {import('./$types').LayoutProps} */
|
|
|
|
|
|
|
|
|
|
let log_lvl: number = 0;
|
|
|
|
|
let log_lvl: number = 2;
|
|
|
|
|
|
|
|
|
|
// *** Import Svelte specific
|
|
|
|
|
// import { tick } from 'svelte';
|
|
|
|
|
@@ -15,16 +15,16 @@ import { AppShell, AppBar, initializeStores } from '@skeletonlabs/skeleton';
|
|
|
|
|
// Initialize the stores for Drawer, Modal, and Toast so they work throughout the app.
|
|
|
|
|
initializeStores();
|
|
|
|
|
// import { Modal } from '@skeletonlabs/skeleton';
|
|
|
|
|
import type {
|
|
|
|
|
ModalComponent
|
|
|
|
|
} from '@skeletonlabs/skeleton';
|
|
|
|
|
// import type {
|
|
|
|
|
// ModalComponent
|
|
|
|
|
// } from '@skeletonlabs/skeleton';
|
|
|
|
|
|
|
|
|
|
const modalRegistry: Record<string, ModalComponent> = {
|
|
|
|
|
// Set a unique modal ID, then pass the component reference
|
|
|
|
|
// modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj },
|
|
|
|
|
// modalComponentTwo: { ref: ModalComponentTwo },
|
|
|
|
|
// ...
|
|
|
|
|
};
|
|
|
|
|
// const modalRegistry: Record<string, ModalComponent> = {
|
|
|
|
|
// // Set a unique modal ID, then pass the component reference
|
|
|
|
|
// // modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj },
|
|
|
|
|
// // modalComponentTwo: { ref: ModalComponentTwo },
|
|
|
|
|
// // ...
|
|
|
|
|
// };
|
|
|
|
|
import {
|
|
|
|
|
ArrowBigRight,
|
|
|
|
|
// CircleX,
|
|
|
|
|
@@ -152,7 +152,7 @@ if (!$ae_loc?.site_cfg_json) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BEGIN: New Version Check:
|
|
|
|
|
if ($ae_loc && $ae_sess && ($ae_loc.ver != $ae_sess.ver)) {
|
|
|
|
|
if ($ae_loc && $ae_sess && ($ae_loc?.ver != $ae_sess?.ver)) {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log('ROOT: New version of the ae_loc (core local storage) available!!!');
|
|
|
|
|
console.log(`$ae_loc.ver: ${$ae_loc.ver} != $ae_sess.ver: ${$ae_sess.ver}`);
|
|
|
|
|
@@ -309,6 +309,9 @@ if (!$ae_loc?.last_cache_refresh) { // Default is null, currently...
|
|
|
|
|
if (log_lvl > 1) {
|
|
|
|
|
console.log(`ROOT: Last IDB reload is recent: ${$ae_loc.last_cache_refresh}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flag_expired = false;
|
|
|
|
|
$ae_loc.cache_expired = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// END: Expired Cache Check:
|
|
|
|
|
@@ -316,7 +319,7 @@ if (!$ae_loc?.last_cache_refresh) { // Default is null, currently...
|
|
|
|
|
|
|
|
|
|
// BEGIN: Access Checks:
|
|
|
|
|
// Updated 2024-11-21
|
|
|
|
|
if ($ae_loc.site_access_key || $ae_loc.site_domain_access_key) {
|
|
|
|
|
if ($ae_loc?.site_access_key || $ae_loc?.site_domain_access_key) {
|
|
|
|
|
// log_lvl = 2;
|
|
|
|
|
if (log_lvl > 1) {
|
|
|
|
|
console.log(`We need to do a current check against the allow_access value. site key: ${$ae_loc.site_access_key}, domain key: ${$ae_loc.site_domain_access_key}`);
|
|
|
|
|
@@ -366,28 +369,28 @@ if ($ae_loc.site_access_key || $ae_loc.site_domain_access_key) {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// This is mainly for Precon CHOW
|
|
|
|
|
if ($ae_loc?.site_cfg_json?.slct__sponsorship_cfg_id) {
|
|
|
|
|
$slct.sponsorship_cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
|
|
|
|
|
if ($ae_loc?.mod?.sponsorships) {
|
|
|
|
|
$ae_loc.mod.sponsorships.cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
|
|
|
|
|
} else {
|
|
|
|
|
$ae_loc.mod = {
|
|
|
|
|
...$ae_loc.mod,
|
|
|
|
|
sponsorships: {
|
|
|
|
|
cfg_id: $ae_loc.site_cfg_json.slct__sponsorship_cfg_id
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
} else if ($ae_loc?.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 > 1) {
|
|
|
|
|
console.log(`No Sponsorship Config ID set.`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// END: Special Checks
|
|
|
|
|
// // This is mainly for Precon CHOW
|
|
|
|
|
// if ($ae_loc?.site_cfg_json?.slct__sponsorship_cfg_id) {
|
|
|
|
|
// $slct.sponsorship_cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
|
|
|
|
|
// if ($ae_loc?.mod?.sponsorships) {
|
|
|
|
|
// $ae_loc.mod.sponsorships.cfg_id = $ae_loc.site_cfg_json.slct__sponsorship_cfg_id;
|
|
|
|
|
// } else {
|
|
|
|
|
// $ae_loc.mod = {
|
|
|
|
|
// ...$ae_loc.mod,
|
|
|
|
|
// sponsorships: {
|
|
|
|
|
// cfg_id: $ae_loc.site_cfg_json.slct__sponsorship_cfg_id
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// }
|
|
|
|
|
// } else if ($ae_loc?.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 > 1) {
|
|
|
|
|
// console.log(`No Sponsorship Config ID set.`);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // END: Special Checks
|
|
|
|
|
|
|
|
|
|
// Root Svelte Layout Specific:
|
|
|
|
|
let trigger_clear_access: null|boolean = $state(null);
|
|
|
|
|
@@ -448,28 +451,11 @@ if (browser && flag_reload) {
|
|
|
|
|
|
|
|
|
|
function clear_idb() {
|
|
|
|
|
indexedDB.deleteDatabase('ae_archives_db'); // Archives module
|
|
|
|
|
// indexedDB.deleteDatabase('content'); // Archives module <-- WARNING
|
|
|
|
|
indexedDB.deleteDatabase('ae_core_db');
|
|
|
|
|
indexedDB.deleteDatabase('ae_events_db'); // Events module
|
|
|
|
|
// indexedDB.deleteDatabase('badges'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('devices'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('exhibits'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('exhibit_tracking'); // Events module
|
|
|
|
|
// indexedDB.deleteDatabase('files'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('locations'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('presentations'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('presenters'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('sessions'); // Events module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('file'); // Core - Hosted Files module
|
|
|
|
|
indexedDB.deleteDatabase('ae_journals_db'); // Journals module
|
|
|
|
|
// indexedDB.deleteDatabase('journal_entry');
|
|
|
|
|
// indexedDB.deleteDatabase('notes');
|
|
|
|
|
indexedDB.deleteDatabase('ae_posts_db'); // Posts module
|
|
|
|
|
// indexedDB.deleteDatabase('comment'); // Posts module <-- WARNING
|
|
|
|
|
indexedDB.deleteDatabase('ae_sponsorships_db'); // Sponsorships module
|
|
|
|
|
// indexedDB.deleteDatabase('cfg'); // Sponsorships module <-- WARNING
|
|
|
|
|
// indexedDB.deleteDatabase('person'); // Core - People module
|
|
|
|
|
// indexedDB.deleteDatabase('user'); // Core - Not currently used
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clear_local() {
|
|
|
|
|
@@ -477,6 +463,7 @@ function clear_local() {
|
|
|
|
|
// localStorage.removeItem('ae_idaa_loc');
|
|
|
|
|
// localStorage.removeItem('ae_journals_loc');
|
|
|
|
|
// localStorage.removeItem('ae_events_loc');
|
|
|
|
|
|
|
|
|
|
$ae_loc.allow_access = false;
|
|
|
|
|
$ae_loc.authenticated_access = false;
|
|
|
|
|
$ae_loc.edit_mode = false;
|
|
|
|
|
@@ -862,6 +849,21 @@ $effect(() => {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onclick={() => {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}}
|
|
|
|
|
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-warning-800 hover:text-warning-900 transition-all"
|
|
|
|
|
title="Reload page to clear some caches and check for updates"
|
|
|
|
|
>
|
|
|
|
|
<!-- <span class="fas fa-sync mx-1"></span> -->
|
|
|
|
|
<RefreshCw class="mx-1" />
|
|
|
|
|
<span>
|
|
|
|
|
Reload
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onclick={() => {
|
|
|
|
|
@@ -890,26 +892,13 @@ $effect(() => {
|
|
|
|
|
<!-- This is mainly for IDAA using iframes in the Novi site. -->
|
|
|
|
|
<div
|
|
|
|
|
class="text-center text-sm text-gray-500"
|
|
|
|
|
class:hidden={!$ae_loc.iframe}
|
|
|
|
|
class:hidden={!$ae_loc?.iframe}
|
|
|
|
|
>
|
|
|
|
|
<p>If you have tried the "Clear Cache and Reload" button, you may need to manually reload the page using your browser's reload button or by pressing <kbd>Ctrl</kbd> + <kbd>R</kbd> or <kbd>Cmd</kbd> + <kbd>R</kbd>.</p>
|
|
|
|
|
<p>This sometimes happens with new versions of the app or when in an iframe.</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onclick={() => {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}}
|
|
|
|
|
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-warning-800 hover:text-warning-900 transition-all"
|
|
|
|
|
title="Reload page to clear some caches and check for updates"
|
|
|
|
|
>
|
|
|
|
|
<!-- <span class="fas fa-sync mx-1"></span> -->
|
|
|
|
|
<RefreshCw class="mx-1" />
|
|
|
|
|
<span>
|
|
|
|
|
Reload
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{:else if (browser && $ae_loc?.allow_access)}
|
|
|
|
|
@@ -920,10 +909,12 @@ $effect(() => {
|
|
|
|
|
{@render children?.()}
|
|
|
|
|
|
|
|
|
|
{:else if (browser || flag_reload)}
|
|
|
|
|
|
|
|
|
|
<span class="fas fa-spinner fa-spin"></span>
|
|
|
|
|
Loading...
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-col items-center justify-center max-w-lg mx-auto space-y-6 border border-red-500 rounded-lg p-4 bg-green-50 dark:bg-green-900 m-8">
|
|
|
|
|
<div>
|
|
|
|
|
<span class="fas fa-spinner fa-spin mx-1"></span>
|
|
|
|
|
Page data is loading...
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{#if (browser) }
|
|
|
|
|
@@ -936,6 +927,54 @@ $effect(() => {
|
|
|
|
|
{:else}
|
|
|
|
|
<!-- Nothing to show -->
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
{:else}
|
|
|
|
|
<div class="flex flex-col items-center justify-center max-w-lg mx-auto space-y-6 border border-red-500 rounded-lg p-4 bg-green-50 dark:bg-green-900 m-8">
|
|
|
|
|
<div>
|
|
|
|
|
<span class="fas fa-spinner fa-spin mx-1"></span>
|
|
|
|
|
Loading...
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onclick={() => {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}}
|
|
|
|
|
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-warning-800 hover:text-warning-900 transition-all"
|
|
|
|
|
title="Reload page to clear some caches and check for updates"
|
|
|
|
|
>
|
|
|
|
|
<!-- <span class="fas fa-sync mx-1"></span> -->
|
|
|
|
|
<RefreshCw class="mx-1" />
|
|
|
|
|
<span>
|
|
|
|
|
Reload
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
onclick={() => {
|
|
|
|
|
console.log('Reloading page...');
|
|
|
|
|
// Clear the IndexedDB
|
|
|
|
|
clear_idb();
|
|
|
|
|
|
|
|
|
|
// Clear localStorage and sessionStorage
|
|
|
|
|
clear_local();
|
|
|
|
|
// clear_sess();
|
|
|
|
|
|
|
|
|
|
alert('IDB, Local, and Session Storage cleared. The page should now refresh on its own.');
|
|
|
|
|
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}}
|
|
|
|
|
class="btn btn-sm m-1 variant-ghost-secondary hover:variant-ghost-warning hover:variant-outline-warning text-error-700 hover:text-error-900 transition-all text-wrap"
|
|
|
|
|
title="Reload and clear the page cache"
|
|
|
|
|
>
|
|
|
|
|
<!-- <span class="fas fa-sync mx-1"></span> -->
|
|
|
|
|
<RefreshCcwDot class="mx-1" />
|
|
|
|
|
<span>
|
|
|
|
|
Clear Cache and Reload
|
|
|
|
|
</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|