mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 05:17:20 +00:00
Show menu button when Hassio supervisor UI runs on old HA (#3347)
This commit is contained in:
parent
14a430a059
commit
5d8e34e8be
@ -21,6 +21,7 @@ class HaMenuButton extends LitElement {
|
||||
@property() public narrow!: boolean;
|
||||
@property() public hass!: HomeAssistant;
|
||||
@property() private _hasNotifications = false;
|
||||
private _alwaysVisible = false;
|
||||
private _attachNotifOnConnect = false;
|
||||
private _unsubNotifications?: UnsubscribeFunc;
|
||||
|
||||
@ -62,6 +63,18 @@ class HaMenuButton extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProps) {
|
||||
super.firstUpdated(changedProps);
|
||||
if (!this.hassio) {
|
||||
return;
|
||||
}
|
||||
// This component is used on Hass.io too, but Hass.io might run the UI
|
||||
// on older frontends too, that don't have an always visible menu button
|
||||
// in the sidebar.
|
||||
this._alwaysVisible =
|
||||
(Number((window.parent as any).frontendVersion) || 0) >= 20190710;
|
||||
}
|
||||
|
||||
protected updated(changedProps) {
|
||||
super.updated(changedProps);
|
||||
|
||||
@ -69,7 +82,8 @@ class HaMenuButton extends LitElement {
|
||||
return;
|
||||
}
|
||||
|
||||
this.style.visibility = this.narrow ? "initial" : "hidden";
|
||||
this.style.visibility =
|
||||
this.narrow || this._alwaysVisible ? "initial" : "hidden";
|
||||
|
||||
if (!this.narrow) {
|
||||
this._hasNotifications = false;
|
||||
|
@ -16,3 +16,5 @@ import "../layouts/home-assistant";
|
||||
setPassiveTouchGestures(true);
|
||||
/* LastPass createElement workaround. See #428 */
|
||||
document.createElement = Document.prototype.createElement;
|
||||
|
||||
(window as any).frontendVersion = __VERSION__;
|
||||
|
Loading…
x
Reference in New Issue
Block a user