Rework panel navigation (#928)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2022-02-04 10:03:24 +01:00
committed by GitHub
parent f2402c3208
commit db52006a9d
25 changed files with 430 additions and 201 deletions
@@ -14,17 +14,15 @@
// limitations under the License.
-->
<script lang="ts">
import type { AttachedData, Doc, Ref } from '@anticrm/core'
import type { IntlString, Asset } from '@anticrm/platform'
import type { Channel, ChannelProvider } from '@anticrm/contact'
import { getClient } from '..'
import type { AttachedData, Doc, Ref } from '@anticrm/core'
import type { Asset, IntlString } from '@anticrm/platform'
import type { AnyComponent } from '@anticrm/ui'
import { Tooltip, CircleButton } from '@anticrm/ui'
import ChannelsPopup from './ChannelsPopup.svelte'
import contact from '@anticrm/contact'
import { CircleButton, Tooltip } from '@anticrm/ui'
import { createEventDispatcher } from 'svelte'
import { getClient } from '..'
import { getChannelProviders } from '../utils'
import ChannelsPopup from './ChannelsPopup.svelte'
export let value: AttachedData<Channel>[] | AttachedData<Channel> | null
export let size: 'small' | 'medium' | 'large' | 'x-large' = 'large'
@@ -42,15 +40,6 @@
const client = getClient()
const dispatch = createEventDispatcher()
async function getProviders (): Promise<Map<Ref<ChannelProvider>, ChannelProvider>> {
const providers = await client.findAll(contact.class.ChannelProvider, {})
const map = new Map<Ref<ChannelProvider>, ChannelProvider>()
for (const provider of providers) {
map.set(provider._id, provider)
}
return map
}
function getProvider (item: AttachedData<Channel>, map: Map<Ref<ChannelProvider>, ChannelProvider>): any | undefined {
const provider = map.get(item.provider)
if (provider) {
@@ -68,7 +57,7 @@
async function update (value: AttachedData<Channel>[] | AttachedData<Channel>) {
const result = []
const map = await getProviders()
const map = await getChannelProviders()
if (Array.isArray(value)) {
for (const item of value) {
const provider = getProvider(item, map)