Added the access code component. Improved layout. General clean up and improvements.

This commit is contained in:
Scott Idem
2024-02-22 17:21:22 -05:00
parent 5a13852432
commit d1328eb67c
16 changed files with 973 additions and 152 deletions

View File

@@ -57,6 +57,8 @@ import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
console.log($ae_loc, $ae_sess, $ae_api);
import Element_access_type from '$lib/element_access_type.svelte';
// const ae_loc_test_store: Writable<string> = localStorageStore('ae_loc_test', {'test': 'This is a test'});
// // Subscribe to the store
// ae_loc_test_store.subscribe(() => {});
@@ -74,13 +76,18 @@ console.log($ae_loc, $ae_sess, $ae_api);
// $ae_loc_test_store
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'});
async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
async function handle_get_data_store_obj_w_code({ code=null, data_type='text', trigger=null }) {
console.log(`*** handle_get_data_store_obj_w_code() *** code=${code}`);
if (!code) {
console.log('No code provided.');
return;
}
// let get_item_result = window.localStorage.getItem(code);
// localStorage.getItem(code);
@@ -109,6 +116,10 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
// console.log(`Code: ${$ae_loc.hub.ds[code]}`);
// console.log(`Code:`, $ae_loc.hub.ds[code]);
if (trigger) {
$slct_trigger = trigger;
}
}
})
.catch(function (error) {
@@ -116,6 +127,15 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
});
}
$: if ($slct_trigger == 'set_access_code_li' && $ae_loc.hub.ds['hub__page__access_code_li_json']) {
console.log(`$ae_loc.hub.ds['hub__page__access_code_li_json'] = `, $ae_loc.hub.ds['hub__page__access_code_li_json']);
$slct_trigger = null; // Reset the trigger to prevent loops
$ae_loc.page_access_code_li = $ae_loc.hub.ds['hub__page__access_code_li_json'];
$ae_loc = $ae_loc; // Trigger Svelte just in case
console.log($ae_loc);
}
</script>
@@ -143,6 +163,7 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
<!-- App Shell -->
<AppShell>
<svelte:fragment slot="header">
<!-- App Bar -->
<AppBar gridColumns="grid-cols-3" slotDefault="place-self-center" slotTrail="place-content-end">
@@ -151,7 +172,8 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
&AElig; Home
</a>
</svelte:fragment>
OSIT's Aether App
<!-- OSIT's Aether App -->
{@html $ae_loc.hub.ds['hub_site_header']}
<svelte:fragment slot="trail">
<!-- <a
class="btn btn-sm variant-ghost-surface"
@@ -169,6 +191,7 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
</svelte:fragment>
</AppBar>
<!-- <AppBar>
<svelte:fragment slot="lead">
<strong class="text-xl uppercase">Skeleton</strong>
@@ -203,15 +226,22 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
</svelte:fragment>
<!-- Page Route Content -->
<slot />
<svelte:fragment slot="footer">
<div class="flex justify-between space-x-2">
{@html $ae_loc.hub.ds['hub_site_footer']}
</div>
</svelte:fragment>
</AppShell>
<Element_access_type />
<style lang="postcss">
</style>