mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
Pause all notifications when hovering over board
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
<div class="alert {{notification.type}} alert-dismissible m-3 shadow" role="alert"
|
<div class="alert {{notification.type}} alert-dismissible m-3 shadow" role="alert"
|
||||||
(mouseenter)="isPaused$.next(true)"
|
|
||||||
(mouseleave)="isPaused$.next(false)"
|
|
||||||
[@enterLeave]="animate">
|
[@enterLeave]="animate">
|
||||||
|
|
||||||
<div class="notification-progress-loader position-absolute w-100" *ngIf="showProgressBar">
|
<div class="notification-progress-loader position-absolute w-100" *ngIf="showProgressBar">
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { BehaviorSubject, Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
ChangeDetectorRef,
|
ChangeDetectorRef,
|
||||||
@@ -48,6 +48,11 @@ export class NotificationComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
@Input() public notification = null as INotification;
|
@Input() public notification = null as INotification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this notification's countdown should be paused
|
||||||
|
*/
|
||||||
|
@Input() public isPaused$: Observable<boolean>;
|
||||||
|
|
||||||
// Progress bar variables
|
// Progress bar variables
|
||||||
public title: Observable<string>;
|
public title: Observable<string>;
|
||||||
public content: Observable<string>;
|
public content: Observable<string>;
|
||||||
@@ -66,7 +71,6 @@ export class NotificationComponent implements OnInit, OnDestroy {
|
|||||||
private count = 0;
|
private count = 0;
|
||||||
private start: any;
|
private start: any;
|
||||||
private diff: any;
|
private diff: any;
|
||||||
public isPaused$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
||||||
public animate: string;
|
public animate: string;
|
||||||
|
|
||||||
constructor(private notificationService: NotificationsService,
|
constructor(private notificationService: NotificationsService,
|
||||||
|
@@ -1,7 +1,10 @@
|
|||||||
<div class="notifications-wrapper position-fixed" [ngClass]="position">
|
<div class="notifications-wrapper position-fixed"
|
||||||
|
[ngClass]="position"
|
||||||
|
(mouseenter)="this.isPaused$.next(true);"
|
||||||
|
(mouseleave)="this.isPaused$.next(false);">
|
||||||
<ds-notification
|
<ds-notification
|
||||||
class="notification"
|
class="notification"
|
||||||
*ngFor="let a of notifications; let i = index"
|
*ngFor="let a of notifications; let i = index"
|
||||||
[notification]="a">
|
[notification]="a" [isPaused$]="isPaused$">
|
||||||
</ds-notification>
|
</ds-notification>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -9,7 +9,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
import { select, Store } from '@ngrx/store';
|
import { select, Store } from '@ngrx/store';
|
||||||
import { Subscription } from 'rxjs';
|
import { BehaviorSubject, Subscription } from 'rxjs';
|
||||||
import { difference } from 'lodash';
|
import { difference } from 'lodash';
|
||||||
|
|
||||||
import { NotificationsService } from '../notifications.service';
|
import { NotificationsService } from '../notifications.service';
|
||||||
@@ -44,6 +44,11 @@ export class NotificationsBoardComponent implements OnInit, OnDestroy {
|
|||||||
public rtl = false;
|
public rtl = false;
|
||||||
public animate: 'fade' | 'fromTop' | 'fromRight' | 'fromBottom' | 'fromLeft' | 'rotate' | 'scale' = 'fromRight';
|
public animate: 'fade' | 'fromTop' | 'fromRight' | 'fromBottom' | 'fromLeft' | 'rotate' | 'scale' = 'fromRight';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to pause the dismiss countdown of all notifications on the board
|
||||||
|
*/
|
||||||
|
public isPaused$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
constructor(private service: NotificationsService,
|
constructor(private service: NotificationsService,
|
||||||
private store: Store<AppState>,
|
private store: Store<AppState>,
|
||||||
private cdr: ChangeDetectorRef) {
|
private cdr: ChangeDetectorRef) {
|
||||||
@@ -129,7 +134,6 @@ export class NotificationsBoardComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (this.sub) {
|
if (this.sub) {
|
||||||
this.sub.unsubscribe();
|
this.sub.unsubscribe();
|
||||||
|
Reference in New Issue
Block a user