Fix Default Lovelace Panel Title (#5301)

* Fix lovelace panel title

* Fix types error

* Revert and workaround null type

* Update src/data/panel.ts

Co-Authored-By: Bram Kragten <mail@bramkragten.nl>

* Update panel.ts

* Update panel.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Aidan Timson 2020-03-24 14:08:51 +00:00 committed by GitHub
parent ed51223226
commit 6aae1b3378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,14 +22,13 @@ export const getPanelTitle = (hass: HomeAssistant): string | undefined => {
return;
}
if (panel.url_path === "lovelace") {
return hass.localize("panel.states");
}
if (panel.url_path === "profile") {
return hass.localize("panel.profile");
}
return (
hass.localize(`panel.${panel.title}`) ||
panel.title ||
// default panel
(hass.panels[localStorage.defaultPage] || hass.panels[DEFAULT_PANEL]).title!
);
return hass.localize(`panel.${panel.title}`) || panel.title || undefined;
};