diff --git a/packages/panel/package.json b/packages/panel/package.json index d619f7faa5..564a1aaca8 100644 --- a/packages/panel/package.json +++ b/packages/panel/package.json @@ -38,6 +38,7 @@ "@anticrm/core": "~0.6.11", "@anticrm/chunter": "~0.6.0", "@anticrm/presentation": "~0.6.2", - "@anticrm/activity": "~0.6.0" + "@anticrm/activity": "~0.6.0", + "@anticrm/notification": "~0.6.0" } } diff --git a/packages/panel/src/components/Panel.svelte b/packages/panel/src/components/Panel.svelte index 28aabd4b79..bec297b2bc 100644 --- a/packages/panel/src/components/Panel.svelte +++ b/packages/panel/src/components/Panel.svelte @@ -16,9 +16,9 @@
-
+
+
+
{object.title}
+
-
-
{object.title}
+
+
+ { + showMenu(evt) + }} + icon={IconMoreH} + size={'small'} + />
{#if object.$lookup?.attachedTo} - + {/if}
{#if (object.attachments ?? 0) > 0} @@ -55,16 +67,6 @@ {#if (object.comments ?? 0) > 0}
{/if} -
- { - showMenu(evt) - }} - icon={IconMoreH} - size={'small'} - /> -
@@ -79,11 +81,6 @@ user-select: none; backdrop-filter: blur(10px); - .content { - display: flex; - justify-content: space-between; - margin-bottom: 1rem; - } &.draggable { cursor: grab; } diff --git a/plugins/notification-assets/assets/icons.svg b/plugins/notification-assets/assets/icons.svg index 0128407a4b..baf085097f 100644 --- a/plugins/notification-assets/assets/icons.svg +++ b/plugins/notification-assets/assets/icons.svg @@ -2,4 +2,12 @@ + + + + + + + diff --git a/plugins/notification-assets/lang/en.json b/plugins/notification-assets/lang/en.json index 6c4ea3f620..b3dae1168a 100644 --- a/plugins/notification-assets/lang/en.json +++ b/plugins/notification-assets/lang/en.json @@ -6,6 +6,8 @@ "NoNotifications": "No notifications", "MentionNotification": "Mentioned", "EmailNotification": "by email", - "PlatformNotification": "in platform" + "PlatformNotification": "in platform", + "Track": "Track", + "DontTrack": "Don't track" } } \ No newline at end of file diff --git a/plugins/notification-assets/lang/ru.json b/plugins/notification-assets/lang/ru.json index 9063ca4cc1..c773ab0590 100644 --- a/plugins/notification-assets/lang/ru.json +++ b/plugins/notification-assets/lang/ru.json @@ -6,6 +6,8 @@ "NoNotifications": "Нет уведомлений", "MentionNotification": "Упомянул", "EmailNotification": "по email", - "PlatformNotification": "в системе" + "PlatformNotification": "в системе", + "Track": "Отслеживать", + "DontTrack": "Не отслеживать" } } \ No newline at end of file diff --git a/plugins/notification-assets/src/index.ts b/plugins/notification-assets/src/index.ts index 24639b1454..b48484ea5e 100644 --- a/plugins/notification-assets/src/index.ts +++ b/plugins/notification-assets/src/index.ts @@ -18,7 +18,9 @@ import notification, { notificationId } from '@anticrm/notification' const icons = require('../assets/icons.svg') as string // eslint-disable-line loadMetadata(notification.icon, { - Notifications: `${icons}#notification` + Notifications: `${icons}#notification`, + Track: `${icons}#track`, + DontTrack: `${icons}#donttrack` }) addStringsLoader(notificationId, async (lang: string) => await import(`../lang/${lang}.json`)) diff --git a/plugins/notification-resources/src/components/LastViewEditor.svelte b/plugins/notification-resources/src/components/LastViewEditor.svelte new file mode 100644 index 0000000000..4301971ec7 --- /dev/null +++ b/plugins/notification-resources/src/components/LastViewEditor.svelte @@ -0,0 +1,33 @@ + + + +{#if !subscribed} + { notificationClient.updateLastView(value._id, value._class, undefined, true) }} /> +{:else} + { notificationClient.unsubscribe(value._id) }} /> +{/if} diff --git a/plugins/notification-resources/src/components/NotificationPresenter.svelte b/plugins/notification-resources/src/components/NotificationPresenter.svelte new file mode 100644 index 0000000000..665ec81bdf --- /dev/null +++ b/plugins/notification-resources/src/components/NotificationPresenter.svelte @@ -0,0 +1,39 @@ + + + +{#if hasNotification} +
+{/if} + + \ No newline at end of file diff --git a/plugins/notification-resources/src/index.ts b/plugins/notification-resources/src/index.ts index b60c3561e1..03cfc3ff57 100644 --- a/plugins/notification-resources/src/index.ts +++ b/plugins/notification-resources/src/index.ts @@ -17,12 +17,16 @@ import { Resources } from '@anticrm/platform' import NotificationsPopup from './components/NotificationsPopup.svelte' import NotificationSettings from './components/NotificationSettings.svelte' +import NotificationPresenter from './components/NotificationPresenter.svelte' +import LastViewEditor from './components/LastViewEditor.svelte' export * from './utils' export default async (): Promise => ({ component: { NotificationsPopup, - NotificationSettings + NotificationPresenter, + NotificationSettings, + LastViewEditor } }) diff --git a/plugins/notification-resources/src/plugin.ts b/plugins/notification-resources/src/plugin.ts index bb5f376c5d..f1a04f7531 100644 --- a/plugins/notification-resources/src/plugin.ts +++ b/plugins/notification-resources/src/plugin.ts @@ -14,13 +14,15 @@ // limitations under the License. */ -import type { IntlString } from '@anticrm/platform' +import type { Asset, IntlString } from '@anticrm/platform' import { mergeIds } from '@anticrm/platform' import notification, { notificationId } from '@anticrm/notification' export default mergeIds(notificationId, notification, { string: { - NoNotifications: '' as IntlString + NoNotifications: '' as IntlString, + Track: '' as IntlString, + DontTrack: '' as IntlString } }) diff --git a/plugins/notification-resources/src/utils.ts b/plugins/notification-resources/src/utils.ts index 3da301b380..b6281c0e60 100644 --- a/plugins/notification-resources/src/utils.ts +++ b/plugins/notification-resources/src/utils.ts @@ -24,7 +24,7 @@ import { writable, Writable } from 'svelte/store' */ export class NotificationClient { protected static _instance: NotificationClient | undefined = undefined - private readonly lastViews = new Map, LastView>() + private lastViews = new Map, LastView>() private readonly lastViewsStore = writable(new Map, Timestamp>()) private readonly lastViewQuery = createQuery() @@ -32,10 +32,12 @@ export class NotificationClient { private constructor () { this.lastViewQuery.query(notification.class.LastView, { user: getCurrentAccount()._id }, (result) => { const res: Map, Timestamp> = new Map, Timestamp>() + const lastViews: Map, LastView> = new Map, LastView>() result.forEach((p) => { res.set(p.attachedTo, p.lastView) - this.lastViews.set(p.attachedTo, p) + lastViews.set(p.attachedTo, p) }) + this.lastViews = lastViews this.lastViewsStore.set(res) }) } @@ -59,6 +61,9 @@ export class NotificationClient { ): Promise { const client = getClient() const user = getCurrentAccount()._id + console.log('SUBSCRIBE') + console.log('USER') + console.log(user) const lastView = time ?? new Date().getTime() const current = this.lastViews.get(_id) if (current !== undefined) { @@ -85,6 +90,9 @@ export class NotificationClient { async unsubscribe (_id: Ref): Promise { const client = getClient() const user = getCurrentAccount()._id + console.log('UNSUBSCRIBE') + console.log('USER') + console.log(user) const current = await client.findOne(notification.class.LastView, { attachedTo: _id, user }) if (current !== undefined) { await client.removeDoc(current._class, current.space, current._id) diff --git a/plugins/notification/src/index.ts b/plugins/notification/src/index.ts index 143bab9d21..c72f03b97f 100644 --- a/plugins/notification/src/index.ts +++ b/plugins/notification/src/index.ts @@ -102,10 +102,14 @@ const notification = plugin(notificationId, { NotificationSettings: '' as Ref }, component: { - NotificationsPopup: '' as AnyComponent + NotificationsPopup: '' as AnyComponent, + NotificationPresenter: '' as AnyComponent, + LastViewEditor: '' as AnyComponent }, icon: { - Notifications: '' as Asset + Notifications: '' as Asset, + Track: '' as Asset, + DontTrack: '' as Asset }, space: { Notifications: '' as Ref diff --git a/plugins/recruit-resources/package.json b/plugins/recruit-resources/package.json index 411e1f9509..692397f3ee 100644 --- a/plugins/recruit-resources/package.json +++ b/plugins/recruit-resources/package.json @@ -54,6 +54,7 @@ "@anticrm/task-resources": "~0.6.0", "@anticrm/contact-resources": "~0.6.0", "@anticrm/rekoni": "~0.6.0", + "@anticrm/notification": "~0.6.0", "@anticrm/tags": "~0.6.0" } } diff --git a/plugins/recruit-resources/src/components/Candidates.svelte b/plugins/recruit-resources/src/components/Candidates.svelte index 61a5b9d9b2..e4f7c4e608 100644 --- a/plugins/recruit-resources/src/components/Candidates.svelte +++ b/plugins/recruit-resources/src/components/Candidates.svelte @@ -82,7 +82,7 @@ config={descr.config} options={descr.options} query={ resultQuery } - enableChecking + showNotification /> {/if} {/await} diff --git a/plugins/recruit-resources/src/components/KanbanCard.svelte b/plugins/recruit-resources/src/components/KanbanCard.svelte index b44bcce8fd..363c5874f0 100644 --- a/plugins/recruit-resources/src/components/KanbanCard.svelte +++ b/plugins/recruit-resources/src/components/KanbanCard.svelte @@ -19,9 +19,10 @@ import type { WithLookup } from '@anticrm/core' import { Avatar } from '@anticrm/presentation' import type { Applicant } from '@anticrm/recruit' - import { ActionIcon, IconMoreH, showPanel } from '@anticrm/ui' + import { ActionIcon, Component, IconMoreH, showPanel } from '@anticrm/ui' import view from '@anticrm/view' import ApplicationPresenter from './ApplicationPresenter.svelte' + import notification from '@anticrm/notification' export let object: WithLookup export let draggable: boolean @@ -33,14 +34,21 @@
- -
-
- {formatName(object.$lookup?.attachedTo?.name)} +
+ +
+
+ {formatName(object.$lookup?.attachedTo?.name)} +
+
{object.$lookup?.attachedTo?.title ?? ''}
-
{object.$lookup?.attachedTo?.title ?? ''}
-
+
+
+ +
+ +
diff --git a/plugins/tags-resources/src/components/TagsView.svelte b/plugins/tags-resources/src/components/TagsView.svelte index 8a93285910..680c391bd6 100644 --- a/plugins/tags-resources/src/components/TagsView.svelte +++ b/plugins/tags-resources/src/components/TagsView.svelte @@ -101,6 +101,6 @@ ]} options={opt} query={resultQuery} - enableChecking + showNotification /> diff --git a/plugins/task-resources/package.json b/plugins/task-resources/package.json index 1e5885ff9e..92202e54af 100644 --- a/plugins/task-resources/package.json +++ b/plugins/task-resources/package.json @@ -46,6 +46,7 @@ "@anticrm/login": "~0.6.1", "@anticrm/attachment-resources": "~0.6.0", "@anticrm/chunter-resources": "~0.6.0", - "@anticrm/workbench": "~0.6.1" + "@anticrm/workbench": "~0.6.1", + "@anticrm/notification": "~0.6.0" } } diff --git a/plugins/task-resources/src/components/KanbanCard.svelte b/plugins/task-resources/src/components/KanbanCard.svelte index afac3b80ad..a02005abd9 100644 --- a/plugins/task-resources/src/components/KanbanCard.svelte +++ b/plugins/task-resources/src/components/KanbanCard.svelte @@ -18,10 +18,11 @@ import type { WithLookup } from '@anticrm/core' import { Avatar } from '@anticrm/presentation' import type { Issue } from '@anticrm/task' - import { ActionIcon, IconMoreH, showPopup } from '@anticrm/ui' + import { ActionIcon, Component, IconMoreH, showPopup } from '@anticrm/ui' import { ContextMenu } from '@anticrm/view-resources' import task from '../plugin' import TaskPresenter from './TaskPresenter.svelte' + import notification from '@anticrm/notification' export let object: WithLookup export let draggable: boolean @@ -34,7 +35,12 @@
- { showMenu(evt) }} icon={IconMoreH} size={'small'} /> +
+
+ +
+ { showMenu(evt) }} icon={IconMoreH} size={'small'} /> +
{object.name}
@@ -47,9 +53,7 @@
{/if}
- {#if object.$lookup?.assignee} - - {/if} +
diff --git a/plugins/task-resources/src/components/StatusTableView.svelte b/plugins/task-resources/src/components/StatusTableView.svelte index df4e397453..744fb8e00c 100644 --- a/plugins/task-resources/src/components/StatusTableView.svelte +++ b/plugins/task-resources/src/components/StatusTableView.svelte @@ -146,7 +146,7 @@
- +
diff --git a/plugins/task-resources/src/components/TaskPresenter.svelte b/plugins/task-resources/src/components/TaskPresenter.svelte index f8a5548a67..5aed21711d 100644 --- a/plugins/task-resources/src/components/TaskPresenter.svelte +++ b/plugins/task-resources/src/components/TaskPresenter.svelte @@ -31,5 +31,5 @@
- {#if shortLabel}
diff --git a/plugins/view-resources/package.json b/plugins/view-resources/package.json index 3bf55df5ec..89ac928ccb 100644 --- a/plugins/view-resources/package.json +++ b/plugins/view-resources/package.json @@ -38,6 +38,7 @@ "@anticrm/view": "~0.6.0", "@anticrm/ui": "~0.6.0", "@anticrm/task": "~0.6.0", + "@anticrm/notification": "~0.6.0", "@anticrm/presentation": "~0.6.2" } } diff --git a/plugins/view-resources/src/components/Table.svelte b/plugins/view-resources/src/components/Table.svelte index 087b2ab19b..9393e7abec 100644 --- a/plugins/view-resources/src/components/Table.svelte +++ b/plugins/view-resources/src/components/Table.svelte @@ -17,15 +17,17 @@ import type { Class, Doc, DocumentQuery, FindOptions, Ref } from '@anticrm/core' import { SortingOrder } from '@anticrm/core' import { createQuery, getClient } from '@anticrm/presentation' - import { CheckBox, IconDown, IconUp, Label, Loading, showPopup, Spinner } from '@anticrm/ui' + import { Component, CheckBox, IconDown, IconUp, Label, Loading, showPopup, Spinner } from '@anticrm/ui' import { BuildModelKey } from '@anticrm/view' import { buildModel, LoadingProps } from '../utils' import MoreV from './icons/MoreV.svelte' import Menu from './Menu.svelte' + import notification from '@anticrm/notification' export let _class: Ref> export let query: DocumentQuery export let enableChecking: boolean = false + export let showNotification: boolean = false export let options: FindOptions | undefined = undefined export let baseMenuClass: Ref> | undefined = undefined export let config: (BuildModelKey | string)[] @@ -123,23 +125,26 @@ {/if} {:then model} -
+
- {#each model as attribute, cellHead} - {#if enableChecking && !cellHead} - - {/if} + {#if enableChecking} + + {/if} + {#if showNotification} + + {/if} + {#each model as attribute} + {/if}
-
0}> - 0} - on:change={(e) => { - objects.map((o) => check(o._id, e)) - }} - /> -
-
+
0}> + 0} + on:change={(e) => { + objects.map((o) => check(o._id, e)) + }} + /> +
+
{/if} + {#if showNotification} + + +
- +
diff --git a/plugins/workbench-resources/package.json b/plugins/workbench-resources/package.json index 71584697e4..a537e14de4 100644 --- a/plugins/workbench-resources/package.json +++ b/plugins/workbench-resources/package.json @@ -41,6 +41,7 @@ "@anticrm/login": "~0.6.1", "@anticrm/setting": "~0.6.0", "@anticrm/notification": "~0.6.0", + "@anticrm/notification-resources": "~0.6.0", "@anticrm/contact": "~0.6.2", "@anticrm/view-resources": "~0.6.0" } diff --git a/plugins/workbench-resources/src/components/Archive.svelte b/plugins/workbench-resources/src/components/Archive.svelte index 692152ebf3..72505814cf 100644 --- a/plugins/workbench-resources/src/components/Archive.svelte +++ b/plugins/workbench-resources/src/components/Archive.svelte @@ -64,7 +64,6 @@ _class={spaceSample._class} config={['name', 'company', 'location', 'modifiedOn']} options={{}} - enableChecking={true} baseMenuClass={core.class.Space} query={{ _class: { $in: model?.spaces.map(x => x.spaceClass) ?? [] }, diff --git a/plugins/workbench-resources/src/components/Workbench.svelte b/plugins/workbench-resources/src/components/Workbench.svelte index 2b952122a5..330df35337 100644 --- a/plugins/workbench-resources/src/components/Workbench.svelte +++ b/plugins/workbench-resources/src/components/Workbench.svelte @@ -42,10 +42,12 @@ import Navigator from './Navigator.svelte' import SpaceView from './SpaceView.svelte' import notification, { NotificationStatus } from '@anticrm/notification' + import { NotificationClient } from '@anticrm/notification-resources' export let client: Client setClient(client) + NotificationClient.getClient() let currentApp: Ref | undefined let currentSpace: Ref | undefined