mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-22 09:35:00 +02:00
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
96 lines
2.8 KiB
Svelte
96 lines
2.8 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 { Channel } from '@anticrm/chunter'
|
|
import type { Class, Ref } from '@anticrm/core'
|
|
import type { IntlString } from '@anticrm/platform'
|
|
import { createQuery, getClient, Members } from '@anticrm/presentation'
|
|
import { Icon, IconClose, Label, ActionIcon, Scroller } from '@anticrm/ui'
|
|
import { createEventDispatcher } from 'svelte'
|
|
|
|
import chunter from '../plugin'
|
|
import EditChannelDescriptionTab from './EditChannelDescriptionTab.svelte'
|
|
import EditChannelSettingsTab from './EditChannelSettingsTab.svelte'
|
|
|
|
export let _id: Ref<Channel>
|
|
export let _class: Ref<Class<Channel>>
|
|
|
|
let channel: Channel | undefined
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
const client = getClient()
|
|
const clazz = client.getHierarchy().getClass(_class)
|
|
|
|
const query = createQuery()
|
|
$: query.query(chunter.class.Channel, { _id }, (result) => {
|
|
channel = result[0]
|
|
})
|
|
|
|
const tabLabels: IntlString[] = [chunter.string.Channel, chunter.string.Members, chunter.string.Settings]
|
|
let selectedTabIndex = 0
|
|
</script>
|
|
|
|
<div
|
|
on:click={() => {
|
|
dispatch('close')
|
|
}}
|
|
/>
|
|
<div class="antiDialogs antiComponent">
|
|
<div class="ac-header short mirror divide">
|
|
<div class="ac-header__wrap-title">
|
|
<div class="ac-header__icon">
|
|
{#if clazz.icon}<Icon icon={clazz.icon} size={'medium'} />{/if}
|
|
</div>
|
|
<div class="ac-header__title"><Label label={clazz.label} /></div>
|
|
</div>
|
|
<div class="tool">
|
|
<ActionIcon
|
|
icon={IconClose}
|
|
size={'small'}
|
|
action={() => {
|
|
dispatch('close')
|
|
}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="ac-tabs">
|
|
{#each tabLabels as tabLabel, i}
|
|
<div
|
|
class="ac-tabs__tab"
|
|
class:selected={i === selectedTabIndex}
|
|
on:click={() => {
|
|
selectedTabIndex = i
|
|
}}
|
|
>
|
|
<Label label={tabLabel} />
|
|
</div>
|
|
{/each}
|
|
<div class="ac-tabs__empty" />
|
|
</div>
|
|
{#if channel}
|
|
{#if selectedTabIndex === 0}
|
|
<Scroller padding>
|
|
<EditChannelDescriptionTab {channel} on:close />
|
|
</Scroller>
|
|
{:else if selectedTabIndex === 1}
|
|
<Members space={channel} />
|
|
{:else if selectedTabIndex === 2}
|
|
<EditChannelSettingsTab {channel} on:close />
|
|
{/if}
|
|
{/if}
|
|
</div>
|