From aad051abd6a8464fbb1bfe75729a64fca41ac886 Mon Sep 17 00:00:00 2001 From: Vadim Lev Date: Mon, 26 Dec 2022 15:17:15 +0200 Subject: [PATCH] refactor elsa notif service + design refactor --- .../src/components.d.ts | 2 + .../workflow-toolbar/workflow-toolbar.tsx | 20 ++- .../elsa-workflows-designer/src/index.html | 1 - .../notifications/notification-awhile.tsx | 76 +++++----- .../notifications/notification-manager.tsx | 142 +++++++++--------- .../notifications/notification-service.ts | 13 +- .../notifications/notification-store.ts | 1 + .../modules/workflow-definitions/plugin.tsx | 2 +- 8 files changed, 140 insertions(+), 117 deletions(-) diff --git a/src/designer/elsa-workflows-designer/src/components.d.ts b/src/designer/elsa-workflows-designer/src/components.d.ts index ac2c21708..d02b09e94 100644 --- a/src/designer/elsa-workflows-designer/src/components.d.ts +++ b/src/designer/elsa-workflows-designer/src/components.d.ts @@ -212,6 +212,7 @@ export namespace Components { interface ElsaNewButton { } interface ElsaNotificationsManager { + "modalState": boolean; } interface ElsaPager { "page": number; @@ -1029,6 +1030,7 @@ declare namespace LocalJSX { "onNewClicked"?: (event: ElsaNewButtonCustomEvent) => void; } interface ElsaNotificationsManager { + "modalState"?: boolean; } interface ElsaPager { "onPaginated"?: (event: ElsaPagerCustomEvent) => void; diff --git a/src/designer/elsa-workflows-designer/src/components/toolbar/workflow-toolbar/workflow-toolbar.tsx b/src/designer/elsa-workflows-designer/src/components/toolbar/workflow-toolbar/workflow-toolbar.tsx index a2874a2e4..20f9d20d5 100644 --- a/src/designer/elsa-workflows-designer/src/components/toolbar/workflow-toolbar/workflow-toolbar.tsx +++ b/src/designer/elsa-workflows-designer/src/components/toolbar/workflow-toolbar/workflow-toolbar.tsx @@ -1,30 +1,37 @@ -import {Component, h} from '@stencil/core'; +import {Component, State, h} from '@stencil/core'; import Container from 'typedi'; import {NotificationEventTypes} from '../../../modules/notifications/event-types'; import {EventBus} from '../../../services'; import toolbarComponentStore from "../../../data/toolbar-component-store"; +import notificationService from '../../../modules/notifications/notification-service'; +import notificationStore from "../../../modules/notifications/notification-store"; @Component({ tag: 'elsa-workflow-toolbar', }) export class WorkflowToolbar { + @State() public modalState: boolean = false; private readonly eventBus: EventBus; - + static NotificationService = notificationService; constructor() { this.eventBus = Container.get(EventBus); } onNotificationClick = e => { e.stopPropagation(); - this.eventBus.emit(NotificationEventTypes.Toggle, this); + // this.eventBus.emit(NotificationEventTypes.Toggle, this); + WorkflowToolbar.NotificationService.toogleNotification(); + this.modalState = !this.modalState; }; render() { + const { notifications, infoPanelBoolean } = notificationStore; return ( +
+ + {notifications && notifications.map(item => { + + })} +
); } } diff --git a/src/designer/elsa-workflows-designer/src/index.html b/src/designer/elsa-workflows-designer/src/index.html index daba63f2b..572de60bb 100644 --- a/src/designer/elsa-workflows-designer/src/index.html +++ b/src/designer/elsa-workflows-designer/src/index.html @@ -16,7 +16,6 @@
-