Add checkIsHeaderHidden func to Application model (#2690)

Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
This commit is contained in:
Denis Bunakalya 2023-02-27 11:59:03 +03:00 committed by GitHub
parent 2c1eea801e
commit a089cb9198
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -386,6 +386,12 @@
: 'account'
onMount(() => subscribeMobile(setTheme))
async function checkIsHeaderHidden () {
return (
currentApplication?.checkIsHeaderHidden && (await (await getResource(currentApplication.checkIsHeaderHidden))())
)
}
</script>
{#if employee?.active === true}
@ -487,7 +493,11 @@
{#if currentApplication}
<NavHeader label={currentApplication.label} />
{#if currentApplication.navHeaderComponent}
<Component is={currentApplication.navHeaderComponent} props={{ currentSpace }} shrink />
{#await checkIsHeaderHidden() then isHidden}
{#if !isHidden}
<Component is={currentApplication.navHeaderComponent} props={{ currentSpace }} shrink />
{/if}
{/await}
{/if}
{/if}
<Navigator

View File

@ -35,6 +35,7 @@ export interface Application extends Doc {
component?: AnyComponent
navHeaderComponent?: AnyComponent
checkIsHeaderHidden?: Resource<() => Promise<boolean>>
navFooterComponent?: AnyComponent
}