835 lines
29 KiB
Svelte
835 lines
29 KiB
Svelte
<script lang="ts">
|
|
/** @type {import('./$types').LayoutData} */
|
|
let log_lvl: number = 0;
|
|
|
|
// *** Import Svelte specific
|
|
import '../app.postcss';
|
|
|
|
// *** Import other supporting libraries
|
|
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';
|
|
|
|
const modalRegistry: Record<string, ModalComponent> = {
|
|
// Set a unique modal ID, then pass the component reference
|
|
// modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj },
|
|
// modalComponentTwo: { ref: ModalComponentTwo },
|
|
// ...
|
|
};
|
|
import {
|
|
CircleX,
|
|
Eye, EyeOff,
|
|
Key,
|
|
LogIn, LogOut, LockKeyhole,
|
|
Mail, MailCheck,
|
|
Menu,
|
|
ShieldUser,
|
|
User, UserCheck
|
|
} from '@lucide/svelte';
|
|
|
|
// Highlight JS
|
|
import hljs from 'highlight.js/lib/core';
|
|
import 'highlight.js/styles/github-dark.css';
|
|
|
|
import { browser } from '$app/environment';
|
|
import { localStorageStore, storeHighlightJs } from '@skeletonlabs/skeleton';
|
|
import xml from 'highlight.js/lib/languages/xml'; // for HTML
|
|
import css from 'highlight.js/lib/languages/css';
|
|
import javascript from 'highlight.js/lib/languages/javascript';
|
|
import typescript from 'highlight.js/lib/languages/typescript';
|
|
|
|
hljs.registerLanguage('xml', xml); // for HTML
|
|
hljs.registerLanguage('css', css);
|
|
hljs.registerLanguage('javascript', javascript);
|
|
hljs.registerLanguage('typescript', typescript);
|
|
storeHighlightJs.set(hljs);
|
|
|
|
// *** Import Aether specific variables and functions
|
|
import Analytics from '$lib/analytics.svelte'
|
|
// import { api } from '$lib/api';
|
|
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
|
import { events_loc, events_slct } from '$lib/ae_events_stores';
|
|
// import type { key_val } from '$lib/ae_stores';
|
|
|
|
import Element_access_type from '$lib/element_access_type.svelte';
|
|
import Element_app_cfg from '$lib/element_app_cfg.svelte';
|
|
import Element_sign_in_out from '$lib/element_sign_in_out.svelte';
|
|
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
|
|
|
interface Props {
|
|
data: any;
|
|
children?: import('svelte').Snippet;
|
|
}
|
|
|
|
let { data, children }: Props = $props();
|
|
|
|
if (log_lvl > 1) {
|
|
console.log(`ae_root +layout.svelte data:`, data);
|
|
}
|
|
|
|
if (!$ae_loc?.app_cfg?.show_element__menu_btn) {
|
|
$ae_loc.app_cfg.show_element__menu = false;
|
|
$ae_loc.app_cfg.show_element__menu_btn = true;
|
|
}
|
|
|
|
// let account_id = localStorage.getItem('ae_account_id');
|
|
// console.log(`account_id = `, account_id);
|
|
|
|
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other. This should catch anything that is a child of this layout.svelte file.
|
|
$slct.account_id = data.account_id;
|
|
if (log_lvl) {
|
|
console.log(`*ae_root +layout.svelte* $slct.account_id = ${$slct.account_id}`);
|
|
}
|
|
let ae_acct = data[$slct.account_id];
|
|
|
|
$ae_api = {
|
|
...$ae_api,
|
|
...ae_acct.api,
|
|
}
|
|
if (log_lvl > 1) {
|
|
console.log(`$ae_api = `, $ae_api);
|
|
}
|
|
|
|
$ae_loc = {
|
|
...$ae_loc,
|
|
...ae_acct.loc,
|
|
}
|
|
if (log_lvl > 1) {
|
|
console.log(`$ae_loc = `, $ae_loc);
|
|
}
|
|
|
|
$slct = {
|
|
...$slct,
|
|
...ae_acct.slct,
|
|
}
|
|
if (log_lvl > 1) {
|
|
console.log(`$slct = `, $slct);
|
|
}
|
|
|
|
// This should only be temporary.
|
|
if (!$ae_loc.app_cfg) {
|
|
$ae_loc.app_cfg = {};
|
|
}
|
|
|
|
// IDB caches - Check if the last reload timestamp for $ae_loc.last_idb_reload is no more than 15 minutes ago.
|
|
let default_idb_reload_time = 120 * 60 * 1000; // 15 minutes?
|
|
let trusted_idb_reload_time = 4 * 60 * 60 * 1000; // 4 hours or 120 minutes?
|
|
|
|
// There should almost always be an event_id set.
|
|
if ($ae_loc?.site_cfg_json.slct__event_id) {
|
|
$events_slct.event_id = $ae_loc.site_cfg_json.slct__event_id;
|
|
$events_loc.event_id = $ae_loc.site_cfg_json.slct__event_id;
|
|
} else if ($events_slct.event_id) {
|
|
// console.log(`Event ID already set:`, $events_slct.event_id);
|
|
$events_loc.event_id = $events_slct.event_id;
|
|
} else {
|
|
if (log_lvl > 1) {
|
|
console.log(`No Event ID set!`);
|
|
}
|
|
}
|
|
|
|
// 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;
|
|
$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.`);
|
|
}
|
|
}
|
|
|
|
|
|
// Updated 2024-11-21
|
|
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}`);
|
|
}
|
|
|
|
// $ae_loc.allow_access is set to they key if passed in the URL. It is set to true if they are just "trusted".
|
|
if ($ae_loc.site_access_key === $ae_loc.allow_access || $ae_loc.site_domain_access_key === $ae_loc.allow_access) {
|
|
if (log_lvl > 1) {
|
|
console.log(`PASS: The allow_access was checked earlier and just now checked against the site or domain key.`);
|
|
}
|
|
} else {
|
|
// console.log(`FAIL: The access key was checked earlier, but just now failed. Checking if they are trusted...`);
|
|
if ($ae_loc.trusted_access) {
|
|
if (log_lvl > 1) {
|
|
console.log(`PASS: The access key was checked and failed, but we have trusted access.`);
|
|
}
|
|
$ae_loc.allow_access = true;
|
|
} else {
|
|
if (log_lvl) {
|
|
console.log(`FAIL: The site and domain access key was checked and failed, and we do not have trusted access.`);
|
|
}
|
|
$ae_loc.allow_access = false;
|
|
}
|
|
}
|
|
} else {
|
|
// This means this site and domain do not require an access key.
|
|
$ae_loc.allow_access = true;
|
|
}
|
|
|
|
|
|
if (browser) {
|
|
if (!$ae_loc.last_idb_reload) {
|
|
if (log_lvl) {
|
|
console.log(`Last reload not found. Need to set!`);
|
|
}
|
|
|
|
$ae_loc.last_idb_reload = Date.now();
|
|
|
|
// Clear Indexed DB as well
|
|
indexedDB.deleteDatabase('ae_archives_db');
|
|
indexedDB.deleteDatabase('ae_core_db');
|
|
indexedDB.deleteDatabase('ae_events_db');
|
|
indexedDB.deleteDatabase('ae_notes_db');
|
|
indexedDB.deleteDatabase('ae_posts_db');
|
|
} else if ($ae_loc.last_idb_reload && $ae_loc.trusted_access && (Date.now() - $ae_loc.last_idb_reload) > trusted_idb_reload_time) {
|
|
if (log_lvl) {
|
|
console.log(`Last (trusted) reload too old: ${$ae_loc.last_idb_reload}`);
|
|
}
|
|
|
|
$ae_loc.last_idb_reload = Date.now();
|
|
|
|
// Clear Indexed DB as well
|
|
indexedDB.deleteDatabase('ae_archives_db');
|
|
indexedDB.deleteDatabase('ae_core_db');
|
|
indexedDB.deleteDatabase('ae_events_db');
|
|
indexedDB.deleteDatabase('ae_notes_db');
|
|
indexedDB.deleteDatabase('ae_posts_db');
|
|
|
|
// localStorage.removeItem('ae_loc');
|
|
// localStorage.removeItem('events_loc');
|
|
|
|
window.location.reload();
|
|
} else if ($ae_loc.last_idb_reload && (Date.now() - $ae_loc.last_idb_reload) > default_idb_reload_time) {
|
|
if (log_lvl) {
|
|
console.log(`Last (default) reload too old: ${$ae_loc.last_idb_reload}`);
|
|
}
|
|
|
|
$ae_loc.last_idb_reload = Date.now();
|
|
|
|
// Clear Indexed DB as well
|
|
indexedDB.deleteDatabase('ae_archives_db');
|
|
indexedDB.deleteDatabase('ae_core_db');
|
|
indexedDB.deleteDatabase('ae_events_db');
|
|
indexedDB.deleteDatabase('ae_notes_db');
|
|
indexedDB.deleteDatabase('ae_posts_db');
|
|
|
|
// localStorage.removeItem('ae_loc');
|
|
// localStorage.removeItem('events_loc');
|
|
|
|
window.location.reload();
|
|
} else {
|
|
if (log_lvl > 1) {
|
|
console.log(`Last reload is recent: ${$ae_loc.last_idb_reload}`);
|
|
}
|
|
}
|
|
|
|
// Waiting until the browser exists.
|
|
// if ($ae_loc && $ae_sess && $ae_loc.ver_idb != $ae_sess.ver_idb) {
|
|
// console.log('New version of the IDB available!!!');
|
|
// console.log(`$ae_loc.ver_idb: ${$ae_loc.ver_idb} != $ae_sess.ver_idb: ${$ae_sess.ver_idb}`);
|
|
|
|
// // Clear Indexed DB as well
|
|
// indexedDB.deleteDatabase('ae_archives_db');
|
|
// indexedDB.deleteDatabase('ae_core_db');
|
|
// indexedDB.deleteDatabase('ae_events_db');
|
|
// indexedDB.deleteDatabase('ae_notes_db');
|
|
// indexedDB.deleteDatabase('ae_posts_db');
|
|
|
|
// $ae_loc.ver_idb = $ae_sess.ver_idb;
|
|
|
|
// window.location.reload();
|
|
// }
|
|
|
|
if ($ae_loc && $ae_sess && ($ae_loc.ver != $ae_sess.ver)) {
|
|
console.log('New version of the data store available!!!');
|
|
console.log(`$ae_loc.ver: ${$ae_loc.ver} != $ae_sess.ver: ${$ae_sess.ver}`);
|
|
|
|
// alert('New version available!!!');
|
|
|
|
$ae_loc.ver = $ae_sess.ver;
|
|
|
|
// This does not seem to work fast enough or something?
|
|
// goto('/', {replaceState: true, invalidateAll: true});
|
|
|
|
// $ae_loc = {};
|
|
localStorage.removeItem('ae_loc');
|
|
localStorage.removeItem('events_loc');
|
|
localStorage.clear();
|
|
|
|
// sessionStorage.removeItem('ae_sess');
|
|
// sessionStorage.removeItem('events_sess');
|
|
sessionStorage.clear();
|
|
|
|
window.location.reload();
|
|
}
|
|
|
|
|
|
// save_ds_to_local(ae_acct.ds);
|
|
let ae_ds = ae_acct.ds;
|
|
console.log(`ae_ds__ data:`, ae_ds)
|
|
for (let [key, value] of Object.entries(ae_ds)) {
|
|
console.log(`ae_ds__ key: ${key}, value:`, value);
|
|
localStorage.setItem(`ae_ds__${key}`, JSON.stringify(value));
|
|
}
|
|
|
|
|
|
// This is how the download and upload progress is tracked.
|
|
window.addEventListener('message', function(event) {
|
|
if (log_lvl) {
|
|
console.log('Message received in root +layout.svelte:', event);
|
|
}
|
|
|
|
if (event.data.type == 'api_download_blob') {
|
|
if (log_lvl) {
|
|
console.log('Download blob (file) message received:', event.data);
|
|
}
|
|
|
|
let task_id = event.data.task_id;
|
|
|
|
$ae_sess.api_download_kv[task_id] =
|
|
{
|
|
'status': event.data.status,
|
|
'task_id': task_id,
|
|
'endpoint': event.data.endpoint,
|
|
'filename': event.data.filename,
|
|
'size_total': event.data.size_total,
|
|
'size_loaded': event.data.size_loaded,
|
|
'percent_completed': event.data.percent_completed,
|
|
};
|
|
} else if (event.data.type == 'api_post_json_form') {
|
|
if (log_lvl) {
|
|
console.log('Post JSON form message received:', event.data);
|
|
}
|
|
|
|
let task_id = event.data.task_id;
|
|
|
|
$ae_sess.api_upload_kv[task_id] =
|
|
{
|
|
'status': event.data.status,
|
|
'task_id': task_id,
|
|
'endpoint': event.data.endpoint,
|
|
'filename': event.data.filename,
|
|
'size_total': event.data.size_total,
|
|
'size_loaded': event.data.size_loaded,
|
|
'percent_completed': event.data.percent_completed,
|
|
'progress': event.data.progress,
|
|
'rate': event.data.rate,
|
|
};
|
|
}
|
|
});
|
|
|
|
let iframe = data.url.searchParams.get('iframe');
|
|
if (iframe == 'true') {
|
|
console.log('Use iframe layout!');
|
|
$ae_loc.iframe = true;
|
|
|
|
document.getElementsByTagName('html')[0].classList.add('iframe');
|
|
// document.getElementsByTagName('html')[0].classList.remove('dark');
|
|
// document.getElementsByTagName('html')[0].classList.remove('light');
|
|
|
|
$ae_loc.app_cfg.show_element__access_type = false;
|
|
$ae_loc.app_cfg.show_element__cfg = false;
|
|
} else if (iframe == 'false') {
|
|
$ae_loc.iframe = false;
|
|
|
|
document.getElementsByTagName('html')[0].classList.remove('iframe');
|
|
// document.getElementsByTagName('html')[0].classList.add('dark');
|
|
// document.getElementsByTagName('html')[0].classList.add('light');
|
|
}
|
|
|
|
if (!$ae_loc.iframe && $ae_loc.trusted_access) {
|
|
$ae_loc.app_cfg.show_element__access_type = true;
|
|
$ae_loc.app_cfg.show_element__cfg = true;
|
|
} else if ($ae_loc.iframe && $ae_loc.manager_access) {
|
|
$ae_loc.app_cfg.show_element__access_type = true;
|
|
$ae_loc.app_cfg.show_element__cfg = true;
|
|
} else {
|
|
$ae_loc.app_cfg.show_element__access_type = true;
|
|
$ae_loc.app_cfg.show_element__cfg = false;
|
|
}
|
|
|
|
|
|
// This is mainly for Precon CHOW
|
|
if (data.url.searchParams.get('event_id')) {
|
|
$events_slct.event_id = data.url.searchParams.get('event_id');
|
|
$events_loc.event_id = data.url.searchParams.get('event_id');
|
|
}
|
|
|
|
if (data.url.searchParams.get('sponsorship_cfg_id')) {
|
|
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
|
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
|
}
|
|
|
|
}
|
|
|
|
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
|
|
// $: if (ae_acct.ds) {
|
|
// console.log(`ae_ds__ data:`, ae_acct.ds)
|
|
// for (let [key, value] of Object.entries(ae_acct.ds)) {
|
|
// console.log(`ae_ds__ key: ${key}, value:`, value);
|
|
// localStorageStore(`ae_ds__${key}`, value);
|
|
// }
|
|
// }
|
|
|
|
// Check if in the array of: super > manager > administrator > trusted > public > authenticated > anonymous
|
|
const access_type_li = ['super', 'manager', 'administrator', 'trusted', 'public', 'authenticated', 'anonymous'];
|
|
$effect(() => {
|
|
if (browser && $ae_loc.access_type && access_type_li.includes($ae_loc.access_type)) {
|
|
document.getElementsByTagName('html')[0].classList.remove('super_access', 'manager_access', 'administrator_access', 'trusted_access', 'public_access', 'authenticated_access', 'anonymous_access');
|
|
document.getElementsByTagName('html')[0].classList.add(`${$ae_loc.access_type}_access`);
|
|
} else if (browser) {
|
|
document.getElementsByTagName('html')[0].classList.remove('super_access', 'manager_access', 'administrator_access', 'trusted_access', 'public_access', 'authenticated_access', 'anonymous_access');
|
|
}
|
|
});
|
|
|
|
|
|
|
|
// function handle_clear_access() {
|
|
// // NOTE: I think it makes since to reset this to anonymous even if logged in as an admin or similar.
|
|
// window.localStorage.setItem('access_type', 'anonymous');
|
|
|
|
// // $ae_loc.access_type = null; // 'anonymous';
|
|
// $ae_loc.access_type = 'anonymous';
|
|
// trigger = 'process_permission_check';
|
|
|
|
// $ae_loc.app_cfg.show_element__passcode_input = false;
|
|
// return true;
|
|
// }
|
|
</script>
|
|
|
|
{#if $ae_loc?.site_google_tracking_id && $ae_loc?.site_google_tracking_id.length > 0}
|
|
<Analytics bind:site_google_tracking_id={$ae_loc.site_google_tracking_id} />
|
|
{/if}
|
|
|
|
<svelte:head>
|
|
<!-- <title>{$ae_loc.title ?? 'Æ loading...'}</title> -->
|
|
<link rel="stylesheet" href="{ae_acct.loc.site_style_href}">
|
|
<!-- <link rel="manifest" href="/manifest.json"> -->
|
|
</svelte:head>
|
|
|
|
|
|
<!-- regionFooter="flex justify-end space-x-2" -->
|
|
|
|
{#if
|
|
$ae_loc?.allow_access}
|
|
|
|
<!-- The children will contain top level (directly under body tag) div tag(s) or similar. Modal and AppShell should also be set there. The AppShell gives access to a header, footer, AppBar (usually under header), -->
|
|
{@render children?.()}
|
|
|
|
{:else if browser}
|
|
|
|
<div
|
|
data-sveltekit-preload-data="false"
|
|
class="flex flex-col items-center justify-center h-full max-w-lg mx-auto space-y-4"
|
|
>
|
|
<h1 class="text-4xl font-bold text-red-500">Access Denied</h1>
|
|
<p class="text-lg text-center text-gray-500">You do not have access to this site. You may need a passcode and or URL site key.</p>
|
|
<button
|
|
type="button"
|
|
onclick={() => {
|
|
// Clear the localStorage and sessionStorage, then reload the page.
|
|
indexedDB.deleteDatabase('ae_core_db');
|
|
indexedDB.deleteDatabase('ae_archives_db');
|
|
indexedDB.deleteDatabase('ae_events_db');
|
|
indexedDB.deleteDatabase('ae_journals_db');
|
|
indexedDB.deleteDatabase('ae_posts_db');
|
|
window.location.reload();
|
|
}}
|
|
ondblclick={() => {
|
|
// Double click to clear all databases and reload the page.
|
|
indexedDB.deleteDatabase('ae_core_db');
|
|
indexedDB.deleteDatabase('ae_archives_db');
|
|
indexedDB.deleteDatabase('ae_events_db');
|
|
indexedDB.deleteDatabase('ae_journals_db');
|
|
indexedDB.deleteDatabase('ae_posts_db');
|
|
|
|
// Clear localStorage and sessionStorage
|
|
localStorage.clear();
|
|
sessionStorage.clear();
|
|
|
|
alert('Local and Session Storage cleared. The page should now refresh on its own.');
|
|
// window.location.reload({forceGet: true});
|
|
// window.location.reload(true);
|
|
window.location.reload();
|
|
}}
|
|
class="btn btn-sm m-1 variant-glass-surface hover:variant-outline-warning hover:variant-glass-warning text-error-400 hover:text-error-800 transition-all"
|
|
title="Reload and clear the page cache"
|
|
>
|
|
<span class="fas fa-sync mx-1"></span>
|
|
Reload and Clear Cache
|
|
</button>
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
<!-- min-h-full
|
|
max-h-max
|
|
min-w-full
|
|
max-w-max -->
|
|
|
|
<!-- Toggle the menu -->
|
|
<section
|
|
class="
|
|
ae_app__menu
|
|
hidden-print
|
|
flex flex-col
|
|
items-end justify-center
|
|
gap-1
|
|
absolute right-0 bottom-16
|
|
hover:bottom-6
|
|
bg-white dark:bg-gray-800
|
|
border border-transparent
|
|
hover:border hover:border-gray-200 hover:dark:border-gray-700
|
|
rounded-lg
|
|
p-2
|
|
*:hover:inline
|
|
opacity-40
|
|
hover:opacity-100
|
|
duration-50 delay-1000 hover:delay-100 hover:ease-out
|
|
transition hover:transition-all
|
|
"
|
|
class:hidden={!$ae_loc?.app_cfg?.show_element__menu_btn}
|
|
>
|
|
|
|
<span class="hidden">
|
|
<User class="mx-1 inline-block text-gray-500" />
|
|
{$ae_loc?.person.full_name ?? '-- not set --'}<br />
|
|
<!-- <ShieldUser /> -->
|
|
<ShieldUser class="mx-1 inline-block text-gray-500" />
|
|
{$ae_loc?.user.username ?? '-- not set --'}<br />
|
|
</span>
|
|
|
|
{#if $ae_loc.edit_mode}
|
|
<button
|
|
type="button"
|
|
onclick={() => {
|
|
$ae_loc.edit_mode = false;
|
|
// dispatch_edit_mode_changed();
|
|
}}
|
|
class="btn btn-md px-2 variant-ghost-success hover:variant-filled-success transition-all *:hover:inline-block"
|
|
title="Edit mode is currently enabled. Click to disable."
|
|
>
|
|
<span class="fas fa-toggle-on mx-1"></span>
|
|
Edit
|
|
<span class="hidden">
|
|
Mode On
|
|
</span>
|
|
</button>
|
|
{:else if $ae_loc.authenticated_access}
|
|
<button
|
|
type="button"
|
|
onclick={() => {
|
|
$ae_loc.edit_mode = true;
|
|
// dispatch_edit_mode_changed();
|
|
}}
|
|
class="btn btn-md px-2 variant-ghost-warning hover:variant-filled-warning transition-all space-x-0 *:hover:inline"
|
|
title="Edit mode is currently disabled. Click to enable."
|
|
>
|
|
<span class="fas fa-toggle-off mx-1"></span>
|
|
<span class="">Edit</span>
|
|
<span class="hidden">
|
|
Mode?
|
|
</span>
|
|
</button>
|
|
{/if}
|
|
|
|
<div class="transition-all *:hover:inline">
|
|
{#if $ae_loc.access_type && $ae_loc.access_type != 'anonymous'}
|
|
<span
|
|
class="*:hover:inline"
|
|
>
|
|
<span class="fas fa-unlock mx-1"></span>
|
|
|
|
|
|
{#if $ae_loc.access_type == 'super'}
|
|
<span class="fas fa-hat-wizard m-1"></span>
|
|
<span class="hidden">Super</span>
|
|
{:else if $ae_loc.access_type == 'manager'}
|
|
<span class="fas fa-user-shield m-1"></span>
|
|
<span class="hidden">Manager</span>
|
|
{:else if $ae_loc.access_type == 'administrator'}
|
|
<span class="fas fa-user-ninja m-1"></span>
|
|
<span class="hidden">Administrator</span>
|
|
{:else if $ae_loc.access_type == 'trusted'}
|
|
<span class="fas fa-user-check m-1"></span>
|
|
<span class="hidden">Trusted Access</span>
|
|
{:else if $ae_loc.access_type == 'public'}
|
|
Public
|
|
<span class="hidden">Access</span>
|
|
{:else if $ae_loc.access_type == 'authenticated'}
|
|
Authenticated
|
|
<span class="hidden">Access</span>
|
|
{:else if $ae_loc.access_type == 'anonymous'}
|
|
Anonymous Access
|
|
{:else}
|
|
Unknown Access
|
|
{/if}
|
|
</span>
|
|
|
|
<button
|
|
type="button"
|
|
onclick={() => {
|
|
// handle_clear_access();
|
|
|
|
if ($ae_loc?.app_cfg?.show_element__menu_btn) {
|
|
$ae_loc.app_cfg.show_element__menu = true;
|
|
$ae_loc.app_cfg.show_element__menu_btn = false;
|
|
$ae_loc.app_cfg.show_element__passcode_input = false;
|
|
} else {
|
|
$ae_loc.app_cfg.show_element__menu = false;
|
|
$ae_loc.app_cfg.show_element__menu_btn = true;
|
|
}
|
|
}}
|
|
class="btn btn-sm variant-outline-surface hover:variant-ghost-warning transition-all hidden"
|
|
title="Access mode is currently enabled/unlocked. Click to exit and lock."
|
|
>
|
|
<span class="fas fa-lock mx-1"></span> Lock?
|
|
</button>
|
|
{:else}
|
|
<button
|
|
type="button"
|
|
onclick={() => {
|
|
if ($ae_loc?.app_cfg?.show_element__menu_btn) {
|
|
$ae_loc.app_cfg.show_element__menu = true;
|
|
$ae_loc.app_cfg.show_element__menu_btn = false;
|
|
$ae_loc.app_cfg.show_element__passcode_input = true;
|
|
} else {
|
|
$ae_loc.app_cfg.show_element__menu = false;
|
|
$ae_loc.app_cfg.show_element__menu_btn = true;
|
|
}
|
|
// $ae_loc.app_cfg.show_element__menu_btn = !$ae_loc?.app_cfg?.show_element__menu_btn;
|
|
}}
|
|
class="
|
|
btn btn-sm variant-outline-surface hover:variant-ghost-success transition-all
|
|
*:hover:inline
|
|
"
|
|
title="Anonymous public access is currently set. Access mode is disabled/locked."
|
|
>
|
|
<!-- <span class="fas fa-lock mx-1 lock_icon"></span> -->
|
|
<!-- <span class="">Unlock?</span> -->
|
|
<ShieldUser />
|
|
<span class="hidden">Auth?</span>
|
|
</button>
|
|
{/if}
|
|
</div>
|
|
|
|
|
|
<button
|
|
type="button"
|
|
class="btn btn-sm variant-outline-surface hover:variant-ghost-success *:hover:inline-block w-full hidden px-6 py-1"
|
|
title="Sign In"
|
|
onclick={() => {
|
|
if ($ae_loc?.app_cfg?.show_element__menu_btn) {
|
|
$ae_loc.app_cfg.show_element__menu = true;
|
|
$ae_loc.app_cfg.show_element__menu_btn = false;
|
|
} else {
|
|
$ae_loc.app_cfg.show_element__menu = false;
|
|
$ae_loc.app_cfg.show_element__menu_btn = true;
|
|
}
|
|
// $ae_loc.app_cfg.show_element__menu_btn = !$ae_loc?.app_cfg?.show_element__menu_btn;
|
|
}}
|
|
>
|
|
{#if $ae_loc?.app_cfg?.show_element__menu}
|
|
<CircleX class="inline-block" />
|
|
<!-- <span class="hidden"> -->
|
|
Hide Menu
|
|
<!-- </span> -->
|
|
{:else}
|
|
<Menu class="inline-block" />
|
|
<span class="hidden">
|
|
Menu
|
|
</span>
|
|
{/if}
|
|
</button>
|
|
|
|
|
|
</section>
|
|
|
|
<!-- Show menu on right side of page -->
|
|
<section
|
|
class="
|
|
ae_app__menu
|
|
hidden-print
|
|
flex flex-col
|
|
items-center
|
|
justify-end
|
|
gap-4
|
|
min-h-96
|
|
min-w-48
|
|
absolute right-0 bottom-10
|
|
bg-white dark:bg-gray-800
|
|
border border-gray-200 dark:border-gray-700
|
|
rounded-lg
|
|
p-2
|
|
opacity-50
|
|
hover:opacity-100
|
|
duration-100 delay-1000 hover:delay-100 hover:ease-out
|
|
transition hover:transition-all
|
|
"
|
|
class:hidden={!$ae_loc?.app_cfg?.show_element__menu}
|
|
>
|
|
|
|
<!-- {#if $ae_loc?.app_cfg?.show_element__cfg} -->
|
|
<span
|
|
class:hidden={!$ae_loc?.app_cfg?.show_element__cfg || !$ae_loc.edit_mode}
|
|
>
|
|
<Element_app_cfg
|
|
set_theme_mode={true}
|
|
set_theme_name={true}
|
|
/>
|
|
</span>
|
|
<!-- {/if} -->
|
|
|
|
{#if $ae_loc.app_cfg?.show_element__sign_in_out}
|
|
<Element_sign_in_out
|
|
data={data}
|
|
hidden={$ae_loc.iframe || !$ae_loc.app_cfg?.show_element__sign_in_out}
|
|
/>
|
|
{/if}
|
|
|
|
{#if $ae_loc.app_cfg?.show_element__access_type}
|
|
<Element_access_type
|
|
show_passcode_input={$ae_loc.app_cfg.show_element__passcode_input}
|
|
hidden={$ae_loc.iframe && !$ae_loc.trusted_access}
|
|
/>
|
|
{/if}
|
|
|
|
<button
|
|
type="button"
|
|
class="btn btn-sm variant-outline-surface hover:variant-ghost-warning *:hover:inline w-full px-6 py-1"
|
|
title="Sign In"
|
|
onclick={() => {
|
|
if ($ae_loc?.app_cfg?.show_element__menu_btn) {
|
|
$ae_loc.app_cfg.show_element__menu = true;
|
|
$ae_loc.app_cfg.show_element__menu_btn = false;
|
|
} else {
|
|
$ae_loc.app_cfg.show_element__menu = false;
|
|
$ae_loc.app_cfg.show_element__menu_btn = true;
|
|
}
|
|
// $ae_loc.app_cfg.show_element__menu_btn = !$ae_loc?.app_cfg?.show_element__menu_btn;
|
|
// $ae_loc.app_cfg.show_element__menu = !$ae_loc?.app_cfg?.show_element__menu;
|
|
}}
|
|
>
|
|
{#if $ae_loc?.app_cfg?.show_element__menu}
|
|
<CircleX class="mx-1 inline-block" />
|
|
<!-- <span class="hidden"> -->
|
|
Hide Menu
|
|
<!-- </span> -->
|
|
{:else}
|
|
<Menu class="mx-1 inline-block" />
|
|
<!-- <span class="hidden"> -->
|
|
Menu
|
|
<!-- </span> -->
|
|
{/if}
|
|
</button>
|
|
|
|
</section>
|
|
|
|
<div
|
|
class="absolute bottom-0 left-0 flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1 w-full outline"
|
|
class:ae_debug={$ae_loc.debug}
|
|
>
|
|
<!-- {#if $ae_loc.app_cfg?.show_element__sign_in_out}
|
|
<Element_sign_in_out
|
|
data={data}
|
|
hidden={$ae_loc.iframe || !$ae_loc.app_cfg?.show_element__sign_in_out}
|
|
/>
|
|
{/if} -->
|
|
|
|
<!-- <button
|
|
type="button"
|
|
onclick={() => {
|
|
console.log('Debug ae_loc:', $ae_loc);
|
|
$ae_loc.debug = !$ae_loc?.debug;
|
|
}}
|
|
id="AE-Quick-Debug"
|
|
class="ae_quick_debug btn btn-sm variant-glass-surface transition-all"
|
|
title="Turn debug content and styles off and on"
|
|
>
|
|
π
|
|
</button> -->
|
|
|
|
<!-- {#if $ae_loc.app_cfg?.show_element__access_type}
|
|
<Element_access_type
|
|
hidden={$ae_loc.iframe && !$ae_loc.trusted_access}
|
|
/>
|
|
{/if} -->
|
|
</div>
|
|
|
|
|
|
<style lang="postcss">
|
|
/* BEGIN: AE's Svelte Quick Debug component */
|
|
#AE-Quick-Debug {
|
|
/* position: absolute; */
|
|
position: fixed;
|
|
/* position: relative; */
|
|
/* position: static; */
|
|
/* position: sticky; */
|
|
/* top: 1em; */
|
|
bottom: 2rem;
|
|
left: 1rem;
|
|
|
|
padding: .0rem;
|
|
|
|
/* lightyellow */
|
|
/* background-color: hsla(60,100%,90%,.30); */
|
|
/* background-color: rgba(var(--color-surface-500) / .5); */
|
|
|
|
border: none;
|
|
|
|
border-top: solid thin hsla(0,0%,0%,.25);
|
|
border-left: solid thin hsla(0,0%,0%,.25);
|
|
border-bottom: solid thin hsla(0,0%,0%,.25);
|
|
/* border-top-left-radius: .5em; */
|
|
/* border-bottom-left-radius: .5em; */
|
|
|
|
opacity: .15;
|
|
/* opacity: 1; */
|
|
|
|
font-size: .75rem;
|
|
|
|
z-index: 15;
|
|
|
|
/* NOTE: transition when no longer hovering */
|
|
transition-property: opacity, background-color;
|
|
transition-delay: 1.25s;
|
|
transition-duration: .5s;
|
|
transition-timing-function: ease-out;
|
|
}
|
|
|
|
#AE-Quick-Debug:hover {
|
|
/* lightyellow */
|
|
/* background-color: hsla(60,100%,90%,.95); */
|
|
/* background-color: rgba(var(--color-surface-500) / 1); */
|
|
|
|
border-top: solid thin hsla(0,0%,0%,.95);
|
|
border-left: solid thin hsla(0,0%,0%,.95);
|
|
border-bottom: solid thin hsla(0,0%,0%,.95);
|
|
|
|
opacity: 1;
|
|
|
|
padding: .5rem;
|
|
|
|
font-size: 1.75rem;
|
|
/* Need to zoom 3.5 when hovering */
|
|
/* transform: scale(3.5); */
|
|
|
|
/* NOTE: transition when hover starts */
|
|
transition-property: opacity, background-color;
|
|
transition-delay: .5s;
|
|
transition-duration: .10s;
|
|
transition-timing-function: ease-in;
|
|
}
|
|
</style>
|