Skip to content

Commit cd1a25b

Browse files
Inbox UI & chat fixes (#9165)
Signed-off-by: Kristina Fefelova <[email protected]>
1 parent 4c24bd5 commit cd1a25b

File tree

164 files changed

+2183
-2424
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+2183
-2424
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 140 additions & 187 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

desktop/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"dependencies": {
6767
"@hcengineering/platform": "^0.6.11",
6868
"@hcengineering/ui": "^0.6.15",
69-
"@hcengineering/ui-next": "^0.6.0",
7069
"@hcengineering/theme": "^0.6.5",
7170
"@hcengineering/login": "^0.6.12",
7271
"@hcengineering/login-assets": "^0.6.0",

desktop/src/ui/notifications.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getPersonBySocialId, formatName } from '@hcengineering/contact'
22
import { Ref, TxOperations } from '@hcengineering/core'
33
import notification, { DocNotifyContext, CommonInboxNotification, ActivityInboxNotification, InboxNotification } from '@hcengineering/notification'
44
import { IntlString, addEventListener, translate } from '@hcengineering/platform'
5-
import { getClient } from '@hcengineering/presentation'
5+
import { getClient, createNotificationsQuery } from '@hcengineering/presentation'
66
import { location } from '@hcengineering/ui'
77
import workbench, { workbenchId } from '@hcengineering/workbench'
88
import desktopPreferences, { defaultNotificationPreference } from '@hcengineering/desktop-preferences'
@@ -13,6 +13,8 @@ import { IPCMainExposed } from './types'
1313

1414
let client: TxOperations
1515

16+
const notificationsQuery = createNotificationsQuery()
17+
1618
async function hydrateNotificationAsYouCan (lastNotification: InboxNotification): Promise<{ title: string, body: string } | undefined> {
1719
// Let's try to do our best and figure out from who we have an notification
1820

@@ -114,13 +116,19 @@ export function configureNotifications (): void {
114116
// because we generate them on a client
115117
let initTimestamp = 0
116118
const notificationHistory = new Map<string, number>()
119+
let newUnreadNotifications = 0
117120

118121
addEventListener(workbench.event.NotifyConnection, async () => {
119122
client = getClient()
120123
const electronAPI: IPCMainExposed = (window as any).electron
121124

122125
const inboxClient = InboxNotificationsClientImpl.getClient()
123126

127+
notificationsQuery.query({ read: false, limit: 1000 }, res => {
128+
newUnreadNotifications = res.getResult().length
129+
electronAPI.setBadge(prevUnViewdNotificationsCount + newUnreadNotifications)
130+
})
131+
124132
async function handleNotifications (notificationsByContext: Map<Ref<DocNotifyContext>, InboxNotification[]>): Promise<void> {
125133
const inboxData = await getDisplayInboxData(notificationsByContext)
126134

@@ -138,7 +146,7 @@ export function configureNotifications (): void {
138146

139147
if (prevUnViewdNotificationsCount !== unViewedNotifications.length) {
140148
if (preferences.showUnreadCounter) {
141-
electronAPI.setBadge(unViewedNotifications.length)
149+
electronAPI.setBadge(unViewedNotifications.length + newUnreadNotifications)
142150
}
143151
if (preferences.bounceAppIcon) {
144152
electronAPI.dockBounce()
@@ -179,7 +187,7 @@ export function configureNotifications (): void {
179187
electronAPI.setBadge(0)
180188
}
181189
if (!preferences.showUnreadCounter && newPreferences.showUnreadCounter) {
182-
electronAPI.setBadge(prevUnViewdNotificationsCount)
190+
electronAPI.setBadge(prevUnViewdNotificationsCount + newUnreadNotifications)
183191
}
184192
preferences = newPreferences
185193
})

desktop/src/ui/platform.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import { timeId } from '@hcengineering/time'
5656
import tracker, { trackerId } from '@hcengineering/tracker'
5757
import { trainingId } from '@hcengineering/training'
5858
import uiPlugin, { getCurrentLocation, locationStorageKeyId, navigate, setLocationStorageKey } from '@hcengineering/ui'
59-
import { uiNextId } from '@hcengineering/ui-next'
6059
import { mediaId } from '@hcengineering/media'
6160
import { uploaderId } from '@hcengineering/uploader'
6261
import recorder, { recorderId } from '@hcengineering/recorder'
@@ -160,7 +159,6 @@ function configureI18n (): void {
160159
)
161160
addStringsLoader(textEditorId, async (lang: string) => await import(`@hcengineering/text-editor-assets/lang/${lang}.json`))
162161
addStringsLoader(uiId, async (lang: string) => await import(`@hcengineering/ui/lang/${lang}.json`))
163-
addStringsLoader(uiNextId, async (lang: string) => await import(`@hcengineering/ui-next/lang/${lang}.json`))
164162
addStringsLoader(mediaId, async (lang: string) => await import(`@hcengineering/media-assets/lang/${lang}.json`))
165163
addStringsLoader(uploaderId, async (lang: string) => await import(`@hcengineering/uploader-assets/lang/${lang}.json`))
166164
addStringsLoader(recorderId, async (lang: string) => await import(`@hcengineering/recorder-assets/lang/${lang}.json`))

dev/prod/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@
254254
"@hcengineering/training-assets": "^0.1.0",
255255
"@hcengineering/training-resources": "^0.1.0",
256256
"@hcengineering/ui": "^0.6.15",
257-
"@hcengineering/ui-next": "^0.6.0",
258257
"@hcengineering/media": "^0.6.0",
259258
"@hcengineering/media-assets": "^0.6.0",
260259
"@hcengineering/media-resources": "^0.6.0",

dev/prod/src/platform.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ import { timeId } from '@hcengineering/time'
6363
import tracker, { trackerId } from '@hcengineering/tracker'
6464
import { trainingId } from '@hcengineering/training'
6565
import uiPlugin from '@hcengineering/ui'
66-
import {uiNextId} from '@hcengineering/ui-next'
6766
import { uploaderId } from '@hcengineering/uploader'
6867
import { mediaId } from '@hcengineering/media'
6968
import recorder, { recorderId } from '@hcengineering/recorder'
@@ -281,7 +280,6 @@ function configureI18n(): void {
281280
async (lang: string) => await import(`@hcengineering/text-editor-assets/lang/${lang}.json`)
282281
)
283282
addStringsLoader(uiId, async (lang: string) => await import(`@hcengineering/ui/lang/${lang}.json`))
284-
addStringsLoader(uiNextId, async (lang: string) => await import(`@hcengineering/ui-next/lang/${lang}.json`))
285283
addStringsLoader(uploaderId, async (lang: string) => await import(`@hcengineering/uploader-assets/lang/${lang}.json`))
286284
addStringsLoader(recorderId, async (lang: string) => await import(`@hcengineering/recorder-assets/lang/${lang}.json`))
287285
addStringsLoader(mediaId, async (lang: string) => await import(`@hcengineering/media-assets/lang/${lang}.json`))

packages/presentation/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
"@hcengineering/client": "^0.6.18",
4545
"@hcengineering/contact": "^0.6.24",
4646
"@hcengineering/collaborator-client": "^0.6.4",
47-
"@hcengineering/communication-client-query": "0.1.194",
48-
"@hcengineering/communication-sdk-types": "0.1.194",
49-
"@hcengineering/communication-types": "0.1.194",
47+
"@hcengineering/communication-client-query": "0.1.195",
48+
"@hcengineering/communication-sdk-types": "0.1.195",
49+
"@hcengineering/communication-types": "0.1.195",
5050
"@hcengineering/core": "^0.6.32",
5151
"@hcengineering/diffview": "^0.6.0",
5252
"@hcengineering/notification": "^0.6.23",

packages/presentation/src/components/Image.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
export let width: number
2424
export let height: number
2525
export let responsive: boolean = false
26+
export let loading: 'lazy' | 'eager' = 'eager'
2627
2728
let blobSrc: { src: string, srcset: string } | undefined
2829
@@ -37,6 +38,7 @@
3738
{alt}
3839
width={responsive ? '100%' : width}
3940
height={responsive ? '100%' : height}
41+
{loading}
4042
{fit}
4143
on:load
4244
on:error

packages/presentation/src/components/LiteMessageViewer.svelte

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
// limitations under the License.
1414
-->
1515
<script lang="ts">
16-
import { markupToJSON } from '@hcengineering/text'
16+
import { MarkupNode, markupToJSON } from '@hcengineering/text'
17+
import { Markup } from '@hcengineering/core'
1718
import LiteNode from './markup/lite/LiteNode.svelte'
1819
19-
export let message: string
20+
export let message: Markup | MarkupNode
2021
21-
$: node = markupToJSON(message)
22+
$: node = typeof message === 'string' ? markupToJSON(message) : message
2223
</script>
2324

2425
<div class="text-markup-view">

packages/presentation/src/components/markup/lite/LiteNodeContent.svelte

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,20 @@
1313
// limitations under the License.
1414
-->
1515
<script lang="ts">
16-
import { Class, Doc, Ref } from '@hcengineering/core'
16+
import { Blob, Class, Doc, Ref } from '@hcengineering/core'
1717
import { AttrValue, MarkupNode, MarkupNodeType, MarkupMarkType } from '@hcengineering/text'
1818
1919
import LiteNodes from './LiteNodes.svelte'
2020
import ObjectNode from '../ObjectNode.svelte'
2121
import NodeMarks from '../NodeMarks.svelte'
22+
import { getBlobRef } from '../../../preview'
2223
2324
export let node: MarkupNode
2425
26+
function toRefBlob (blobId: AttrValue): Ref<Blob> {
27+
return blobId as Ref<Blob>
28+
}
29+
2530
function toRef (objectId: string): Ref<Doc> {
2631
return objectId as Ref<Doc>
2732
}
@@ -36,14 +41,6 @@
3641
function toString (value: AttrValue | undefined): string | undefined {
3742
return value != null ? `${value}` : undefined
3843
}
39-
40-
function toNumber (value: AttrValue | undefined): number | undefined {
41-
if (typeof value === 'boolean') {
42-
return value ? 1 : 0
43-
}
44-
45-
return value != null ? (typeof value === 'string' ? parseInt(value) : value) : undefined
46-
}
4744
</script>
4845

4946
{#if node}
@@ -85,6 +82,18 @@
8582
{:else}
8683
<LiteNodes {nodes} />
8784
{/if}
85+
{:else if node.type === MarkupNodeType.emoji}
86+
<span class="emoji">
87+
{#if node.attrs?.kind === 'image'}
88+
{@const blob = toRefBlob(attrs.image)}
89+
{@const alt = toString(attrs.emoji)}
90+
{#await getBlobRef(blob) then blobSrc}
91+
<img src={blobSrc.src} {alt} />
92+
{/await}
93+
{:else}
94+
{node.attrs?.emoji}
95+
{/if}
96+
</span>
8897
{:else if node.type === MarkupNodeType.taskList}
8998
<!-- TODO not implemented -->
9099
{:else if node.type === MarkupNodeType.taskItem}

0 commit comments

Comments
 (0)