Add a force mobile mode on desktop (#3394)

* Add a force mobile mode

* Fix columns on LL

* Update text

* Move it above the push notifications

* Hide notification count when sidebar expanded and count=0
This commit is contained in:
Paulus Schoutsen
2019-07-20 17:30:25 -07:00
committed by GitHub
parent 75c7445dd9
commit 4555bd4240
15 changed files with 122 additions and 48 deletions

View File

@@ -78,14 +78,25 @@ class HaMenuButton extends LitElement {
protected updated(changedProps) {
super.updated(changedProps);
if (!changedProps.has("narrow")) {
if (!changedProps.has("narrow") && !changedProps.has("hass")) {
return;
}
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
const oldNarrow =
changedProps.get("narrow") ||
(oldHass && oldHass.dockedSidebar === "always_hidden");
const newNarrow =
this.narrow || this.hass.dockedSidebar === "always_hidden";
if (oldNarrow === newNarrow) {
return;
}
this.style.visibility =
this.narrow || this._alwaysVisible ? "initial" : "hidden";
newNarrow || this._alwaysVisible ? "initial" : "hidden";
if (!this.narrow) {
if (!newNarrow) {
this._hasNotifications = false;
if (this._unsubNotifications) {
this._unsubNotifications();