From 6f292467d411a038b86c966d623138fdd2996896 Mon Sep 17 00:00:00 2001 From: Artem Savchenko Date: Thu, 23 Oct 2025 22:05:01 +0700 Subject: [PATCH 1/2] Redesign feed view Signed-off-by: Artem Savchenko --- .../src/components/CardPathPresenter.svelte | 15 +- .../src/components/CardSection.svelte | 44 ++++ .../src/components/ColoredCardIcon.svelte | 5 +- .../src/components/FeedCardPresenter.svelte | 184 +++++++------- .../preview/ExtendedMessagePreview.svelte | 81 +++++++ .../components/preview/PreviewTemplate.svelte | 228 ++++++++++++++++++ plugins/communication-resources/src/index.ts | 2 + .../preview/NotificationPreview.svelte | 55 +---- .../components/preview/PreviewTemplate.svelte | 214 ++-------------- 9 files changed, 482 insertions(+), 346 deletions(-) create mode 100644 plugins/card-resources/src/components/CardSection.svelte create mode 100644 plugins/communication-resources/src/components/preview/ExtendedMessagePreview.svelte create mode 100644 plugins/communication-resources/src/components/preview/PreviewTemplate.svelte diff --git a/plugins/card-resources/src/components/CardPathPresenter.svelte b/plugins/card-resources/src/components/CardPathPresenter.svelte index e69556828bb..1b718dd65b9 100644 --- a/plugins/card-resources/src/components/CardPathPresenter.svelte +++ b/plugins/card-resources/src/components/CardPathPresenter.svelte @@ -36,16 +36,16 @@ {/if} - {#if card.parent != null} + {#if card.parentInfo?.length > 0} {#if displaySpace && card.$lookup?.space !== undefined} {/if} - {@const info = card.parentInfo?.find((it) => it._id === card.parent)} + {@const info = card.parent != null ? card.parentInfo?.find((it) => it._id === card.parent) : card.parentInfo?.[0]} {#if info}
openCardInSidebar(info._id)} > @@ -63,23 +63,18 @@ display: flex; justify-content: center; align-items: center; - padding: 0 0.5rem; min-width: 2rem; max-width: 25rem; min-height: 1.5rem; max-height: 1.5rem; font-size: 0.75rem; font-weight: 500; - border-radius: var(--extra-small-BorderRadius); white-space: nowrap; gap: 0.25rem; - background-color: var(--global-ui-BackgroundColor); - border: var(--global-subtle-ui-BorderColor); color: var(--global-secondary-TextColor); - cursor: pointer; - &:hover { - background: var(--global-ui-active-BackgroundColor); + &.clickable { + cursor: pointer; } } diff --git a/plugins/card-resources/src/components/CardSection.svelte b/plugins/card-resources/src/components/CardSection.svelte new file mode 100644 index 00000000000..d9fb0e2ddfd --- /dev/null +++ b/plugins/card-resources/src/components/CardSection.svelte @@ -0,0 +1,44 @@ + + + + + + +
+
+ +
+ + diff --git a/plugins/card-resources/src/components/ColoredCardIcon.svelte b/plugins/card-resources/src/components/ColoredCardIcon.svelte index a2f8cc3d83f..88def1302f0 100644 --- a/plugins/card-resources/src/components/ColoredCardIcon.svelte +++ b/plugins/card-resources/src/components/ColoredCardIcon.svelte @@ -35,10 +35,7 @@ function getIconStyle (platformColor: any): string { return ` - background: ${platformColor.color + '1a'}; - border: 1px solid ${platformColor.color + '33'}; - color: ${platformColor.color}; - fill: ${platformColor.color}; + box-shadow: 0 2px 3px 0 ${platformColor.color}; ` } diff --git a/plugins/card-resources/src/components/FeedCardPresenter.svelte b/plugins/card-resources/src/components/FeedCardPresenter.svelte index 2a37688bc2c..26a7953dcd3 100644 --- a/plugins/card-resources/src/components/FeedCardPresenter.svelte +++ b/plugins/card-resources/src/components/FeedCardPresenter.svelte @@ -18,7 +18,7 @@ import { createMessagesQuery } from '@hcengineering/presentation' import chat from '@hcengineering/chat' - import { MessagePresenter, labelsStore } from '@hcengineering/communication-resources' + import { ExtendedMessagePreview, labelsStore } from '@hcengineering/communication-resources' import { getEmbeddedLabel } from '@hcengineering/platform' import { Button, IconDetailsFilled, IconMoreH, tooltip } from '@hcengineering/ui' import { DocNavLink, showMenu } from '@hcengineering/view-resources' @@ -32,6 +32,7 @@ import ColoredCardIcon from './ColoredCardIcon.svelte' import ContentPreview from './ContentPreview.svelte' import TagDivider from './TagDivider.svelte' + import CardSection from './CardSection.svelte' export let card: WithLookup export let isCompact = false @@ -39,7 +40,6 @@ const messagesQuery = createMessagesQuery() - let message: Message | undefined = undefined let messages: Message[] = [] // Check if the card is a thread type @@ -48,10 +48,12 @@ // Only query messages if this is a thread card $: if (isThreadCard) { messagesQuery.query( - { cardId: card._id, limit: 3, order: SortingOrder.Ascending }, + { cardId: card._id, limit: 3, order: SortingOrder.Descending }, (res) => { - messages = res.getResult().reverse() - message = messages.findLast((msg) => msg.type === MessageType.Text) + messages = res + .getResult() + .filter((msg) => msg.type === MessageType.Text) + .reverse() }, { attachments: true, @@ -61,7 +63,6 @@ } else { // Clear message data for non-thread cards messages = [] - message = undefined } function hasNewMessages (labels: CardLabel[], cardId: CardID): boolean { @@ -76,100 +77,97 @@
-
- -
- -
-
-
- {#if hasNewMessages($labelsStore, card._id)} -
- +
+
+ +
+
+
+
+ {#if hasNewMessages($labelsStore, card._id)} +
+ +
+ {/if} + + + {truncatedTitle} + + +
+ + {#if !isComfortable2} +
+
+ +
{/if} - - - {truncatedTitle} - - -
- - {#if !isComfortable2} -
-
- -
-
- {/if} -
-
+
+
+ + {#if isComfortable2} +
+ + +
+ +
+
{/if}
-
- {#if isThreadCard && message} - +
+
+ + {#if isThreadCard && messages.length > 0} +
+ {#each messages as message} + + {/each} +
{:else if !isThreadCard && card.content} - - {/if} -
-
- - {#if isComfortable2} -
- - -
- -
+
+
{/if} -
+
diff --git a/plugins/communication-resources/src/components/preview/ExtendedMessagePreview.svelte b/plugins/communication-resources/src/components/preview/ExtendedMessagePreview.svelte new file mode 100644 index 00000000000..72f750bf2a3 --- /dev/null +++ b/plugins/communication-resources/src/components/preview/ExtendedMessagePreview.svelte @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + {#if message} + {#if isActivityMessage(message)} + + {:else} + + {/if} + {/if} + + + + {#if message} + + {/if} + + diff --git a/plugins/communication-resources/src/components/preview/PreviewTemplate.svelte b/plugins/communication-resources/src/components/preview/PreviewTemplate.svelte new file mode 100644 index 00000000000..28065265114 --- /dev/null +++ b/plugins/communication-resources/src/components/preview/PreviewTemplate.svelte @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + +{#if kind === 'column'} + + +
(clientWidth = element.clientWidth)} + > + {#if !hideHeader} + + {#if person} + + + {formatName(person?.name ?? '')} + + + {/if} + + {/if} + + + {#if $$slots.content} + + + + {/if} + + +
+{:else} + +
(clientWidth = element.clientWidth)} + > + + + + + {#if person} + + {:else} + + {/if} + + {#if showPersonName && person} + {formatName(person?.name ?? '')} + {/if} + {#if showSeparator} + {#if showPersonName} + + {/if} + {/if} + + + + {#if $$slots.content} + + + + {/if} + + + + + + +
+{/if} + + diff --git a/plugins/communication-resources/src/index.ts b/plugins/communication-resources/src/index.ts index 05b0be49263..c7143873a72 100644 --- a/plugins/communication-resources/src/index.ts +++ b/plugins/communication-resources/src/index.ts @@ -51,6 +51,8 @@ export { default as MessageInput } from './components/message/MessageInput.svelt export { default as ActivityMessageViewer } from './components/message/ActivityMessageViewer.svelte' export { default as AttachmentsPreview } from './components/AttachmentsPreview.svelte' export { default as MessagePreview } from './components/MessagePreview.svelte' +export { default as ExtendedMessagePreview } from './components/preview/ExtendedMessagePreview.svelte' +export { default as PreviewTemplate } from './components/preview/PreviewTemplate.svelte' export default async (): Promise => ({ component: { diff --git a/plugins/inbox-resources/src/components/preview/NotificationPreview.svelte b/plugins/inbox-resources/src/components/preview/NotificationPreview.svelte index 3ad10f1fe15..1cc91acffec 100644 --- a/plugins/inbox-resources/src/components/preview/NotificationPreview.svelte +++ b/plugins/inbox-resources/src/components/preview/NotificationPreview.svelte @@ -12,18 +12,10 @@ - - - {#if message} - {#if isActivityMessage(message)} - - {:else} - - {/if} - {/if} - - - - {#if message} - - {/if} - - + diff --git a/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte b/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte index 98ddc6bf3ac..961e0aaf938 100644 --- a/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte +++ b/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte @@ -12,17 +12,11 @@ -{#if kind === 'column'} - - -
(clientWidth = element.clientWidth)} - > - {#if !hideHeader} - - {#if person} - - - {formatName(person?.name ?? '')} - - - {/if} - - {/if} - - - {#if $$slots.content} - - - - {/if} - - -
-{:else} - -
(clientWidth = element.clientWidth)} - > - - - - - {#if person} - - {:else} - - {/if} - - {#if showPersonName && person} - {formatName(person?.name ?? '')} - {/if} - {#if showSeparator} - {#if showPersonName} - - {/if} - {/if} - - - - {#if $$slots.content} - - - - {/if} - - - - - - -
-{/if} - - + From f829ba6be86c7ee8077538167377edf3326bf3dd Mon Sep 17 00:00:00 2001 From: Artem Savchenko Date: Thu, 23 Oct 2025 23:04:20 +0700 Subject: [PATCH 2/2] Fix Svelte errors Signed-off-by: Artem Savchenko --- .../legacy/MentionInboxNotificationPresenter.svelte | 1 - .../src/components/preview/PreviewTemplate.svelte | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/inbox-resources/src/components/legacy/MentionInboxNotificationPresenter.svelte b/plugins/inbox-resources/src/components/legacy/MentionInboxNotificationPresenter.svelte index 1502518f621..db9b777d85b 100644 --- a/plugins/inbox-resources/src/components/legacy/MentionInboxNotificationPresenter.svelte +++ b/plugins/inbox-resources/src/components/legacy/MentionInboxNotificationPresenter.svelte @@ -18,7 +18,6 @@ import { createQuery, getClient } from '@hcengineering/presentation' import activity, { ActivityMessage } from '@hcengineering/activity' import { Doc } from '@hcengineering/core' - import { getEmbeddedLabel } from '@hcengineering/platform' import { Person } from '@hcengineering/contact' import CommonInboxNotificationPresenter from './CommonInboxNotificationPresenter.svelte' diff --git a/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte b/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte index 961e0aaf938..148f249f3e7 100644 --- a/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte +++ b/plugins/inbox-resources/src/components/preview/PreviewTemplate.svelte @@ -45,4 +45,8 @@ {showSeparator} {hideHeader} {hidePersonName} -/> +> + + + +