Inbox and chat fixes (#6803)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-10-03 21:03:47 +04:00 committed by GitHub
parent d3a7759ef7
commit b5f6a83ce6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 201 additions and 7 deletions

View File

@ -388,7 +388,7 @@ export function createModel (builder: Builder): void {
core.space.Model,
{
label: notification.string.Inbox,
icon: notification.icon.Inbox,
icon: notification.icon.Notifications,
alias: notificationId,
hidden: true,
locationResolver: notification.resolver.Location,

View File

@ -0,0 +1,26 @@
<!--
// Copyright © 2024 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 { markupToJSON } from '@hcengineering/text'
import LiteNode from './markup/lite/LiteNode.svelte'
export let message: string
$: node = markupToJSON(message)
</script>
<div class="text-markup-view">
<LiteNode {node} />
</div>

View File

@ -0,0 +1,30 @@
<!--
// Copyright © 2024 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 { MarkupNode } from '@hcengineering/text'
import LiteNodeContent from './LiteNodeContent.svelte'
import NodeMarks from '../NodeMarks.svelte'
export let node: MarkupNode
</script>
{#if node}
{@const marks = node.marks ?? []}
<NodeMarks {marks}>
<LiteNodeContent {node} />
</NodeMarks>
{/if}

View File

@ -0,0 +1,105 @@
<!--
// Copyright © 2024 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 { Class, Doc, Ref } from '@hcengineering/core'
import { AttrValue, MarkupNode, MarkupNodeType, MarkupMarkType } from '@hcengineering/text'
import LiteNodes from './LiteNodes.svelte'
import ObjectNode from '../ObjectNode.svelte'
import NodeMarks from '../NodeMarks.svelte'
export let node: MarkupNode
function toRef (objectId: string): Ref<Doc> {
return objectId as Ref<Doc>
}
function toClassRef (objectClass: string): Ref<Class<Doc>> {
if (objectClass === 'contact:class:Employee') {
return 'contact:mixin:Employee' as Ref<Class<Doc>>
}
return objectClass as Ref<Class<Doc>>
}
function toString (value: AttrValue | undefined): string | undefined {
return value !== undefined ? `${value}` : undefined
}
function toNumber (value: AttrValue | undefined): number | undefined {
if (typeof value === 'boolean') {
return value ? 1 : 0
}
return value !== undefined ? (typeof value === 'string' ? parseInt(value) : value) : undefined
}
</script>
{#if node}
{@const attrs = node.attrs ?? {}}
{@const nodes = node.content ?? []}
{#if node.type === MarkupNodeType.doc}
<LiteNodes {nodes} />
{:else if node.type === MarkupNodeType.text}
{node.text}
{:else if node.type === MarkupNodeType.paragraph}
<p class="p-inline contrast" class:overflow-label={true} style:margin="0">
<LiteNodes {nodes} />
</p>
{:else if node.type === MarkupNodeType.blockquote}
<LiteNodes {nodes} />
{:else if node.type === MarkupNodeType.horizontal_rule}
<!-- nothing-->
{:else if node.type === MarkupNodeType.heading}
{@const level = toNumber(node.attrs?.level) ?? 1}
{@const element = `h${level}`}
<svelte:element this={element}>
<LiteNodes {nodes} />
</svelte:element>
{:else if node.type === MarkupNodeType.code_block}
<p class="p-inline contrast" class:overflow-label={true} style:margin="0">
<NodeMarks
marks={[
{
type: MarkupMarkType.code,
attrs: {}
}
]}
>
<LiteNodes {nodes} />
</NodeMarks>
</p>
{:else if node.type === MarkupNodeType.reference}
{@const objectId = toString(attrs.id)}
{@const objectClass = toString(attrs.objectclass)}
{@const objectLabel = toString(attrs.label)}
{#if objectClass !== undefined && objectId !== undefined}
<ObjectNode _id={toRef(objectId)} _class={toClassRef(objectClass)} title={objectLabel} />
{:else}
<LiteNodes {nodes} />
{/if}
{:else if node.type === MarkupNodeType.taskList}
<!-- TODO not implemented -->
{:else if node.type === MarkupNodeType.taskItem}
<!-- TODO not implemented -->
{:else if node.type === MarkupNodeType.subLink}
<sub>
<LiteNodes {nodes} />
</sub>
{:else}
<LiteNodes {nodes} />
{/if}
{/if}

View File

@ -0,0 +1,27 @@
<!--
// Copyright © 2024 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 { MarkupNode } from '@hcengineering/text'
import LiteNode from './LiteNode.svelte'
export let nodes: MarkupNode[]
</script>
{#if nodes}
{#each nodes as node}
<LiteNode {node} />
{/each}
{/if}

View File

@ -47,6 +47,7 @@ export { default as BreadcrumbsElement } from './components/breadcrumbs/Breadcru
export { default as ComponentExtensions } from './components/extensions/ComponentExtensions.svelte'
export { default as DocCreateExtComponent } from './components/extensions/DocCreateExtComponent.svelte'
export { default as SearchResult } from './components/SearchResult.svelte'
export { default as LiteMessageViewer } from './components/LiteMessageViewer.svelte'
export { default as DownloadFileButton } from './components/DownloadFileButton.svelte'
export { default as FileTypeIcon } from './components/FileTypeIcon.svelte'
export { default } from './plugin'

View File

@ -108,7 +108,7 @@ li {
}
p {
user-select: text;
user-select:inherit;
a {
word-break: break-all;

View File

@ -166,7 +166,7 @@ export const settingsSeparators: DefSeparators = [
export const mainSeparators: DefSeparators = [
{ minSize: 30, size: 'auto', maxSize: 'auto' },
{ minSize: 20, size: 30, maxSize: 45, float: 'sidebar' }
{ minSize: 20, size: 30, maxSize: 80, float: 'sidebar' }
]
export const secondNavSeparators: DefSeparators = [{ minSize: 7, size: 7.5, maxSize: 15, float: 'navigator' }, null]

View File

@ -14,7 +14,7 @@
-->
<script lang="ts">
import { getClient, MessageViewer } from '@hcengineering/presentation'
import { getClient, LiteMessageViewer } from '@hcengineering/presentation'
import { Person, type PersonAccount } from '@hcengineering/contact'
import {
Avatar,
@ -150,7 +150,7 @@
<Label label={intlLabel} />
{/if}
{#if text}
<MessageViewer message={text} preview />
<LiteMessageViewer message={text} />
{/if}
</span>
{/if}

View File

@ -289,6 +289,7 @@
border: 1px solid transparent;
border-radius: 0.25rem;
width: 100%;
user-select: text;
&.clickable {
cursor: pointer;

View File

@ -95,10 +95,12 @@
}
let objectChatPanel: ObjectChatPanel | undefined
let prevObjectId: Ref<Doc> | undefined = undefined
$: if (object._id) {
$: if (prevObjectId !== object._id) {
prevObjectId = object._id
objectChatPanel = hierarchy.classHierarchyMixin(object._class, chunter.mixin.ObjectChatPanel)
isAsideShown = objectChatPanel?.openByDefault === true
isAsideShown = isAsideShown ?? objectChatPanel?.openByDefault === true
}
</script>

View File

@ -354,6 +354,8 @@
.notification {
position: relative;
cursor: pointer;
user-select: none;
.embeddedMarker {
position: absolute;