I guess this is better than it was...

This commit is contained in:
Scott Idem
2024-03-27 17:55:31 -04:00
parent 3082c07e3e
commit 8d8fb0b638
22 changed files with 582 additions and 443 deletions

View File

@@ -1,6 +1,7 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;
import { goto } from '$app/navigation';
import type { Writable } from 'svelte/store';
import { localStorageStore } from '@skeletonlabs/skeleton';
@@ -14,15 +15,25 @@ import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
// import Element_data_store from '$lib/element_data_store.svelte';
$events_loc.qry__enabled = 'enabled';
$events_loc.qry__hidden = 'not_hidden';
$events_loc.qry__limit = 15;
$events_loc.qry__offset = 0;
// let ae_slct_loc: Writable<key_val> = localStorageStore(`ae_slct__event_id`, ds_code_obj);
// console.log(`ae_ Data Store ${ds_code} = `, $ae_slct_loc);
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
$slct.account_id = data.account_id;
console.log(`$slct.account_id = `, $slct.account_id);
let ae_acct = data[$slct.account_id];
console.log(`ae_acct = `, ae_acct);
$events_slct.event_id = ae_acct.slct.event_id
$events_slct.event_obj = ae_acct.slct.event_obj
let ae_promises: key_val = {};
if (data.ae_loc.site_cfg_json.slct__event_id) {
$events_slct.event_id = data.ae_loc.site_cfg_json.slct__event_id;
$events_loc.event_id = data.ae_loc.site_cfg_json.slct__event_id;
if (ae_acct.loc.site_cfg_json.slct__event_id) {
$events_slct.event_id = ae_acct.loc.site_cfg_json.slct__event_id;
$events_loc.event_id = ae_acct.loc.site_cfg_json.slct__event_id;
} else if ($events_loc.default__event_id) {
$events_slct.event_id = $events_loc.default__event_id;
$events_loc.event_id = $events_loc.default__event_id;
@@ -98,7 +109,7 @@ async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
<svelte:head>
<title>Events Badges - {data.ae_loc.title}</title>
<title>Events Badges - {$events_loc.title ?? 'Æ loading...'}</title>
</svelte:head>
<!-- <h1>Events Badges Layout?</h1> -->
@@ -112,7 +123,7 @@ async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
<button
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!data.ae_loc.trusted_access && item.access === 'trusted') || (!data.ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
class:hidden={(!$ae_loc.trusted_access && item.access === 'trusted') || (!$ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
disabled={item.disable}
on:click={() => {
@@ -129,7 +140,7 @@ async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
href={item.href}
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!data.ae_loc.trusted_access && item.access === 'trusted') || (!data.ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
class:hidden={(!$ae_loc.trusted_access && item.access === 'trusted') || (!$ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
class:disabled={item.disable}
>
{item.name}
@@ -139,7 +150,7 @@ async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
<!-- <button
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!data.ae_loc.trusted_access && item.access === 'trusted') || (!data.ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
class:hidden={(!$ae_loc.trusted_access && item.access === 'trusted') || (!$ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
disabled={item.disable}
on:click={() => {

View File

@@ -9,21 +9,29 @@
// import type { key_val } from '$lib/ae_stores';
export async function load({ params, parent, url }) { // route
export async function load({ parent }) { // route
let data = await parent();
console.log(`ae_events_badges +layout.ts data:`, data);
// console.log(`ae_events_badges +layout.ts data.params:`, params);
// console.log(`ae_events_badges +layout.ts data.route:`, route);
// console.log(`ae_events_badges +layout.ts data.url:`, url);
// const { ae_init, root_layout_ts } = await parent();
let data = await parent();
console.log(`ae_events_badges +layout.ts data:`, data);
let account_id = data.account_id;
let ae_acct = data[account_id];
console.log(`ae_acct = `, ae_acct);
if (data.ae_loc.account_id) {
console.log(`ae_events_badges +layout.ts data = data.ae_loc:`, data.ae_loc);
} else {
console.log(`ae_events_badges +layout.ts data = data.ae_loc:`, data.ae_loc);
if (!account_id) {
console.log(`events_badges +layout.ts: The account_id was not found in the data!!!`);
return false;
}
let event_id = ae_acct.slct.event_id;
if (!event_id) {
console.log(`events_badges +layout.ts: The event_id was not found in the data!!!`);
return false;
}
data.ae_events_badges_layout_ts = true;
@@ -38,8 +46,11 @@ export async function load({ params, parent, url }) { // route
};
data.submenu = submenu
// WARNING: Precaution against shared data between sites and sessions.
data[account_id] = ae_acct;
return data;
}
// export const prerender = false;
// export const prerender = true;
// export const prerender = true;