diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts
index b8f5d6b062..de6da85887 100644
--- a/src/panels/config/scene/ha-scene-dashboard.ts
+++ b/src/panels/config/scene/ha-scene-dashboard.ts
@@ -1,30 +1,28 @@
-import {
- LitElement,
- TemplateResult,
- html,
- CSSResultArray,
- css,
- property,
- customElement,
-} from "lit-element";
import "@polymer/paper-icon-button/paper-icon-button";
-import "@polymer/paper-item/paper-item-body";
import "@polymer/paper-tooltip/paper-tooltip";
-import "../../../layouts/hass-tabs-subpage";
-
-import "../../../components/ha-card";
-import "../../../components/ha-fab";
-
-import "../ha-config-section";
-
+import {
+ css,
+ CSSResultArray,
+ customElement,
+ html,
+ LitElement,
+ property,
+ TemplateResult,
+} from "lit-element";
+import { ifDefined } from "lit-html/directives/if-defined";
+import memoizeOne from "memoize-one";
+import { fireEvent } from "../../../common/dom/fire_event";
import { computeStateName } from "../../../common/entity/compute_state_name";
import { computeRTL } from "../../../common/util/compute_rtl";
+import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table";
+import "../../../components/ha-fab";
+import { forwardHaptic } from "../../../data/haptics";
+import { activateScene, SceneEntity } from "../../../data/scene";
+import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box";
+import "../../../layouts/hass-tabs-subpage-data-table";
import { haStyle } from "../../../resources/styles";
import { HomeAssistant, Route } from "../../../types";
-import { SceneEntity, activateScene } from "../../../data/scene";
import { showToast } from "../../../util/toast";
-import { ifDefined } from "lit-html/directives/if-defined";
-import { forwardHaptic } from "../../../data/haptics";
import { configSections } from "../ha-panel-config";
@customElement("ha-scene-dashboard")
@@ -35,108 +33,131 @@ class HaSceneDashboard extends LitElement {
@property() public route!: Route;
@property() public scenes!: SceneEntity[];
+ private _scenes = memoizeOne((scenes: SceneEntity[]) => {
+ return scenes.map((scene) => {
+ return {
+ ...scene,
+ name: computeStateName(scene),
+ };
+ });
+ });
+
+ private _columns = memoizeOne(
+ (_language): DataTableColumnContainer => {
+ return {
+ activate: {
+ title: "",
+ type: "icon-button",
+ template: (_toggle, scene) =>
+ html`
+
-
- ${this.hass.localize("ui.panel.config.scene.picker.learn_more")}
-
-
- ${this.hass.localize(
- "ui.panel.config.scene.picker.no_scenes"
- )}
-
+ + ${this.hass.localize("ui.panel.config.scene.picker.learn_more")} + +
+ `, + }); + } + static get styles(): CSSResultArray { return [ haStyle, css` - :host { - display: block; - height: 100%; - } - - ha-card { - margin-bottom: 56px; - } - - .scene { - display: flex; - flex-direction: horizontal; - align-items: center; - padding: 0 8px 0 16px; - } - - .scene > *:first-child { - margin-right: 8px; - } - - .scene a[href] { - color: var(--primary-text-color); - } - - .actions { - display: flex; - } - ha-fab { position: fixed; bottom: 16px; diff --git a/src/translations/en.json b/src/translations/en.json index c74e17a60a..dbe8c7f8ca 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1260,7 +1260,10 @@ "edit_scene": "Edit scene", "show_info_scene": "Show info about scene", "delete_scene": "Delete scene", - "delete_confirm": "Are you sure you want to delete this scene?" + "delete_confirm": "Are you sure you want to delete this scene?", + "headers": { + "name": "Name" + } }, "editor": { "introduction": "Use scenes to bring your home alive.",