mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-26 11:34:58 +02:00
* Return spaces to card navigator Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix formatting Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> --------- Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
60 lines
1.9 KiB
Svelte
60 lines
1.9 KiB
Svelte
<!--
|
|
// Copyright © 2025 Hardcore Engineering Inc.
|
|
//
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License. You may
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
//
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
-->
|
|
<script lang="ts">
|
|
import { MasterTag } from '@hcengineering/card'
|
|
import { Class, Doc, Ref, Space } from '@hcengineering/core'
|
|
import { IntlString } from '@hcengineering/platform'
|
|
import { createQuery } from '@hcengineering/presentation'
|
|
import { location } from '@hcengineering/ui'
|
|
import { SpecialView } from '@hcengineering/workbench-resources'
|
|
import { onDestroy } from 'svelte'
|
|
import card from '../plugin'
|
|
|
|
let _class: Ref<Class<Doc>> | undefined
|
|
let space: Ref<Space> | undefined
|
|
|
|
onDestroy(
|
|
location.subscribe((loc) => {
|
|
space = loc.path[3] === 'type' ? undefined : loc.path[3]
|
|
_class = loc.path[4]
|
|
})
|
|
)
|
|
|
|
let allClasses: MasterTag[] = []
|
|
|
|
const query = createQuery()
|
|
query.query(card.class.MasterTag, {}, (res) => {
|
|
allClasses = res.filter((it) => it.removed !== true)
|
|
})
|
|
|
|
$: clazz = allClasses.find((it) => it._id === _class) ?? allClasses.find((it) => it._id === card.class.Card)
|
|
|
|
$: label = getLabel(clazz)
|
|
|
|
function getLabel (clazz: MasterTag | undefined): IntlString | undefined {
|
|
return clazz?.label
|
|
}
|
|
</script>
|
|
|
|
{#if clazz !== undefined && label !== undefined}
|
|
<SpecialView
|
|
_class={clazz._id}
|
|
baseQuery={space !== undefined ? { space } : {}}
|
|
{space}
|
|
{label}
|
|
icon={clazz.icon ?? card.icon.Card}
|
|
/>
|
|
{/if}
|