mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
parent
aa09fa62c9
commit
a4a756d3c2
@ -14,7 +14,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Ref, Space } from '@hcengineering/core'
|
||||
import { MultipleDraftController, getClient } from '@hcengineering/presentation'
|
||||
import { MultipleDraftController } from '@hcengineering/presentation'
|
||||
import { Button, IconAdd, showPopup } from '@hcengineering/ui'
|
||||
import { onDestroy } from 'svelte'
|
||||
import tracker from '../plugin'
|
||||
@ -22,11 +22,7 @@
|
||||
|
||||
export let currentSpace: Ref<Space> | undefined
|
||||
|
||||
const client = getClient()
|
||||
|
||||
let space: Ref<Space> | undefined
|
||||
let closed = true
|
||||
$: updateSpace(currentSpace)
|
||||
|
||||
let draftExists = false
|
||||
|
||||
@ -36,24 +32,9 @@
|
||||
draftExists = res
|
||||
})
|
||||
)
|
||||
|
||||
async function updateSpace (spaceId: Ref<Space> | undefined): Promise<void> {
|
||||
if (spaceId !== undefined) {
|
||||
space = spaceId
|
||||
return
|
||||
}
|
||||
|
||||
const project = await client.findOne(tracker.class.Project, {})
|
||||
space = project?._id
|
||||
}
|
||||
|
||||
async function newIssue (): Promise<void> {
|
||||
if (!space) {
|
||||
const project = await client.findOne(tracker.class.Project, {})
|
||||
space = project?._id
|
||||
}
|
||||
closed = false
|
||||
showPopup(CreateIssue, { space, shouldSaveDraft: true }, 'top', () => {
|
||||
showPopup(CreateIssue, { space: currentSpace, shouldSaveDraft: true }, 'top', () => {
|
||||
closed = true
|
||||
})
|
||||
}
|
||||
|
@ -500,13 +500,13 @@
|
||||
|
||||
onMount(() => subscribeMobile(setTheme))
|
||||
|
||||
async function checkIsHeaderHidden () {
|
||||
async function checkIsHeaderHidden (currentApplication: Application | undefined) {
|
||||
return (
|
||||
currentApplication?.checkIsHeaderHidden && (await (await getResource(currentApplication.checkIsHeaderHidden))())
|
||||
)
|
||||
}
|
||||
|
||||
async function checkIsHeaderDisabled () {
|
||||
async function checkIsHeaderDisabled (currentApplication: Application | undefined) {
|
||||
return (
|
||||
currentApplication?.checkIsHeaderDisabled &&
|
||||
(await (
|
||||
@ -644,9 +644,9 @@
|
||||
{#if currentApplication}
|
||||
<NavHeader label={currentApplication.label} />
|
||||
{#if currentApplication.navHeaderComponent}
|
||||
{#await checkIsHeaderHidden() then isHidden}
|
||||
{#await checkIsHeaderHidden(currentApplication) then isHidden}
|
||||
{#if !isHidden}
|
||||
{#await checkIsHeaderDisabled() then disabled}
|
||||
{#await checkIsHeaderDisabled(currentApplication) then disabled}
|
||||
<Component is={currentApplication.navHeaderComponent} props={{ currentSpace, disabled }} shrink />
|
||||
{/await}
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user