Remove placeholder in keymap-tab

This commit is contained in:
Farkas József
2016-11-20 21:04:39 +01:00
committed by József Farkas
parent 34eb09ee9c
commit 064d2eb29a
3 changed files with 28 additions and 25 deletions

View File

@@ -1,17 +1,22 @@
<div>
<b>Switch to keymap:</b>
<select2
[data]="keymapOptions"
[value]="selectedKeymap?.abbreviation || -1"
(valueChanged)="onChange($event)"
[width]="'100%'"
></select2>
</div>
<div>
<div class="empty" *ngIf="!selectedKeymap?.abbreviation">
<img src="./images/base-layer--blank.svg">
<template [ngIf]="keymapOptions.length === 0">
<span> No keymaps are available to choose from. Create a keymap first! </span>
</template>
<template [ngIf]="keymapOptions.length > 0">
<div>
<b>Switch to keymap:</b>
<select2
[data]="keymapOptions"
[value]="selectedKeymap?.abbreviation || -1"
(valueChanged)="onChange($event)"
[width]="'100%'"
></select2>
</div>
<svg-keyboard *ngIf="selectedKeymap?.abbreviation"
[moduleConfig]="selectedKeymap.layers[0].modules">
</svg-keyboard>
</div>
<div>
<div class="empty" *ngIf="!selectedKeymap?.abbreviation">
<img src="./images/base-layer--blank.svg">
</div>
<svg-keyboard *ngIf="selectedKeymap?.abbreviation"
[moduleConfig]="selectedKeymap.layers[0].modules">
</svg-keyboard>
</div>
</template>

View File

@@ -2,6 +2,10 @@
display: flex;
flex-direction: column;
> span {
text-align: center;
}
> div {
display: flex;
margin-top: 2px;

View File

@@ -31,15 +31,9 @@ export class KeymapTabComponent implements OnInit, Tab {
text: keymap.name
};
});
this.keymapOptions = [
{
id: '-1',
text: 'Switch to keymap'
},
...this.keymapOptions
];
if (this.keymaps.length > 0) {
this.selectedKeymap = this.keymaps[0];
}
this.fromKeyAction(this.defaultKeyAction);
}