From 245c4cb699c5f1709d651a02e0eb556c7a613aa5 Mon Sep 17 00:00:00 2001 From: Kristina Date: Thu, 4 Jul 2024 20:50:02 +0400 Subject: [PATCH] Add blank view for empty channels (#6006) Signed-off-by: Kristina Fefelova --- plugins/chunter-assets/lang/en.json | 4 +- plugins/chunter-assets/lang/es.json | 4 +- plugins/chunter-assets/lang/fr.json | 4 +- plugins/chunter-assets/lang/pt.json | 4 +- plugins/chunter-assets/lang/ru.json | 4 +- plugins/chunter-assets/lang/zh.json | 4 +- .../src/components/BlankView.svelte | 50 +++++++++++++++++++ .../src/components/ChannelScrollView.svelte | 11 +++- .../chat/specials/SavedMessages.svelte | 30 +++-------- plugins/chunter/src/index.ts | 4 +- 10 files changed, 87 insertions(+), 32 deletions(-) create mode 100644 plugins/chunter-resources/src/components/BlankView.svelte diff --git a/plugins/chunter-assets/lang/en.json b/plugins/chunter-assets/lang/en.json index 2c0d015b70..8852849048 100644 --- a/plugins/chunter-assets/lang/en.json +++ b/plugins/chunter-assets/lang/en.json @@ -108,6 +108,8 @@ "UnstarChannel": "Unstar channel", "UnstarConversation": "Unstar conversation", "JoinChannelHeader": "Click \"Join\" to get started.", - "JoinChannelText": "Once you've joined, you'll be able to read all messages and contribute to the discussion." + "JoinChannelText": "Once you've joined, you'll be able to read all messages and contribute to the discussion.", + "NoMessagesInChannel": "Currently there are no messages", + "SendMessagesInChannel": "Send the first message to start the conversation" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/es.json b/plugins/chunter-assets/lang/es.json index 81d3f47e5a..c18f511b8d 100644 --- a/plugins/chunter-assets/lang/es.json +++ b/plugins/chunter-assets/lang/es.json @@ -108,6 +108,8 @@ "UnstarChannel": "Desmarcar canal", "UnstarConversation": "Desmarcar conversación", "JoinChannelHeader": "Haga clic en \"Unirse\" para comenzar.", - "JoinChannelText": "Una vez que se haya unido, podrá leer todos los mensajes y contribuir a la discusión." + "JoinChannelText": "Una vez que se haya unido, podrá leer todos los mensajes y contribuir a la discusión.", + "NoMessagesInChannel": "No hay mensajes en este canal todavía.", + "SendMessagesInChannel": "Envíe mensajes en este canal para comenzar la conversación." } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/fr.json b/plugins/chunter-assets/lang/fr.json index 4553b8145e..9f4aa8ac25 100644 --- a/plugins/chunter-assets/lang/fr.json +++ b/plugins/chunter-assets/lang/fr.json @@ -108,6 +108,8 @@ "UnstarChannel": "Retirer le canal des favoris", "UnstarConversation": "Retirer la conversation des favoris", "JoinChannelHeader": "Cliquez sur \"Rejoindre\" pour commencer.", - "JoinChannelText": "Une fois que vous avez rejoint, vous pourrez lire tous les messages et participer à la discussion." + "JoinChannelText": "Une fois que vous avez rejoint, vous pourrez lire tous les messages et participer à la discussion.", + "NoMessagesInChannel": "Il n'y a pas encore de messages dans ce canal.", + "SendMessagesInChannel": "Envoyez des messages pour commencer la conversation." } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/pt.json b/plugins/chunter-assets/lang/pt.json index 915796c17b..0f87bdcfd9 100644 --- a/plugins/chunter-assets/lang/pt.json +++ b/plugins/chunter-assets/lang/pt.json @@ -108,6 +108,8 @@ "UnstarChannel": "Remover destaque do canal", "UnstarConversation": "Remover destaque da conversa", "JoinChannelHeader": "Clique em \"Participar\" para começar.", - "JoinChannelText": "Depois de entrar, você poderá ler todas as mensagens e contribuir na discussão." + "JoinChannelText": "Depois de entrar, você poderá ler todas as mensagens e contribuir na discussão.", + "NoMessagesInChannel": "Ainda não existem mensagens neste canal.", + "SendMessagesInChannel": "Envie a sua primeira mensagem!" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/ru.json b/plugins/chunter-assets/lang/ru.json index 8ada96a26c..0314068999 100644 --- a/plugins/chunter-assets/lang/ru.json +++ b/plugins/chunter-assets/lang/ru.json @@ -108,6 +108,8 @@ "UnstarChannel": "Удалить из избранного", "UnstarConversation": "Удалить из избранного", "JoinChannelHeader": "Нажмите \"Присоединиться\", чтобы начать.", - "JoinChannelText": "Присоединившись, вы сможете читать все сообщения и участвовать в обсуждении." + "JoinChannelText": "Присоединившись, вы сможете читать все сообщения и участвовать в обсуждении.", + "NoMessagesInChannel": "В этом канале пока нет сообщений", + "SendMessagesInChannel": "Отправьте первое сообщение, чтобы начать общение" } } \ No newline at end of file diff --git a/plugins/chunter-assets/lang/zh.json b/plugins/chunter-assets/lang/zh.json index 0d6e403786..07855949be 100644 --- a/plugins/chunter-assets/lang/zh.json +++ b/plugins/chunter-assets/lang/zh.json @@ -108,6 +108,8 @@ "UnstarChannel": "取消频道星标", "UnstarConversation": "取消对话星标", "JoinChannelHeader": "点击“加入”开始。", - "JoinChannelText": "加入后,你将能够阅读所有消息并参与讨论。" + "JoinChannelText": "加入后,你将能够阅读所有消息并参与讨论。", + "NoMessagesInChannel": "此频道中没有消息。", + "SendMessagesInChannel": "在此频道中发送消息。" } } diff --git a/plugins/chunter-resources/src/components/BlankView.svelte b/plugins/chunter-resources/src/components/BlankView.svelte new file mode 100644 index 0000000000..adb78f95bb --- /dev/null +++ b/plugins/chunter-resources/src/components/BlankView.svelte @@ -0,0 +1,50 @@ + + + +
+ +
+
+ + +
+ + diff --git a/plugins/chunter-resources/src/components/ChannelScrollView.svelte b/plugins/chunter-resources/src/components/ChannelScrollView.svelte index b8f88da1c1..4dc90c185d 100644 --- a/plugins/chunter-resources/src/components/ChannelScrollView.svelte +++ b/plugins/chunter-resources/src/components/ChannelScrollView.svelte @@ -26,7 +26,7 @@ } from '@hcengineering/activity-resources' import { Class, Doc, getDay, Ref, Timestamp } from '@hcengineering/core' import { InboxNotificationsClientImpl } from '@hcengineering/notification-resources' - import { getResource } from '@hcengineering/platform' + import { getEmbeddedLabel, getResource } from '@hcengineering/platform' import { getClient } from '@hcengineering/presentation' import { Loading, Scroller, ScrollParams } from '@hcengineering/ui' import { afterUpdate, beforeUpdate, onDestroy, onMount, tick } from 'svelte' @@ -43,6 +43,8 @@ import ActivityMessagesSeparator from './ChannelMessagesSeparator.svelte' import JumpToDateSelector from './JumpToDateSelector.svelte' import HistoryLoading from './LoadingHistory.svelte' + import BlankView from './BlankView.svelte' + import chunter from '../plugin' export let provider: ChannelDataProvider export let object: Doc | undefined @@ -646,6 +648,13 @@ {/if} + {#if displayMessages.length === 0} + + {/if} {#each displayMessages as message, index (message._id)} {@const isSelected = message._id === selectedMessageId} {@const canGroup = canGroupChatMessages(message, displayMessages[index - 1])} diff --git a/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte b/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte index bcf8c7e4d7..f7807fd807 100644 --- a/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte +++ b/plugins/chunter-resources/src/components/chat/specials/SavedMessages.svelte @@ -27,6 +27,7 @@ import { savedAttachmentsStore } from '../utils' import Header from '../../Header.svelte' import { openMessageFromSpecial } from '../../../navigation' + import BlankView from '../../BlankView.svelte' const client = getClient() @@ -108,15 +109,11 @@ {/if} {/each} {:else} -
- -
-
- - -
+ {/if} @@ -125,21 +122,6 @@ .body { background-color: var(--theme-panel-color); } - .empty { - display: flex; - align-self: center; - flex-direction: column; - justify-content: center; - align-items: center; - text-align: center; - height: inherit; - width: 30rem; - } - - .header { - font-weight: 600; - margin: 1rem; - } .attachmentContainer { cursor: pointer; diff --git a/plugins/chunter/src/index.ts b/plugins/chunter/src/index.ts index eddb9fb580..9a0df86697 100644 --- a/plugins/chunter/src/index.ts +++ b/plugins/chunter/src/index.ts @@ -153,7 +153,9 @@ export default plugin(chunterId, { StarChannel: '' as IntlString, StarConversation: '' as IntlString, UnstarChannel: '' as IntlString, - UnstarConversation: '' as IntlString + UnstarConversation: '' as IntlString, + NoMessagesInChannel: '' as IntlString, + SendMessagesInChannel: '' as IntlString }, ids: { DMNotification: '' as Ref,