From cf8ff1be313792b23d708e79ceb536744ed8551f Mon Sep 17 00:00:00 2001 From: Kristina Date: Thu, 18 Jan 2024 12:52:59 +0400 Subject: [PATCH] Make inbox messages more compact (#4378) Signed-off-by: Kristina Fefelova --- .../ActivityInfoMessagePresenter.svelte | 2 + .../ActivityMessagePresenter.svelte | 2 + .../ActivityMessageTemplate.svelte | 29 +++--- .../DocUpdateMessagePresenter.svelte | 4 + .../chat-message/ChatMessagePresenter.svelte | 2 + .../threads/ThreadMessagePresenter.svelte | 2 + .../ActivityInboxNotificationPresenter.svelte | 61 ++++-------- .../CommonInboxNotificationPresenter.svelte | 94 ++++++++----------- .../components/inbox/InboxFlatListView.svelte | 38 +++++--- 9 files changed, 116 insertions(+), 118 deletions(-) diff --git a/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte b/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte index e746cd565c..cd318f88cc 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityInfoMessagePresenter.svelte @@ -37,6 +37,7 @@ export let shouldScroll: boolean = false export let embedded: boolean = false export let withActions: boolean = true + export let withFlatActions: boolean = true export let excludedActions: string[] = [] export let actions: Action[] = [] export let onClick: (() => void) | undefined = undefined @@ -70,6 +71,7 @@ {withActions} {actions} {excludedActions} + {withFlatActions} viewlet={undefined} {onClick} > diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte index f7c055e982..e0432cbac1 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessagePresenter.svelte @@ -31,6 +31,7 @@ export let skipLabel = false export let actions: Action[] = [] export let excludedActions: string[] = [] + export let withFlatActions: boolean = true export let onClick: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined @@ -56,6 +57,7 @@ hideReplies, actions, excludedActions, + withFlatActions, onClick, onReply }} diff --git a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte index cbde7f0b2c..d47432ffe7 100644 --- a/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte +++ b/plugins/activity-resources/src/components/activity-message/ActivityMessageTemplate.svelte @@ -46,8 +46,10 @@ export let shouldScroll: boolean = false export let embedded: boolean = false export let withActions: boolean = true + export let withFlatActions: boolean = true export let showEmbedded = false export let hideReplies = false + export let skipLabel = false export let onClick: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined @@ -150,8 +152,9 @@ {/if} - - + {#if !skipLabel} + + {/if} {getDisplayTime(message.createdOn ?? 0)} @@ -175,17 +178,19 @@ class:opened={isActionMenuOpened || message.isPinned} > {#if withActions} - - - + {#if withFlatActions} + + + - + + {/if} {#if withActionMenu} {/if} diff --git a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte index 06cecd723f..ffca62eb4c 100644 --- a/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte +++ b/plugins/activity-resources/src/components/doc-update-message/DocUpdateMessagePresenter.svelte @@ -46,6 +46,8 @@ export let showEmbedded = false export let hideReplies = false export let actions: Action[] = [] + export let skipLabel = false + export let withFlatActions: boolean = true export let excludedActions: string[] = [] export let onClick: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined @@ -157,6 +159,8 @@ {showEmbedded} {hideReplies} {actions} + {skipLabel} + {withFlatActions} {onClick} {onReply} > diff --git a/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte b/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte index 60f45e379f..1209ae7030 100644 --- a/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte +++ b/plugins/chunter-resources/src/components/chat-message/ChatMessagePresenter.svelte @@ -41,6 +41,7 @@ export let skipLabel = false export let actions: Action[] = [] export let excludedActions: string[] = [] + export let withFlatActions: boolean = true export let onClick: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined @@ -164,6 +165,7 @@ actions={additionalActions} {showEmbedded} {hideReplies} + {withFlatActions} {onClick} {onReply} > diff --git a/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte b/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte index 50cc1dfe23..89b330d673 100644 --- a/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte +++ b/plugins/chunter-resources/src/components/threads/ThreadMessagePresenter.svelte @@ -25,6 +25,7 @@ export let withActions: boolean = true export let showEmbedded = false export let skipLabel = false + export let withFlatActions: boolean = true export let onClick: (() => void) | undefined = undefined export let onReply: (() => void) | undefined = undefined @@ -39,6 +40,7 @@ {showEmbedded} {embedded} {skipLabel} + {withFlatActions} {onClick} {onReply} /> diff --git a/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte b/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte index 50b59b1921..04c20a967e 100644 --- a/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte +++ b/plugins/notification-resources/src/components/inbox/ActivityInboxNotificationPresenter.svelte @@ -23,7 +23,7 @@ } from '@hcengineering/notification' import { ActivityMessagePresenter, combineActivityMessages } from '@hcengineering/activity-resources' import activity, { ActivityMessage, DisplayActivityMessage } from '@hcengineering/activity' - import { location, Action, CheckBox, getLocation, navigate, Component } from '@hcengineering/ui' + import { location, Action, getLocation, navigate, Component } from '@hcengineering/ui' import { getActions } from '@hcengineering/view-resources' import { getResource } from '@hcengineering/platform' import chunter from '@hcengineering/chunter' @@ -35,7 +35,6 @@ export let skipLabel = false export let viewlets: ActivityNotificationViewlet[] = [] export let onClick: (() => void) | undefined = undefined - export let onCheck: ((isChecked: boolean) => void) | undefined = undefined const client = getClient() const messagesQuery = createQuery() @@ -120,43 +119,23 @@ {#if displayMessage !== undefined} -
- {#if !embedded} -
- { - if (onCheck) { - onCheck(event.detail) - } - }} - /> -
- {/if} - {#if viewlet} - - {:else} - { - handleReply(displayMessage) - }} - {onClick} - /> - {/if} -
+ {#if viewlet} + + {:else} + { + handleReply(displayMessage) + }} + {onClick} + /> + {/if} {/if} - - diff --git a/plugins/notification-resources/src/components/inbox/CommonInboxNotificationPresenter.svelte b/plugins/notification-resources/src/components/inbox/CommonInboxNotificationPresenter.svelte index f76c3bcd94..fc354840b1 100644 --- a/plugins/notification-resources/src/components/inbox/CommonInboxNotificationPresenter.svelte +++ b/plugins/notification-resources/src/components/inbox/CommonInboxNotificationPresenter.svelte @@ -29,15 +29,14 @@ import { ActionIcon, CheckBox, IconMoreH, Label, showPopup } from '@hcengineering/ui' import { getDocLinkTitle, Menu } from '@hcengineering/view-resources' import { ActivityDocLink } from '@hcengineering/activity-resources' - import activity from '@hcengineering/activity' import view from '@hcengineering/view' import { InboxNotificationsClientImpl } from '../../inboxNotificationsClient' export let value: CommonInboxNotification export let embedded = false + export let skipLabel = false export let onClick: (() => void) | undefined = undefined - export let onCheck: ((isChecked: boolean) => void) | undefined = undefined const objectQuery = createQuery() const client = getClient() @@ -92,48 +91,35 @@ } -
+ + +
{#if !embedded} - { - if (onCheck) { - onCheck(event.detail) - } - }} - /> - {/if} - - -
- {#if !embedded} - {#if !value.isViewed} -
- {/if} - - {#if value.icon} - - {:else if person} - - {:else} - - {/if} - {:else} -
+ {#if !value.isViewed} +
{/if} -
-
- {#if person} - - {:else} -
-
- {/if} - {#if value.header} - - {/if} + + {#if value.icon} + + {:else if person} + + {:else} + + {/if} + {:else} +
+ {/if} +
+
+ {#if person} + + {:else} +
+
+ {/if} + {#if !skipLabel && value.header} + {#if object} {#await getDocLinkTitle(client, object._id, object._class, object) then linkTitle} @@ -144,23 +130,23 @@ /> {/await} {/if} + {/if} - {getDisplayTime(value.createdOn ?? 0)} -
- -
-
- -
-
+ {getDisplayTime(value.createdOn ?? 0)}
- {#if !embedded} -
- +
+
+
- {/if} +
+ + {#if !embedded} +
+ +
+ {/if}