platform/plugins/chunter-resources/src/components/DmPresenter.svelte
Denis Bunakalya 2efc19044e
Chunter: Direct messages (#1472)
Signed-off-by: Denis Bunakalya <denis.bunakalya@xored.com>
2022-04-22 09:13:15 +06:00

41 lines
1.2 KiB
Svelte

<!--
// Copyright © 2022 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 type { DirectMessage } from '@anticrm/chunter'
import { getClient } from '@anticrm/presentation'
import { Icon } from '@anticrm/ui'
import { getSpaceLink, getDmName } from '../utils'
export let dm: DirectMessage
const client = getClient()
$: icon = client.getHierarchy().getClass(dm._class).icon
$: link = getSpaceLink(dm._id)
</script>
{#if dm}
{#await getDmName(client, dm) then name}
<a class="flex-presenter" href={link}>
<div class="icon">
{#if icon}
<Icon {icon} size={'small'} />
{/if}
</div>
<span class="label">{name}</span>
</a>
{/await}
{/if}