fix fill height for deployed apps

This commit is contained in:
Ruben Fiszel
2024-08-08 23:23:03 +02:00
parent 51c84681c0
commit a135cd3bd8
5 changed files with 278 additions and 9 deletions
@@ -66,11 +66,6 @@
author: policy.on_behalf_of_email
}
function hashchange(e: HashChangeEvent) {
ncontext.hash = e.newURL.split('#')[1]
ncontext = ncontext
}
function resizeWindow() {
!isEditor && ($breakpoint = window.innerWidth < 769 ? 'sm' : 'lg')
}
@@ -84,8 +79,31 @@
let parentContext = getContext<AppViewerContext>('AppViewerContext')
let worldStore = buildWorld(ncontext)
$: onContextChange(context)
function onContextChange(context: any) {
Object.assign(ncontext, context)
ncontext = ncontext
worldStore.update((x) => {
Object.entries(context).forEach(([key, value]) => {
x.outputsById?.['ctx']?.[key].set(value, true)
})
return x
})
}
function hashchange(e: HashChangeEvent) {
ncontext.hash = e.newURL.split('#')[1]
ncontext = ncontext
worldStore.update((x) => {
x.outputsById?.['ctx']?.['hash'].set(ncontext.hash, true)
return x
})
}
setContext<AppViewerContext>('AppViewerContext', {
worldStore: buildWorld(ncontext),
worldStore: worldStore,
initialized: writable({ initialized: false, initializedComponents: [] }),
app: appStore,
summary: writable(summary),
@@ -196,7 +214,7 @@
<svelte:window on:hashchange={hashchange} on:resize={resizeWindow} />
<div class="relative h-full" bind:clientHeight={appHeight}>
<div class="relative h-full grow" bind:clientHeight={appHeight}>
<div id="app-editor-top-level-drawer" />
<div id="app-editor-select" />
@@ -39,7 +39,7 @@
{#key app}
<div
class={twMerge(
'min-h-screen h-full w-full',
'min-h-screen h-full w-full flex flex-col',
app?.value.css?.['app']?.['viewer']?.class,
'wm-app-viewer'
)}