diff --git a/models/notification/src/index.ts b/models/notification/src/index.ts index 778da86387..69ca6588f0 100644 --- a/models/notification/src/index.ts +++ b/models/notification/src/index.ts @@ -20,6 +20,7 @@ import { DOMAIN_MODEL, Hierarchy, IndexKind, + type Space, type Account, type AttachedDoc, type Class, @@ -60,8 +61,8 @@ import { type CommonInboxNotification, type CommonNotificationType, type DocNotifyContext, - type DocUpdates, type DocUpdateTx, + type DocUpdates, type InboxNotification, type MentionInboxNotification, type NotificationContextPresenter, @@ -73,8 +74,8 @@ import { type NotificationSetting, type NotificationStatus, type NotificationTemplate, - type PushSubscription, type NotificationType, + type PushSubscription, type PushSubscriptionKeys } from '@hcengineering/notification' import { getEmbeddedLabel, type Asset, type IntlString, type Resource } from '@hcengineering/platform' @@ -91,6 +92,8 @@ export const DOMAIN_NOTIFICATION = 'notification' as Domain @Model(notification.class.BrowserNotification, core.class.Doc, DOMAIN_NOTIFICATION) export class TBrowserNotification extends TDoc implements BrowserNotification { + senderId?: Ref | undefined + tag!: Ref> title!: string body!: string onClickLocation?: Location | undefined @@ -365,8 +368,7 @@ export function createModel (builder: Builder): void { core.space.Model, { label: notification.string.Push, - depends: notification.providers.PlatformNotification, - onChange: notification.function.CheckPushPermission + depends: notification.providers.PlatformNotification }, notification.providers.BrowserNotification ) diff --git a/packages/ui/src/utils.ts b/packages/ui/src/utils.ts index d358818dd9..418b7c56fd 100644 --- a/packages/ui/src/utils.ts +++ b/packages/ui/src/utils.ts @@ -85,14 +85,15 @@ export function addNotification ( title: string, subTitle: string, component: AnyComponent | AnySvelteComponent, - params?: Record + params?: Record, + severity: NotificationSeverity = NotificationSeverity.Success ): void { const closeTimeout = parseInt(localStorage.getItem('#platform.notification.timeout') ?? '10000') const notification: Notification = { id: generateId(), title, subTitle, - severity: NotificationSeverity.Success, + severity, position: NotificationPosition.BottomRight, component, closeTimeout, diff --git a/plugins/notification-assets/lang/en.json b/plugins/notification-assets/lang/en.json index 7991414041..c5e29b0249 100644 --- a/plugins/notification-assets/lang/en.json +++ b/plugins/notification-assets/lang/en.json @@ -46,6 +46,8 @@ "UnstarDocument": "Unstar document", "Unsubscribe": "Unsubscribe", "Push": "Push", - "Unreads": "Unreads" + "Unreads": "Unreads", + "EnablePush": "Enable push notifications", + "NotificationBlockedInBrowser": "Notifications are blocked in your browser. Please enable notifications in your browser settings" } } diff --git a/plugins/notification-assets/lang/es.json b/plugins/notification-assets/lang/es.json index 9e84ebb7d2..8237c31222 100644 --- a/plugins/notification-assets/lang/es.json +++ b/plugins/notification-assets/lang/es.json @@ -45,6 +45,8 @@ "ArchiveAllConfirmationMessage": "¿Estás seguro de que quieres archivar todas las notificaciones? Esta operación no se puede deshacer.", "StarDocument": "Marcar documento", "UnstarDocument": "Desmarcar documento", - "Push": "Push" + "Push": "Push", + "EnablePush": "Habilitar notificaciones push", + "NotificationBlockedInBrowser": "Las notificaciones están bloqueadas en tu navegador. Por favor, habilita las notificaciones en la configuración de tu navegador." } } \ No newline at end of file diff --git a/plugins/notification-assets/lang/pt.json b/plugins/notification-assets/lang/pt.json index dce599e192..adbe17c023 100644 --- a/plugins/notification-assets/lang/pt.json +++ b/plugins/notification-assets/lang/pt.json @@ -45,6 +45,8 @@ "ArchiveAllConfirmationMessage": "Esta seguro que quer arquivar todas as notificações? Esta operação não se pode desfazer.", "StarDocument": "Marcar documento", "UnstarDocument": "Desmarcar documento", - "Push": "Push" + "Push": "Push", + "EnablePush": "Ativar notificações push", + "NotificationBlockedInBrowser": "Notificações bloqueadas no navegador. Por favor habilite las notificaciones en la configuración de su navegador." } } \ No newline at end of file diff --git a/plugins/notification-assets/lang/ru.json b/plugins/notification-assets/lang/ru.json index 1de20658a0..cc3165c383 100644 --- a/plugins/notification-assets/lang/ru.json +++ b/plugins/notification-assets/lang/ru.json @@ -46,6 +46,8 @@ "UnstarDocument": "Удалить из избранного", "Unsubscribe": "Отписаться", "Push": "Push", - "Unreads": "Непрочитанные" + "Unreads": "Непрочитанные", + "EnablePush": "Включить Push-уведомления", + "NotificationBlockedInBrowser": "Уведомления заблокированы в вашем браузере. Пожалуйста, включите уведомления в настройках браузера" } } diff --git a/plugins/notification-resources/src/components/BrowserNotificatator.svelte b/plugins/notification-resources/src/components/BrowserNotificatator.svelte index a2379e35f2..2a8ba34257 100644 --- a/plugins/notification-resources/src/components/BrowserNotificatator.svelte +++ b/plugins/notification-resources/src/components/BrowserNotificatator.svelte @@ -14,76 +14,50 @@ --> diff --git a/plugins/notification-resources/src/components/Notification.svelte b/plugins/notification-resources/src/components/Notification.svelte new file mode 100644 index 0000000000..4e3810ee0e --- /dev/null +++ b/plugins/notification-resources/src/components/Notification.svelte @@ -0,0 +1,52 @@ + + + + +
+ {#if sender} + + {/if} + + {value.body} + +
+
+ + + {#if value.onClickLocation} +