Files
OSIT-AE-App-Svelte/src/routes/sponsorships/+layout.svelte
2024-03-26 14:24:35 -04:00

55 lines
1.6 KiB
Svelte

<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;
import { onMount } from 'svelte';
import { localStorageStore } from '@skeletonlabs/skeleton';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
// Quickly save the data passed from the parent to the Svelte stores.
$ae_loc = data.ae_loc;
$ae_loc.mod.sponsorships.cfg_id = data.ae_slct.sponsorship_cfg_id;
$ae_loc.mod.sponsorships.level_guest_max_li = {
0: 0,
1: 4, // CHOW 2024 - Friend
2: 8, // CHOW 2024 - Supporter
3: 8, // CHOW 2024 - Advocate
4: 8, // CHOW 2024 - Champion
5: 8, // CHOW 2024 - Presenting Partner
6: 16, // CHOW 2024 - Signature Partner
7: 16, // CHOW 2024 - Premier Partner
};
$slct.sponsorship_cfg_id = data.ae_slct.sponsorship_cfg_id;
$slct.sponsorship_cfg_obj = data.ae_slct.sponsorship_cfg_obj;
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
if (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);
}
}
onMount(() => {
if (data.url.searchParams.get('sponsorship_cfg_id')) {
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
}
});
</script>
<svelte:head>
<title>Sponsor Hub - {data.ae_loc.title}</title>
</svelte:head>
<!-- <h1>Sponsorships Layout?</h1> -->
<!-- <div class="submenu">
{#each data.sections as section}
<a href="/settings/{section.slug}">{section.title}</a>
{/each}
</div> -->
<slot></slot>