Create global inbox actions (#4903)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina
2024-03-08 14:59:20 +07:00
committed by GitHub
parent 0483e2ac0d
commit 5ce079cf3d
11 changed files with 172 additions and 43 deletions
+32 -2
View File
@@ -38,8 +38,8 @@ import notification, {
type DocNotifyContext,
type InboxNotification
} from '@hcengineering/notification'
import { getClient } from '@hcengineering/presentation'
import { getLocation, navigate, type Location, type ResolvedLocation } from '@hcengineering/ui'
import { getClient, MessageBox } from '@hcengineering/presentation'
import { getLocation, navigate, type Location, type ResolvedLocation, showPopup } from '@hcengineering/ui'
import { get } from 'svelte/store'
import { InboxNotificationsClientImpl } from './inboxNotificationsClient'
@@ -412,6 +412,36 @@ export async function unpinDocNotifyContext (object: DocNotifyContext): Promise<
})
}
export async function archiveAll (): Promise<void> {
const client = InboxNotificationsClientImpl.getClient()
showPopup(
MessageBox,
{
label: notification.string.ArchiveAllConfirmationTitle,
message: notification.string.ArchiveAllConfirmationMessage
},
'top',
(result?: boolean) => {
if (result === true) {
void client.deleteAllNotifications()
}
}
)
}
export async function readAll (): Promise<void> {
const client = InboxNotificationsClientImpl.getClient()
await client.readAllNotifications()
}
export async function unreadAll (): Promise<void> {
const client = InboxNotificationsClientImpl.getClient()
await client.unreadAllNotifications()
}
export async function getDisplayInboxNotifications (
notificationsByContext: Map<Ref<DocNotifyContext>, InboxNotification[]>,
filter: InboxNotificationsFilter = 'all',