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