diff --git a/src/app.module.ts b/src/app.module.ts index 813841e0..b4795fe0 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -11,7 +11,7 @@ import { DragulaModule } from 'ng2-dragula/ng2-dragula'; import { Select2Module } from 'ng2-select2/ng2-select2'; import { AddOnComponent } from './components/add-on'; -import { KeymapAddComponent, KeymapComponent, KeymapHeaderComponent } from './components/keymap'; +import { KeymapAddComponent, KeymapEditComponent, KeymapHeaderComponent } from './components/keymap'; import { LayersComponent } from './components/layers'; import { MacroActionEditorComponent, @@ -79,7 +79,7 @@ const storeConfig = { @NgModule({ declarations: [ MainAppComponent, - KeymapComponent, + KeymapEditComponent, KeymapHeaderComponent, NotificationComponent, SvgIconTextKeyComponent, diff --git a/src/components/keymap/edit/keymap-edit.component.html b/src/components/keymap/edit/keymap-edit.component.html index 739ec17e..a929aedd 100644 --- a/src/components/keymap/edit/keymap-edit.component.html +++ b/src/components/keymap/edit/keymap-edit.component.html @@ -1,6 +1,6 @@
diff --git a/src/components/keymap/edit/keymap-edit.component.ts b/src/components/keymap/edit/keymap-edit.component.ts index 20fcf4f1..733ab737 100644 --- a/src/components/keymap/edit/keymap-edit.component.ts +++ b/src/components/keymap/edit/keymap-edit.component.ts @@ -15,13 +15,12 @@ import { AppState } from '../../../store'; import { getKeymap } from '../../../store/reducers/keymap'; @Component({ - selector: 'keymap', + selector: 'keymap-edit', template: require('./keymap-edit.component.html'), styles: [require('./keymap-edit.component.scss')] }) -export class KeymapComponent { +export class KeymapEditComponent { private keymap$: Observable; - private keymapDeleted: boolean = false; constructor( private store: Store, @@ -36,8 +35,4 @@ export class KeymapComponent { this.keymap$ = keymapConnectable; keymapConnectable.connect(); } - - onKeymapDelete() { - this.keymapDeleted = true; - } } diff --git a/src/components/keymap/header/keymap-header.component.ts b/src/components/keymap/header/keymap-header.component.ts index 145946f5..c429c981 100644 --- a/src/components/keymap/header/keymap-header.component.ts +++ b/src/components/keymap/header/keymap-header.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { Store } from '@ngrx/store'; @@ -14,7 +14,6 @@ import { KeymapActions } from '../../../store/actions'; }) export class KeymapHeaderComponent { @Input() keymap: Keymap; - @Output() deleted: EventEmitter = new EventEmitter(); constructor(private store: Store) { } @@ -25,7 +24,6 @@ export class KeymapHeaderComponent { } removeKeymap() { - this.deleted.emit(false); this.store.dispatch(KeymapActions.removeKeymap(this.keymap.abbreviation)); } diff --git a/src/components/keymap/keymap.routes.ts b/src/components/keymap/keymap.routes.ts index 57c40722..396a63e9 100644 --- a/src/components/keymap/keymap.routes.ts +++ b/src/components/keymap/keymap.routes.ts @@ -1,7 +1,7 @@ import { Routes } from '@angular/router'; import { KeymapAddComponent } from './add/keymap-add.component'; -import { KeymapComponent } from './edit/keymap-edit.component'; +import { KeymapEditComponent } from './edit/keymap-edit.component'; export const keymapRoutes: Routes = [ { @@ -11,7 +11,7 @@ export const keymapRoutes: Routes = [ }, { path: 'keymap', - component: KeymapComponent + component: KeymapEditComponent }, { path: 'keymap/add', @@ -19,6 +19,6 @@ export const keymapRoutes: Routes = [ }, { path: 'keymap/:abbr', - component: KeymapComponent + component: KeymapEditComponent } ]; diff --git a/src/components/svg/wrap/svg-keyboard-wrap.component.ts b/src/components/svg/wrap/svg-keyboard-wrap.component.ts index 0370b084..d6d2deab 100644 --- a/src/components/svg/wrap/svg-keyboard-wrap.component.ts +++ b/src/components/svg/wrap/svg-keyboard-wrap.component.ts @@ -91,7 +91,6 @@ export class SvgKeyboardWrapComponent implements OnChanges { @Input() keymap: Keymap; @Input() popoverEnabled: boolean = true; @Input() tooltipEnabled: boolean = false; - @Input() deleted: boolean = false; private popoverShown: boolean; private keyEditConfig: { keyActions: KeyAction[], keyId: number }; diff --git a/src/store/effects/keymap.ts b/src/store/effects/keymap.ts index f562b48c..73e48062 100644 --- a/src/store/effects/keymap.ts +++ b/src/store/effects/keymap.ts @@ -33,7 +33,7 @@ export class KeymapEffects { if (state.keymaps.entities.length === 0) { this.router.navigate(['/keymap/add']); } else { - let favourite: Keymap = state.keymaps.entities.find(keymap => keymap.isDefault); + const favourite: Keymap = state.keymaps.entities.find(keymap => keymap.isDefault); this.router.navigate(['/keymap', favourite.abbreviation]); } }); diff --git a/src/store/effects/macro.ts b/src/store/effects/macro.ts index 71af029a..af49de15 100644 --- a/src/store/effects/macro.ts +++ b/src/store/effects/macro.ts @@ -19,12 +19,12 @@ export class MacroEffects { .ofType(MacroActions.REMOVE) .withLatestFrom(this.store) .do((latest) => { - let state: AppState = latest[1]; + const state: AppState = latest[1]; if (state.macros.entities.length === 0) { this.router.navigate(['/macro/add']); } else { - this.router.navigate(['/macro']); + this.router.navigate(['/macro', '0']); } }); @@ -32,8 +32,8 @@ export class MacroEffects { .ofType(MacroActions.ADD) .withLatestFrom(this.store) .do((latest) => { - let state: AppState = latest[1]; - let macro: Macro = state.macros.entities[state.macros.entities.length - 1]; + const state: AppState = latest[1]; + const macro: Macro = state.macros.entities[state.macros.entities.length - 1]; this.router.navigate(['/macro', macro.id, 'new']); });