Recovering from something that broke the styling. It is not 100% right, but much better.

This commit is contained in:
Scott Idem
2024-08-23 14:26:17 -04:00
parent fed37a77b8
commit 4dbdd16bd0
8 changed files with 176 additions and 193 deletions

View File

@@ -4,14 +4,20 @@ import type { Writable } from 'svelte/store';
import type { key_val } from '$lib/ae_stores';
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2024-08-21_1646';
let ver_idb = '2024-08-21_1645';
/* *** BEGIN *** Initialize events_local_data_struct */
// Longer-term app data. This should be stored to *local* storage.
// Updated 2024-03-06
let events_local_data_struct: key_val = {
'ver': '2024-06-26_12',
ver: ver,
ver_idb: ver_idb,
// Shared
'name': 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
'title': `OSIT's Æ Events`, // - Dev SvelteKit`, // Æ
name: 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
title: `OSIT's Æ Events`, // - Dev SvelteKit`, // Æ
'ds': {},
@@ -244,8 +250,10 @@ export let events_loc: Writable<key_val> = localStorageStore('ae_events_loc', ev
// Temporary app data. This should be stored to session storage.
// Updated 2024-03-06
let events_session_data_struct: key_val = {
'ver': '2024-03-19_17',
'log_lvl': 1,
ver: ver,
ver_idb: ver_idb,
log_lvl: 1,
// Shared
'ds': {
'submit_status': null,

View File

@@ -45,17 +45,21 @@ export let ae_snip = string_snippets;
// 'classes__events_pres_mgmt_menu': classes__events_pres_mgmt_menu
// };
// Set the version for the app data. Changing this should force a notification and ask the user to clear and reload the page.
let ver = '2024-08-21_1736';
let ver_idb = '2024-08-21_1735';
// *** BEGIN *** Longer-term app data. This should be stored to local storage.
export let ae_app_local_data_struct: key_val = {
'ver': '2024-08-16_1821',
'ver_idb': '2024-08-16_1826', // Clear if date IndexedDB version
'name': 'Aether - App Hub (SvelteKit 2.x Svelte 4.x)',
'theme': 'light',
'iframe': false,
'title': `OSIT's Æ`, // - Dev SvelteKit`, // &AElig;
name: 'Aether - App Hub (SvelteKit 2.x Svelte 4.x)',
theme: 'light',
iframe: false,
title: `OSIT's Æ`, // - Dev SvelteKit`, // &AElig;
'debug': false, // A simple flag to know if we should show debug information.
'edit_mode': false, // A simple flag to know if we should show edit mode options.
debug: false, // A simple flag to know if we should show debug information.
edit_mode: false, // A simple flag to know if we should show edit mode options.
'account_id': ae_account_id, // OSIT Demo _XY7DXtc9MY
'account_code': 'not_set',
@@ -187,7 +191,9 @@ export let ae_loc: Writable<key_val> = localStorageStore('ae_loc', ae_app_local_
// *** BEGIN *** Temporary app data. This should be stored to session storage.
export let ae_app_session_data_struct: key_val = {
'ver': '2024-02-27_13',
'log_lvl': 0,
// ver_idb: ver_idb,
log_lvl: 0,
// 'name': 'Aether App Template',
// 'theme': 'light',
// 'account_id': ae_account_id,
@@ -242,7 +248,7 @@ export let ae_sess = writable(ae_app_session_data_struct);
// *** BEGIN *** Temporary API data. This should be stored to session storage.
export let ae_api_data_struct: key_val = {
'ver': '2024-02-22_17',
'ver': '2024-08-11_11',
'base_url': api_base_url,
'base_url_bak': api_base_url_bak,
'api_secret_key': api_secret_key, // 'YOUR_API_SECRET_KEY',

View File

@@ -52,87 +52,37 @@ function handle_check_access_type_passcode() {
window.localStorage.setItem('access_type', 'super');
entered_passcode = null;
$ae_loc.access_type = 'super';
trigger = 'process_permission_check';
dispatch_access_type_changed();
return true;
} else if ($ae_loc.page_access_code_li.manager == entered_passcode) {
console.log('Manager passcode matched');
window.localStorage.setItem('access_type', 'manager');
entered_passcode = null;
$ae_loc.access_type = 'manager';
trigger = 'process_permission_check';
dispatch_access_type_changed();
return true;
} else if ($ae_loc.page_access_code_li.administrator == entered_passcode) {
console.log('Administrator passcode matched');
window.localStorage.setItem('access_type', 'administrator');
entered_passcode = null;
$ae_loc.access_type = 'administrator';
trigger = 'process_permission_check';
// $ae_loc = $ae_loc; // Trigger Svelte just in case
// ae_loc.set($ae_loc);
// console.log($ae_loc);
dispatch_access_type_changed();
return true;
} else if ($ae_loc.page_access_code_li.trusted == entered_passcode) {
console.log('Trusted passcode matched');
window.localStorage.setItem('access_type', 'trusted');
entered_passcode = null;
$ae_loc.access_type = 'trusted';
trigger = 'process_permission_check';
// $ae_loc = $ae_loc; // Trigger Svelte just in case
// ae_loc.set($ae_loc);
// console.log($ae_loc);
dispatch_access_type_changed();
return true;
} else if ($ae_loc.page_access_code_li.public == entered_passcode) {
console.log('Public passcode matched');
window.localStorage.setItem('access_type', 'public');
entered_passcode = null;
$ae_loc.access_type = 'public';
trigger = 'process_permission_check';
dispatch_access_type_changed();
return true;
} else if ($ae_loc.page_access_code_li.authenticated == entered_passcode) {
console.log('Authenticated passcode matched');
window.localStorage.setItem('access_type', 'authenticated');
entered_passcode = null;
$ae_loc.access_type = 'authenticated';
trigger = 'process_permission_check';
dispatch_access_type_changed();
return true;
} else {
console.log('Passcode does not match');
@@ -149,6 +99,25 @@ function handle_check_access_type_passcode() {
return false;
}
entered_passcode = null;
trigger = 'process_permission_check';
// WARNING 2024-08-21: For some reason the config element does not auto show or hide when the access type changes.
if (!$ae_loc.iframe && $ae_loc.authenticated_access) {
$ae_loc.hub.show_element__access_type = true;
$ae_loc.hub.show_element__cfg = true;
} else if ($ae_loc.iframe && $ae_loc.trusted_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;
}
dispatch_access_type_changed();
return true;
} else {
console.log('Entered passcode too short.');

View File

@@ -8,9 +8,9 @@ import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
let notes: null|string = null;
let all: boolean = false;
export let theme_mode: null|string = null;
// export let theme_mode: null|string = null;
export let set_theme_mode: null|boolean = null;
export let theme_name: null|string = null;
// export let theme_name: null|string = null;
export let set_theme_name: null|boolean = null;
const dispatch = createEventDispatcher();
@@ -26,8 +26,8 @@ onMount(() => {
}
});
$: if ($slct_trigger == 'set_theme_mode' && $ae_loc.hub.theme_mode) {
console.log(`$ae_loc.hub.theme_mode=${$ae_loc.hub.theme_mode}`);
$: if ($slct_trigger == 'set_theme_mode' && $ae_loc?.hub?.theme_mode) {
console.log(`$ae_loc.hub.theme_mode=${$ae_loc?.hub?.theme_mode}`);
$slct_trigger = null;
if ($ae_loc.hub.theme_mode == 'light') {
document.documentElement.classList.remove('dark');
@@ -38,11 +38,11 @@ $: if ($slct_trigger == 'set_theme_mode' && $ae_loc.hub.theme_mode) {
}
}
$: if ($slct_trigger == 'set_theme_name' && $ae_loc.hub.theme_name) {
console.log(`$ae_loc.hub.theme_name=${$ae_loc.hub.theme_name}`);
$: if ($slct_trigger == 'set_theme_name' && $ae_loc?.hub?.theme_name) {
console.log(`$ae_loc?.hub?.theme_name=${$ae_loc?.hub?.theme_name}`);
$slct_trigger = null;
// Update the body attribute named "data-theme" to the current theme name.
document.body.setAttribute('data-theme', $ae_loc.hub.theme_name);
document.body.setAttribute('data-theme', $ae_loc?.hub?.theme_name);
}
// $: if (entered_passcode && entered_passcode.length >= 5) {