mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
Hide energy usage chips when no title is set (#28464)
This commit is contained in:
@@ -88,16 +88,18 @@ export class HuiEnergyGasGraphCard
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
<div class="card-header">
|
${this._config.title
|
||||||
<span>${this._config.title ? this._config.title : nothing}</span>
|
? html` <div class="card-header">
|
||||||
${this._total
|
<span>${this._config.title}</span>
|
||||||
? html`<hui-energy-graph-chip
|
${this._total
|
||||||
.tooltip=${this._formatTotal(this._total)}
|
? html`<hui-energy-graph-chip
|
||||||
>
|
.tooltip=${this._formatTotal(this._total)}
|
||||||
${formatNumber(this._total, this.hass.locale)} ${this._unit}
|
>
|
||||||
</hui-energy-graph-chip>`
|
${formatNumber(this._total, this.hass.locale)} ${this._unit}
|
||||||
: nothing}
|
</hui-energy-graph-chip>`
|
||||||
</div>
|
: nothing}
|
||||||
|
</div>`
|
||||||
|
: nothing}
|
||||||
<div
|
<div
|
||||||
class="content ${classMap({
|
class="content ${classMap({
|
||||||
"has-header": !!this._config.title,
|
"has-header": !!this._config.title,
|
||||||
|
|||||||
@@ -90,16 +90,18 @@ export class HuiEnergySolarGraphCard
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
<div class="card-header">
|
${this._config.title
|
||||||
<span>${this._config.title ? this._config.title : nothing}</span>
|
? html` <div class="card-header">
|
||||||
${this._total
|
<span>${this._config.title}</span>
|
||||||
? html`<hui-energy-graph-chip
|
${this._total
|
||||||
.tooltip=${this._formatTotal(this._total)}
|
? html`<hui-energy-graph-chip
|
||||||
>
|
.tooltip=${this._formatTotal(this._total)}
|
||||||
${formatNumber(this._total, this.hass.locale)} kWh
|
>
|
||||||
</hui-energy-graph-chip>`
|
${formatNumber(this._total, this.hass.locale)} kWh
|
||||||
: nothing}
|
</hui-energy-graph-chip>`
|
||||||
</div>
|
: nothing}
|
||||||
|
</div>`
|
||||||
|
: nothing}
|
||||||
<div
|
<div
|
||||||
class="content ${classMap({
|
class="content ${classMap({
|
||||||
"has-header": !!this._config.title,
|
"has-header": !!this._config.title,
|
||||||
|
|||||||
@@ -103,19 +103,21 @@ export class HuiEnergyUsageGraphCard
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
<div class="card-header">
|
${this._config.title
|
||||||
<span>${this._config.title ? this._config.title : nothing}</span>
|
? html` <div class="card-header">
|
||||||
${this._total
|
<span>${this._config.title}</span>
|
||||||
? html`<hui-energy-graph-chip
|
${this._total
|
||||||
.tooltip=${this._formatTotal(this._total)}
|
? html`<hui-energy-graph-chip
|
||||||
>
|
.tooltip=${this._formatTotal(this._total)}
|
||||||
${this.hass.localize(
|
>
|
||||||
"ui.panel.lovelace.cards.energy.energy_usage_graph.total_usage",
|
${this.hass.localize(
|
||||||
{ num: formatNumber(this._total, this.hass.locale) }
|
"ui.panel.lovelace.cards.energy.energy_usage_graph.total_usage",
|
||||||
)}
|
{ num: formatNumber(this._total, this.hass.locale) }
|
||||||
</hui-energy-graph-chip>`
|
)}
|
||||||
: nothing}
|
</hui-energy-graph-chip>`
|
||||||
</div>
|
: nothing}
|
||||||
|
</div>`
|
||||||
|
: nothing}
|
||||||
<div
|
<div
|
||||||
class="content ${classMap({
|
class="content ${classMap({
|
||||||
"has-header": !!this._config.title,
|
"has-header": !!this._config.title,
|
||||||
|
|||||||
@@ -88,16 +88,18 @@ export class HuiEnergyWaterGraphCard
|
|||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ha-card>
|
<ha-card>
|
||||||
<div class="card-header">
|
${this._config.title
|
||||||
<span>${this._config.title ? this._config.title : nothing}</span>
|
? html` <div class="card-header">
|
||||||
${this._total
|
<span>${this._config.title ? this._config.title : nothing}</span>
|
||||||
? html`<hui-energy-graph-chip
|
${this._total
|
||||||
.tooltip=${this._formatTotal(this._total)}
|
? html`<hui-energy-graph-chip
|
||||||
>
|
.tooltip=${this._formatTotal(this._total)}
|
||||||
${formatNumber(this._total, this.hass.locale)} ${this._unit}
|
>
|
||||||
</hui-energy-graph-chip>`
|
${formatNumber(this._total, this.hass.locale)} ${this._unit}
|
||||||
: nothing}
|
</hui-energy-graph-chip>`
|
||||||
</div>
|
: nothing}
|
||||||
|
</div>`
|
||||||
|
: nothing}
|
||||||
<div
|
<div
|
||||||
class="content ${classMap({
|
class="content ${classMap({
|
||||||
"has-header": !!this._config.title,
|
"has-header": !!this._config.title,
|
||||||
|
|||||||
Reference in New Issue
Block a user