From 4e232e58ce6321a5a82cc10c31b36150ea4ee701 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 11 Dec 2018 19:26:26 +0100 Subject: [PATCH] Address comments --- src/panels/lovelace/hui-root.ts | 53 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index da2fb6d9fe..a18cbb3dfd 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -1,3 +1,11 @@ +import { + html, + LitElement, + PropertyDeclarations, + PropertyValues, +} from "@polymer/lit-element"; +import { TemplateResult } from "lit-html"; +import { classMap } from "lit-html/directives/classMap"; import "@polymer/app-layout/app-header-layout/app-header-layout"; import "@polymer/app-layout/app-header/app-header"; import "@polymer/app-layout/app-scroll-effects/effects/waterfall"; @@ -10,6 +18,7 @@ import "@polymer/paper-listbox/paper-listbox"; import "@polymer/paper-menu-button/paper-menu-button"; import "@polymer/paper-tabs/paper-tab"; import "@polymer/paper-tabs/paper-tabs"; +import { HassEntities } from "home-assistant-js-websocket"; import scrollToTarget from "../../common/dom/scroll-to-target"; @@ -18,28 +27,20 @@ import "../../components/ha-start-voice-button"; import "../../components/ha-icon"; import { loadModule, loadCSS, loadJS } from "../../common/dom/load_resource"; import { subscribeNotifications } from "../../data/ws-notifications"; +import debounce from "../../common/util/debounce"; +import { hassLocalizeLitMixin } from "../../mixins/lit-localize-mixin"; +import { HomeAssistant } from "../../types"; +import { LovelaceConfig } from "../../data/lovelace"; +import { navigate } from "../../common/navigate"; +import { fireEvent } from "../../common/dom/fire_event"; import { computeNotifications } from "./common/compute-notifications"; import "./components/notifications/hui-notification-drawer"; import "./components/notifications/hui-notifications-button"; import "./hui-unused-entities"; import "./hui-view"; -import debounce from "../../common/util/debounce"; import createCardElement from "./common/create-card-element"; import { showEditViewDialog } from "./editor/view-editor/show-edit-view-dialog"; -import { hassLocalizeLitMixin } from "../../mixins/lit-localize-mixin"; -import { - html, - LitElement, - PropertyDeclarations, - PropertyValues, -} from "@polymer/lit-element"; -import { HomeAssistant } from "../../types"; import { Lovelace } from "./types"; -import { LovelaceConfig } from "../../data/lovelace"; -import { HassEntities } from "home-assistant-js-websocket"; -import { navigate } from "../../common/navigate"; -import { fireEvent } from "../../common/dom/fire_event"; -import { classMap } from "lit-html/directives/classMap"; // CSS and JS should only be imported once. Modules and HTML are safe. const CSS_CACHE = {}; @@ -52,8 +53,8 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) { public lovelace?: Lovelace; public columns?: number; public route?: { path: string; prefix: string }; - public routeData?: { view: string }; - private _curView: number; + private _routeData?: { view: string }; + private _curView: number | "unused"; private notificationsOpen?: boolean; private _persistentNotifications?: Notification[]; private _haStyle?: DocumentFragment; @@ -69,7 +70,7 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) { lovelace: {}, columns: {}, route: {}, - routeData: {}, + _routeData: {}, _curView: {}, notificationsOpen: {}, _persistentNotifications: {}, @@ -102,11 +103,11 @@ class HUIRoot extends hassLocalizeLitMixin(LitElement) { } } - protected render() : TemplateResult { + protected render(): TemplateResult { return html` ${this.renderStyle()}