* feat(notification): Add undoable notification * feat(notification): Add undoable notification * feat(notification): Use uhk-header to the notification * half ready solution * - fix: "Keymap has been deleted" is displayed for macros. - When a keymap/macro deletion gets undone, please set the route of the restored keymap/macro. - When the user switches to another route, please make the undo notification disappear. * fix(keymap): Store prev user configuration in the application reducer Store the previous state in application reducer, because refactoring the user-config reducer is not easy * feat(keymap): Fix review request
This commit is contained in:
committed by
László Monda
parent
ce55cac380
commit
42683e32f9
@@ -1,3 +1,12 @@
|
||||
<div>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<undoable-notifier [notification]="undoableNotification$ | async"
|
||||
(close)="onDismissLastNotification()"
|
||||
(undo)="onUndoLastNotification($event)">
|
||||
</undoable-notifier>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { Notification } from '../../models/notification';
|
||||
import { AppState, getUndoableNotification } from '../../store/index';
|
||||
import { DismissUndoNotificationAction, UndoLastAction } from '../../store/actions/app.action';
|
||||
|
||||
@Component({
|
||||
selector: 'uhk-header',
|
||||
@@ -6,4 +12,18 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class UhkHeader {
|
||||
undoableNotification$: Observable<Notification>;
|
||||
|
||||
constructor(private store: Store<AppState>) {
|
||||
this.undoableNotification$ = this.store.select(getUndoableNotification);
|
||||
}
|
||||
|
||||
onUndoLastNotification(data: any): void {
|
||||
this.store.dispatch(new UndoLastAction(data));
|
||||
}
|
||||
|
||||
onDismissLastNotification(): void {
|
||||
this.store.dispatch(new DismissUndoNotificationAction());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user