Add default keymap icon hint
This commit is contained in:
committed by
József Farkas
parent
8f930092df
commit
56c386bb7b
@@ -1,4 +1,4 @@
|
||||
import { Component, ElementRef, Input, Renderer, ViewChild } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, ElementRef, Input, OnChanges, Renderer, ViewChild } from '@angular/core';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
@@ -10,15 +10,22 @@ import { KeymapActions } from '../../../store/actions';
|
||||
@Component({
|
||||
selector: 'keymap-header',
|
||||
template: require('./keymap-header.component.html'),
|
||||
styles: [require('./keymap-header.component.scss')]
|
||||
styles: [require('./keymap-header.component.scss')],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class KeymapHeaderComponent {
|
||||
export class KeymapHeaderComponent implements OnChanges {
|
||||
@Input() keymap: Keymap;
|
||||
@ViewChild('name') keymapName: ElementRef;
|
||||
@ViewChild('abbr') keymapAbbr: ElementRef;
|
||||
|
||||
private starTitle: string;
|
||||
|
||||
constructor(private store: Store<AppState>, private renderer: Renderer) { }
|
||||
|
||||
ngOnChanges() {
|
||||
this.setTitle();
|
||||
}
|
||||
|
||||
setDefault() {
|
||||
if (!this.keymap.isDefault) {
|
||||
this.store.dispatch(KeymapActions.setDefault(this.keymap.abbreviation));
|
||||
@@ -51,4 +58,10 @@ export class KeymapHeaderComponent {
|
||||
newAbbr = newAbbr.toUpperCase();
|
||||
this.store.dispatch(KeymapActions.editKeymapAbbr(this.keymap.abbreviation, newAbbr));
|
||||
}
|
||||
|
||||
setTitle(): void {
|
||||
this.starTitle = this.keymap.isDefault
|
||||
? 'This is the default keymap which gets activated when powering the keyboard.'
|
||||
: 'Makes this keymap the default keymap which gets activated when powering the keyboard.';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user