Cleaning layout related...
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
let log_lvl: number = 2;
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
interface Props {
|
||||
/** @type {import('./$types').LayoutData} */
|
||||
data: any;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
interface Props {
|
||||
/** @type {import('./$types').LayoutData} */
|
||||
data: any;
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let log_lvl: number = 0;
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
$ae_loc.url_origin = data.url.origin;
|
||||
$ae_loc.params = data.params;
|
||||
@@ -123,83 +127,76 @@ if (browser) {
|
||||
|
||||
}
|
||||
|
||||
let iframe = data.url.searchParams.get('iframe');
|
||||
if (browser && iframe == 'true') {
|
||||
console.log('Use iframe layout!');
|
||||
// data_struct['iframe'] = iframe;
|
||||
$ae_loc.iframe = true;
|
||||
// let iframe = data.url.searchParams.get('iframe');
|
||||
// if (browser && iframe == 'true') {
|
||||
// console.log('Use iframe layout!');
|
||||
// // data_struct['iframe'] = iframe;
|
||||
// $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');
|
||||
// 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 (browser && iframe == 'false') {
|
||||
// data_struct['iframe'] = false;
|
||||
$ae_loc.iframe = false;
|
||||
// // $ae_loc.app_cfg.show_element__access_type = false;
|
||||
// // $ae_loc.app_cfg.show_element__cfg = false;
|
||||
// } else if (browser && iframe == 'false') {
|
||||
// // data_struct['iframe'] = false;
|
||||
// $ae_loc.iframe = false;
|
||||
|
||||
document.getElementsByTagName('html')[0].classList.remove('iframe');
|
||||
// document.getElementsByTagName('html')[0].classList.add('light');
|
||||
}
|
||||
// document.getElementsByTagName('html')[0].classList.remove('iframe');
|
||||
// // document.getElementsByTagName('html')[0].classList.add('light');
|
||||
// }
|
||||
|
||||
|
||||
run(() => {
|
||||
if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) {
|
||||
if (log_lvl > 1) {
|
||||
console.log('Getting new dimensions for iframe with modal:', $ae_loc.iframe_height, $ae_loc.iframe_height_modal_body);
|
||||
}
|
||||
// $effect(() => {
|
||||
// if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) {
|
||||
// if (log_lvl > 1) {
|
||||
// console.log('Getting new dimensions for iframe with modal:', $ae_loc.iframe_height, $ae_loc.iframe_height_modal_body);
|
||||
// }
|
||||
|
||||
let iframe_height = 0;
|
||||
// let iframe_height = 0;
|
||||
|
||||
if ($ae_loc.iframe_height > $ae_loc.iframe_height_modal_body) {
|
||||
iframe_height = $ae_loc.iframe_height;
|
||||
} else {
|
||||
iframe_height = $ae_loc.iframe_height_modal_body;
|
||||
// if ($ae_loc.iframe_height > $ae_loc.iframe_height_modal_body) {
|
||||
// iframe_height = $ae_loc.iframe_height;
|
||||
// } else {
|
||||
// iframe_height = $ae_loc.iframe_height_modal_body;
|
||||
|
||||
// console.log($ae_loc.modal_dimensions);
|
||||
// // console.log($ae_loc.modal_dimensions);
|
||||
|
||||
if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.header_height) {
|
||||
iframe_height = iframe_height + $ae_loc.modal_dimensions.header_height;
|
||||
}
|
||||
if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.footer_height) {
|
||||
iframe_height = iframe_height + $ae_loc.modal_dimensions.footer_height;
|
||||
}
|
||||
// iframe_height = iframe_height + 50; // Just in case
|
||||
}
|
||||
// if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.header_height) {
|
||||
// iframe_height = iframe_height + $ae_loc.modal_dimensions.header_height;
|
||||
// }
|
||||
// if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.footer_height) {
|
||||
// iframe_height = iframe_height + $ae_loc.modal_dimensions.footer_height;
|
||||
// }
|
||||
// // iframe_height = iframe_height + 50; // Just in case
|
||||
// }
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Suggested new iframe_height with modal: ${iframe_height}`);
|
||||
}
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_loc.iframe && $ae_loc.iframe_height) {
|
||||
if (log_lvl > 1) {
|
||||
console.log('Suggested new iframe_height:', $ae_loc.iframe_height);
|
||||
}
|
||||
window.parent.postMessage({'iframe_height': $ae_loc.iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
});
|
||||
// if (log_lvl > 1) {
|
||||
// console.log(`Suggested new iframe_height with modal: ${iframe_height}`);
|
||||
// }
|
||||
// window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
// } else if ($ae_loc.iframe && $ae_loc.iframe_height) {
|
||||
// if (log_lvl > 1) {
|
||||
// console.log('Suggested new iframe_height:', $ae_loc.iframe_height);
|
||||
// }
|
||||
// window.parent.postMessage({'iframe_height': $ae_loc.iframe_height}, "*"); // This should be in pixels
|
||||
// }
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<svelte:head>
|
||||
<title>{$ae_loc.title ?? 'Æ loading...'}</title>
|
||||
{#if $ae_loc.iframe}
|
||||
<!-- <meta name="robots" content="noindex, nofollow" /> -->
|
||||
<link href="https://assets-staging.noviams.com/novi-core-assets/css/fontawesome.css" rel="stylesheet" />
|
||||
<link href="https://assets-staging.noviams.com/novi-core-assets/css/c/idaa/idaa.css" rel="stylesheet" />
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
||||
|
||||
|
||||
{#if (browser && ($ae_loc.trusted_access || ($ae_loc.authenticated_access && $idaa_loc.novi_uuid)))}
|
||||
|
||||
<div
|
||||
<!-- <div
|
||||
bind:clientHeight={$ae_loc.iframe_height}
|
||||
>
|
||||
> -->
|
||||
{@render children?.()}
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
{#if $idaa_loc.novi_uuid}
|
||||
<span class="text-sm text-gray-500">
|
||||
Novi: <span class="fas fa-user m-1"></span>
|
||||
|
||||
Reference in New Issue
Block a user