1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

fix evaluating to false and remove ; (#4228)

This commit is contained in:
MatthewFlamm
2019-11-18 03:00:50 -05:00
committed by Bram Kragten
parent b82b4a639e
commit 09e7638c89

View File

@@ -87,7 +87,7 @@ class MoreInfoWeather extends LitElement {
${this.stateObj.attributes.temperature} ${this.getUnit("temperature")}
</div>
</div>
${this.stateObj.attributes.pressure
${this._showValue(this.stateObj.attributes.pressure)
? html`
<div class="flex">
<iron-icon icon="hass:gauge"></iron-icon>
@@ -101,7 +101,7 @@ class MoreInfoWeather extends LitElement {
</div>
`
: ""}
${this.stateObj.attributes.humidity
${this._showValue(this.stateObj.attributes.humidity)
? html`
<div class="flex">
<iron-icon icon="hass:water-percent"></iron-icon>
@@ -112,7 +112,7 @@ class MoreInfoWeather extends LitElement {
</div>
`
: ""}
${this.stateObj.attributes.wind_speed
${this._showValue(this.stateObj.attributes.wind_speed)
? html`
<div class="flex">
<iron-icon icon="hass:weather-windy"></iron-icon>
@@ -128,7 +128,7 @@ class MoreInfoWeather extends LitElement {
</div>
`
: ""}
${this.stateObj.attributes.visibility
${this._showValue(this.stateObj.attributes.visibility)
? html`
<div class="flex">
<iron-icon icon="hass:eye"></iron-icon>
@@ -156,14 +156,14 @@ class MoreInfoWeather extends LitElement {
></iron-icon>
`
: ""}
${!item.templow
${!this._showValue(item.templow)
? html`
<div class="main">
${this.computeDateTime(item.datetime)}
</div>
`
: ""}
${item.templow
${this._showValue(item.templow)
? html`
<div class="main">
${this.computeDate(item.datetime)}
@@ -172,7 +172,7 @@ class MoreInfoWeather extends LitElement {
${item.templow} ${this.getUnit("temperature")}
</div>
`
: ""};
: ""}
<div class="temp">
${item.temperature} ${this.getUnit("temperature")}
</div>
@@ -279,6 +279,10 @@ class MoreInfoWeather extends LitElement {
}
return `${speed} ${this.getUnit("length")}/h`;
}
private _showValue(item: string): boolean {
return typeof item !== "undefined" && item !== null;
}
}
declare global {