mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-04 23:04:47 +00:00
Move doc panel in chat to right side (#4415)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
parent
181f1bdefd
commit
04b3103372
@ -63,6 +63,6 @@
|
|||||||
<ThreadViewPanel _id={threadId} on:close />
|
<ThreadViewPanel _id={threadId} on:close />
|
||||||
{:else if object}
|
{:else if object}
|
||||||
<div class="antiComponent">
|
<div class="antiComponent">
|
||||||
<ChannelPresenter {object} {context} allowClose on:close />
|
<ChannelPresenter {object} {context} embedded allowClose on:close />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -14,34 +14,54 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Ref, Doc } from '@hcengineering/core'
|
import { Ref, Doc } from '@hcengineering/core'
|
||||||
import { getLocation, navigate } from '@hcengineering/ui'
|
import { defineSeparators, location as locationStore, panelSeparators, Separator } from '@hcengineering/ui'
|
||||||
import { DocNotifyContext } from '@hcengineering/notification'
|
import { DocNotifyContext } from '@hcengineering/notification'
|
||||||
import activity, { ActivityMessage, ActivityMessagesFilter } from '@hcengineering/activity'
|
import activity, { ActivityMessagesFilter } from '@hcengineering/activity'
|
||||||
import { ChatMessage } from '@hcengineering/chunter'
|
import { getClient } from '@hcengineering/presentation'
|
||||||
|
|
||||||
import Channel from './Channel.svelte'
|
import Channel from './Channel.svelte'
|
||||||
import PinnedMessages from './PinnedMessages.svelte'
|
import PinnedMessages from './PinnedMessages.svelte'
|
||||||
import ChannelHeader from './ChannelHeader.svelte'
|
import ChannelHeader from './ChannelHeader.svelte'
|
||||||
|
import DocChatPanel from './chat/DocChatPanel.svelte'
|
||||||
|
import chunter from '../plugin'
|
||||||
|
|
||||||
export let context: DocNotifyContext
|
export let context: DocNotifyContext
|
||||||
export let object: Doc
|
export let object: Doc
|
||||||
export let filterId: Ref<ActivityMessagesFilter> = activity.ids.AllFilter
|
export let filterId: Ref<ActivityMessagesFilter> = activity.ids.AllFilter
|
||||||
export let allowClose = false
|
export let allowClose = false
|
||||||
|
export let embedded = false
|
||||||
|
|
||||||
function openThread (_id: Ref<ChatMessage>) {
|
const client = getClient()
|
||||||
const loc = getLocation()
|
const hierarchy = client.getHierarchy()
|
||||||
loc.path[4] = _id
|
|
||||||
navigate(loc)
|
let isThreadOpened = false
|
||||||
}
|
|
||||||
|
$: isDocChat = !hierarchy.isDerived(object._class, chunter.class.ChunterSpace)
|
||||||
|
$: asideShown = !embedded && isDocChat && !isThreadOpened
|
||||||
|
|
||||||
|
locationStore.subscribe((newLocation) => {
|
||||||
|
isThreadOpened = newLocation.path[4] != null
|
||||||
|
})
|
||||||
|
|
||||||
|
defineSeparators('aside', panelSeparators)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ChannelHeader {object} {allowClose} on:close />
|
<div class="popupPanel panel" class:embedded>
|
||||||
<PinnedMessages {context} />
|
<ChannelHeader {object} {allowClose} on:close />
|
||||||
<Channel
|
<div class="popupPanel-body" class:asideShown>
|
||||||
{context}
|
<div class="popupPanel-body__main">
|
||||||
{object}
|
<PinnedMessages {context} />
|
||||||
{filterId}
|
<Channel {context} {object} {filterId} />
|
||||||
on:openThread={(e) => {
|
</div>
|
||||||
openThread(e.detail)
|
|
||||||
}}
|
{#if asideShown}
|
||||||
/>
|
<Separator name="aside" float={false} index={0} />
|
||||||
|
<div class="popupPanel-body__aside" class:float={false} class:shown={asideShown}>
|
||||||
|
<Separator name="aside" float index={0} />
|
||||||
|
<div class="antiPanel-wrap__content">
|
||||||
|
<DocChatPanel {object} {filterId} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@ -69,11 +69,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defineSeparators('chat', [
|
|
||||||
{ minSize: 20, maxSize: 40, size: 30, float: 'navigator' },
|
|
||||||
{ size: 'auto', minSize: 30, maxSize: 'auto', float: undefined }
|
|
||||||
])
|
|
||||||
|
|
||||||
$: selectedContextId &&
|
$: selectedContextId &&
|
||||||
notifyContextQuery.query(
|
notifyContextQuery.query(
|
||||||
notification.class.DocNotifyContext,
|
notification.class.DocNotifyContext,
|
||||||
@ -88,9 +83,10 @@
|
|||||||
object = res[0]
|
object = res[0]
|
||||||
})
|
})
|
||||||
|
|
||||||
$: isDocChatOpened =
|
defineSeparators('chat', [
|
||||||
selectedContext !== undefined &&
|
{ minSize: 20, maxSize: 40, size: 30, float: 'navigator' },
|
||||||
![chunter.class.Channel, chunter.class.DirectMessage].includes(selectedContext.attachedToClass)
|
{ size: 'auto', minSize: 30, maxSize: 'auto', float: undefined }
|
||||||
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex-row-top h-full">
|
<div class="flex-row-top h-full">
|
||||||
@ -101,12 +97,8 @@
|
|||||||
: 'landscape'} background-comp-header-color"
|
: 'landscape'} background-comp-header-color"
|
||||||
>
|
>
|
||||||
<div class="antiPanel-wrap__content">
|
<div class="antiPanel-wrap__content">
|
||||||
{#if !isDocChatOpened}
|
<NavHeader label={chunter.string.Chat} />
|
||||||
<NavHeader label={chunter.string.Chat} />
|
<ChatNavigator {selectedContextId} {currentSpecial} />
|
||||||
<ChatNavigator {selectedContextId} {currentSpecial} />
|
|
||||||
{:else if object}
|
|
||||||
<DocChatPanel {object} {filterId} />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
<Separator name="chat" float={navFloat ? 'navigator' : true} index={0} />
|
<Separator name="chat" float={navFloat ? 'navigator' : true} index={0} />
|
||||||
</div>
|
</div>
|
||||||
@ -132,8 +124,7 @@
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{:else if selectedContext && object}
|
||||||
{#if selectedContext && object}
|
|
||||||
{#key selectedContext._id}
|
{#key selectedContext._id}
|
||||||
<ChannelView context={selectedContext} {object} {filterId} />
|
<ChannelView context={selectedContext} {object} {filterId} />
|
||||||
{/key}
|
{/key}
|
||||||
|
@ -78,57 +78,55 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="popupPanel panel">
|
<div class="actions">
|
||||||
<div class="actions">
|
<ActionIcon
|
||||||
<ActionIcon
|
icon={view.icon.Open}
|
||||||
icon={view.icon.Open}
|
size="medium"
|
||||||
size="medium"
|
action={() => {
|
||||||
action={() => {
|
openDoc(client.getHierarchy(), object)
|
||||||
openDoc(client.getHierarchy(), object)
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div class="identifier">
|
<div class="identifier">
|
||||||
<Label label={clazz.label} />
|
<Label label={clazz.label} />
|
||||||
{#if linkTitle}
|
{#if linkTitle}
|
||||||
•
|
•
|
||||||
<DocNavLink {object}>
|
<DocNavLink {object}>
|
||||||
{linkTitle}
|
{linkTitle}
|
||||||
</DocNavLink>
|
</DocNavLink>
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{#if objectChatPanel}
|
|
||||||
{#await getResource(objectChatPanel.titleProvider) then getTitle}
|
|
||||||
<div class="title overflow-label">
|
|
||||||
{getTitle(object)}
|
|
||||||
</div>
|
|
||||||
{/await}
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
{#if objectChatPanel}
|
||||||
<DocAttributeBar {object} {mixins} ignoreKeys={objectChatPanel?.ignoreKeys ?? []} showHeader={false} />
|
{#await getResource(objectChatPanel.titleProvider) then getTitle}
|
||||||
|
<div class="title overflow-label">
|
||||||
{#each filters as filter}
|
{getTitle(object)}
|
||||||
{#key filter._id}
|
</div>
|
||||||
{#await getMessagesCount(filter, activityMessages) then count}
|
{/await}
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
{/if}
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
||||||
{#if filter._id === activity.ids.AllFilter || count > 0}
|
|
||||||
<div
|
|
||||||
on:click={() => {
|
|
||||||
handleFilterSelected(filter)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SpecialElement label={filter.label} selected={filterId === filter._id} notifications={count} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{/await}
|
|
||||||
{/key}
|
|
||||||
{/each}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<DocAttributeBar {object} {mixins} ignoreKeys={objectChatPanel?.ignoreKeys ?? []} showHeader={false} />
|
||||||
|
|
||||||
|
{#each filters as filter}
|
||||||
|
{#key filter._id}
|
||||||
|
{#await getMessagesCount(filter, activityMessages) then count}
|
||||||
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
|
{#if filter._id === activity.ids.AllFilter || count > 0}
|
||||||
|
<div
|
||||||
|
on:click={() => {
|
||||||
|
handleFilterSelected(filter)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SpecialElement label={filter.label} selected={filterId === filter._id} notifications={count} />
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/await}
|
||||||
|
{/key}
|
||||||
|
{/each}
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
Loading…
Reference in New Issue
Block a user