From ca07790597c17ac4b7c4755bbc583af0a24b3bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 3 Nov 2020 12:57:30 +0200 Subject: [PATCH 1/3] Clear toasts on navigation events --- .../src/app/notification/notification.service.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/notification/notification.service.ts b/apps/red-ui/src/app/notification/notification.service.ts index 319c1d1ff..edf75d17a 100644 --- a/apps/red-ui/src/app/notification/notification.service.ts +++ b/apps/red-ui/src/app/notification/notification.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; import { ActiveToast, ToastrService } from 'ngx-toastr'; import { IndividualConfig } from 'ngx-toastr/toastr/toastr-config'; +import { NavigationStart, Router } from '@angular/router'; export enum NotificationType { SUCCESS = 'SUCCESS', @@ -19,7 +20,17 @@ export class Action { providedIn: 'root' }) export class NotificationService { - constructor(private readonly _snackBar: MatSnackBar, private readonly _toastr: ToastrService) {} + constructor( + private readonly _snackBar: MatSnackBar, + private readonly _toastr: ToastrService, + private readonly _router: Router + ) { + _router.events.subscribe((event) => { + if (event instanceof NavigationStart) { + this._toastr.clear(); + } + }); + } showToastNotification( message: string, From 6733c4e7a838f69c4be4d051e11ddb39499910e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 3 Nov 2020 13:38:12 +0200 Subject: [PATCH 2/3] Style tooltips --- .../initials-avatar.component.html | 2 +- .../file-preview-screen.component.html | 1 + .../project-listing-screen.component.html | 4 + .../project-overview-screen.component.html | 104 ++++++++++-------- .../upload-status-overlay.component.html | 43 +++++--- apps/red-ui/src/assets/styles/red-theme.scss | 1 + .../src/assets/styles/red-tooltips.scss | 28 +++++ 7 files changed, 118 insertions(+), 65 deletions(-) create mode 100644 apps/red-ui/src/assets/styles/red-tooltips.scss diff --git a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html index 858e82d99..8b3416dd2 100644 --- a/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html +++ b/apps/red-ui/src/app/common/initials-avatar/initials-avatar.component.html @@ -1,4 +1,4 @@ -
+
{{ initials }}
{{ username || ('initials-avatar.unassigned.label' | translate) }} diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index 3f73c2bc2..7c2c5a804 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -47,6 +47,7 @@ : 'project-overview.under-approval' ) | translate " + [matTooltipPosition]="'above'" > diff --git a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html index f60684eb6..d3468fce3 100644 --- a/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html +++ b/apps/red-ui/src/app/screens/project-listing-screen/project-listing-screen.component.html @@ -167,6 +167,7 @@ diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html index 705dab213..c9e18a25e 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.html @@ -11,28 +11,28 @@
@@ -61,10 +61,10 @@
{{ @@ -76,10 +76,10 @@
-
+
-
+
-
+
-
+
{{ fileStatus.filename }}
@@ -182,12 +185,12 @@
-
+
{{ fileStatus.added | date: 'd MMM. yyyy, hh:mm a' }}
-
+
-
+
-
+
diff --git a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html index fe8922229..5526ff1ae 100644 --- a/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html +++ b/apps/red-ui/src/app/upload/upload-status-dialog/upload-status-overlay.component.html @@ -1,12 +1,12 @@
-
+
{{ 'upload-status.dialog.title.label' | translate: { p1: uploadService.files.length } }}
-
+
-
+
@@ -17,49 +17,60 @@
-
+
{{ model.file?.name }}
-
+
{{ model.progress }}%
-
+
-
+
-
-
+
+
{{ model.error.message }}
- key + + key
-
+
diff --git a/apps/red-ui/src/assets/styles/red-theme.scss b/apps/red-ui/src/assets/styles/red-theme.scss index b45176af5..8c13d84fc 100644 --- a/apps/red-ui/src/assets/styles/red-theme.scss +++ b/apps/red-ui/src/assets/styles/red-theme.scss @@ -18,3 +18,4 @@ @import 'red-controls'; @import 'red-logo'; @import 'red-toasts'; +@import 'red-tooltips'; diff --git a/apps/red-ui/src/assets/styles/red-tooltips.scss b/apps/red-ui/src/assets/styles/red-tooltips.scss new file mode 100644 index 000000000..efe8a669b --- /dev/null +++ b/apps/red-ui/src/assets/styles/red-tooltips.scss @@ -0,0 +1,28 @@ +@import 'red-variables'; + +.mat-tooltip { + background-color: $accent; + border-radius: 3px; + padding: 10px; + font-family: Inter, sans-serif; + font-size: 11px; + line-height: 14px; + color: white; + position: relative; + overflow: visible !important; + text-align: center; +} + +.mat-tooltip:after { + content: ''; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + width: 0; + height: 0; + border-top: solid 6px $accent; + border-left: solid 5px transparent; + border-right: solid 5px transparent; + z-index: 3000; +} From bf01364cf349423698e91cd31027a2689bc075b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 3 Nov 2020 13:51:58 +0200 Subject: [PATCH 3/3] Remove toast clear in project overview --- apps/red-ui/src/app/notification/notification.service.ts | 3 +-- .../project-overview-screen.component.ts | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/red-ui/src/app/notification/notification.service.ts b/apps/red-ui/src/app/notification/notification.service.ts index edf75d17a..ef6615075 100644 --- a/apps/red-ui/src/app/notification/notification.service.ts +++ b/apps/red-ui/src/app/notification/notification.service.ts @@ -32,7 +32,7 @@ export class NotificationService { }); } - showToastNotification( + public showToastNotification( message: string, title?: string, notificationType: NotificationType = NotificationType.INFO, @@ -43,7 +43,6 @@ export class NotificationService { return this._toastr.error(message, title, options); case NotificationType.SUCCESS: return this._toastr.success(message, title, options); - break; case NotificationType.WARNING: return this._toastr.warning(message, title, options); case NotificationType.INFO: diff --git a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts index c4f21c77d..62831d654 100644 --- a/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts +++ b/apps/red-ui/src/app/screens/project-overview-screen/project-overview-screen.component.ts @@ -43,7 +43,6 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { @ViewChild('sortingComponent', { static: true }) public sortingComponent: SortingComponent; public sortingOption: SortingOption = { column: 'added', order: 'desc' }; - private _rulesChangedToast: ActiveToast; constructor( public readonly appStateService: AppStateService, @@ -79,9 +78,6 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { ngOnDestroy(): void { this._fileDropOverlayService.cleanupFileDropHandling(); - if (this._rulesChangedToast && this._rulesChangedToast.toastRef) { - this._rulesChangedToast.toastRef.close(); - } } public get user() { @@ -116,7 +112,7 @@ export class ProjectOverviewScreenComponent implements OnInit, OnDestroy { return; } - this._rulesChangedToast = this._notificationService.showToastNotification( + this._notificationService.showToastNotification( `${this._translateService.instant( 'project-overview.new-rule.toast.message.label' )} ${this._translateService.instant(