import { ChangeDetectionStrategy , Component } from '@angular/core' ; import { Store } from '@ngrx/store' ; import { Observable } from 'rxjs' ; import { Notification } from 'uhk-common' ; import { AppState , getUndoableNotification } from '../../store' ; import { DismissUndoNotificationAction , UndoLastAction } from '../../store/actions/app' ; @ Component ( { selector : 'uhk-header' , templateUrl : './uhk-header.html' , changeDetection : ChangeDetectionStrategy . OnPush } ) export class UhkHeader { undoableNotification$ : Observable < Notification > ; constructor ( private store ) { this . undoableNotification$ = this . store . select ( getUndoableNotification ) ; } onUndoLastNotification ( data ) { this . store . dispatch ( new UndoLastAction ( data ) ) ; } onDismissLastNotification ( ) { this . store . dispatch ( new DismissUndoNotificationAction ( ) ) ; } }