Skip to content

Commit a9d881e

Browse files
committed
Resolve comments
1 parent c476dfb commit a9d881e

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/editor.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,24 @@ export class VacuumCardEditor extends LitElement implements LovelaceCardEditor {
4747
selectedEntity: string | undefined,
4848
entities: string[],
4949
) {
50-
return html` <div class="option">
51-
<ha-select
52-
.label=${localize('editor.' + configValue)}
53-
@selected=${this.valueChanged}
54-
.configValue=${configValue}
55-
.value=${selectedEntity}
56-
@closed=${(e: Event) => e.stopPropagation()}
57-
fixedMenuPosition
58-
naturalMenuWidth
59-
>
60-
${entities.map(
61-
(entity) =>
62-
html` <mwc-list-item .value=${entity}>${entity}</mwc-list-item>`,
63-
)}
64-
</ha-select>
65-
</div>`;
50+
return html`
51+
<div class="option">
52+
<ha-select
53+
.label=${localize('editor.' + configValue)}
54+
@selected=${this.valueChanged}
55+
.configValue=${configValue}
56+
.value=${selectedEntity}
57+
@closed=${(e: Event) => e.stopPropagation()}
58+
fixedMenuPosition
59+
naturalMenuWidth
60+
>
61+
${entities.map(
62+
(entity) =>
63+
html` <mwc-list-item .value=${entity}>${entity}</mwc-list-item>`,
64+
)}
65+
</ha-select>
66+
</div>
67+
`;
6668
}
6769

6870
protected render(): Template {
@@ -75,7 +77,7 @@ export class VacuumCardEditor extends LitElement implements LovelaceCardEditor {
7577
...this.getEntitiesByType('camera'),
7678
...this.getEntitiesByType('image'),
7779
];
78-
const selectEntities = [this.getEntitiesByType('select')][0];
80+
const selectEntities = this.getEntitiesByType('select');
7981

8082
return html`
8183
<div class="card-config">

src/vacuum-card.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,11 @@ export class VacuumCard extends LitElement {
248248

249249
private renderDropDown(
250250
selectedObject: string,
251-
objects: {
252-
[key: string]: any;
253-
},
251+
items: Record<string, any>,
254252
icon: string,
255253
onSelected: Function,
256254
): Template {
257-
const selected = objects.indexOf(selectedObject);
255+
const selected = items.indexOf(selectedObject);
258256

259257
return html`
260258
<div class="tip">
@@ -266,7 +264,7 @@ export class VacuumCard extends LitElement {
266264
selectedObject}
267265
</span>
268266
</div>
269-
${objects.map(
267+
${items.map(
270268
(item: string, index: number) => html`
271269
<mwc-list-item
272270
?activated=${selected === index}

0 commit comments

Comments
 (0)