From 33db59a5e2d8888605787dd62a0756b8a7a06690 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Thu, 6 Apr 2023 19:34:14 +0300 Subject: [PATCH] TSK-1069. Displaying a Mention, as well as a Comment. Fixed MessageViewer. (#2915) Signed-off-by: Alexander Platov --- .../src/components/message/Nodes.svelte | 19 ++++- packages/theme/styles/_colors.scss | 2 + packages/theme/styles/_layouts.scss | 6 +- packages/theme/styles/global.scss | 6 -- packages/theme/styles/panel.scss | 1 + .../src/components/TxView.svelte | 30 ++++---- .../src/components/Inbox.svelte | 2 +- .../src/components/NotificationView.svelte | 71 ++++++++++--------- .../issues/NotificationIssuePresenter.svelte | 24 +++---- 9 files changed, 89 insertions(+), 72 deletions(-) diff --git a/packages/presentation/src/components/message/Nodes.svelte b/packages/presentation/src/components/message/Nodes.svelte index 5a6434468f..066f0a2a93 100644 --- a/packages/presentation/src/components/message/Nodes.svelte +++ b/packages/presentation/src/components/message/Nodes.svelte @@ -30,7 +30,7 @@ {:else if node.nodeName === 'P'} {#if node.childNodes.length > 0} -

+

{/if} @@ -138,4 +138,21 @@ .checkboxContainer { padding-top: 0.125rem; } + + em, + strong, + blockquote, + pre, + h1, + h2, + h3, + h4, + h5, + h6, + ol, + li, + .checkboxContainer, + s { + color: var(--theme-accent-color); + } diff --git a/packages/theme/styles/_colors.scss b/packages/theme/styles/_colors.scss index 3421fc2346..eb512bc0ac 100644 --- a/packages/theme/styles/_colors.scss +++ b/packages/theme/styles/_colors.scss @@ -74,6 +74,7 @@ --darker-color: rgba(255, 255, 255, .4); --dark-color: #62666d; --content-color: #8a8f98; + --theme-accent-color: rgba(255, 255, 255, .8); --accent-color: #d7d8db; --caption-color: #f7f8f8; --white-color: #fff; @@ -157,6 +158,7 @@ --dark-color: #90959d; --content-color: #3c4149; --accent-color: #282a30; + --theme-accent-color: rgba(0, 0, 0, .8); --caption-color: #131416; --white-color: #fff; --caret-color: #6e5ed2; diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index edb5d0dc1e..de26879501 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -113,7 +113,9 @@ p:last-child { margin-block-end: 0; } word-wrap: break-word; hyphens: auto; line-height: 150%; - color: var(--content-color); + + &.contrast { color: var(--theme-accent-color); } + &:not(.contrast) { color: var(--content-color); } a { word-break: break-all; @@ -378,7 +380,7 @@ input.search { .bold { font-weight: 500; - color: var(--caption-color); + color: var(--theme-accent-color); } .strong { color: var(--accent-color); } .lower { text-transform: lowercase; } diff --git a/packages/theme/styles/global.scss b/packages/theme/styles/global.scss index 01f4b68085..1c238733fc 100644 --- a/packages/theme/styles/global.scss +++ b/packages/theme/styles/global.scss @@ -126,9 +126,3 @@ body { overflow: hidden; touch-action: none; } - -// TSK-1026. Experiment, don't forget to delete. -.theme-dark .p-activity .msgactivity-content.comment .msgactivity-content__title.labels-row > .bold, -.theme-dark .p-activity .msgactivity-content.comment .activity-content.content .p-inline { color: rgba(255, 255, 255, .8); } -.theme-light .p-activity .msgactivity-content.comment .msgactivity-content__title.labels-row > .bold, -.theme-light .p-activity .msgactivity-content.comment .activity-content.content .p-inline { color: rgba(0, 0, 0, .8); } diff --git a/packages/theme/styles/panel.scss b/packages/theme/styles/panel.scss index af721a13e1..336b69b9ce 100644 --- a/packages/theme/styles/panel.scss +++ b/packages/theme/styles/panel.scss @@ -121,6 +121,7 @@ &:not(.embedded) { border-radius: 0 0 .5rem .5rem; } + &.embedded { border-left: none; } &.main { justify-content: stretch; diff --git a/plugins/activity-resources/src/components/TxView.svelte b/plugins/activity-resources/src/components/TxView.svelte index e2a14b3ffd..8b243eb04a 100644 --- a/plugins/activity-resources/src/components/TxView.svelte +++ b/plugins/activity-resources/src/components/TxView.svelte @@ -32,6 +32,7 @@ } from '@hcengineering/ui' import type { AttributeModel } from '@hcengineering/view' import attachment from '@hcengineering/attachment' + import chunter from '@hcengineering/chunter' import { Menu, ObjectPresenter } from '@hcengineering/view-resources' import { ActivityKey, DisplayTx } from '../activity' import activity from '../plugin' @@ -134,6 +135,9 @@ function isAttachment (_class?: Ref>): boolean { return _class === attachment.class.Attachment } + function isMention (_class?: Ref>): boolean { + return _class === chunter.class.Backlink + } async function updateMessageType (model: AttributeModel[], tx: DisplayTx): Promise { for (const m of model) { @@ -152,21 +156,17 @@ hasMessageType = res }) $: isComment = viewlet && viewlet?.editable - $: isAttach = isAttachment(tx.tx.objectClass) - $: isMention = viewlet?.display === 'emphasized' || isMessageType(model[0]?.attribute) - $: isColumn = isComment || isMention || hasMessageType + $: isAttached = isAttachment(tx.tx.objectClass) + $: isMentioned = isMention(tx.tx.objectClass) + $: withAvatar = isComment || isMentioned || isAttached + $: isEmphasized = viewlet?.display === 'emphasized' || model.every((m) => isMessageType(m.attribute)) + $: isColumn = isComment || isEmphasized || hasMessageType {#if (viewlet !== undefined && !((viewlet?.hideOnRemove ?? false) && tx.removed)) || model.length > 0} -
+
{#if showIcon} - {#if isComment || isAttach} + {#if withAvatar}
@@ -183,10 +183,10 @@ {/if} {/if} -
+
- + {#if employee} {getName(employee)} {:else} @@ -306,7 +306,7 @@ {/if} {#if viewlet && viewlet.display !== 'inline'} -
+
{#if tx.collectionAttribute !== undefined && (tx.txDocIds?.size ?? 0) > 1}
@@ -321,7 +321,7 @@
{:else if hasMessageType && model.length > 0 && (tx.updateTx || tx.mixinTx)} {#await getValue(client, model[0], tx) then value} -
+
{#if value.isObjectSet} diff --git a/plugins/notification-resources/src/components/Inbox.svelte b/plugins/notification-resources/src/components/Inbox.svelte index cf22c8117c..051e0c4999 100644 --- a/plugins/notification-resources/src/components/Inbox.svelte +++ b/plugins/notification-resources/src/components/Inbox.svelte @@ -105,7 +105,7 @@ diff --git a/plugins/tracker-resources/src/components/issues/NotificationIssuePresenter.svelte b/plugins/tracker-resources/src/components/issues/NotificationIssuePresenter.svelte index ce099618d0..aae0960750 100644 --- a/plugins/tracker-resources/src/components/issues/NotificationIssuePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/NotificationIssuePresenter.svelte @@ -31,23 +31,23 @@ {#if value} -
-
+
+
{#if currentProject} - -
- {currentProject.name} +
+
+ + {currentProject.name} + {/if} - - {title} + + {title} {value.title}
-
- {#if status} - - {/if} -
+ {#if status} + + {/if}
{/if}