Make event entity row show time as relative by default, hide in gener… (#17456)

This commit is contained in:
Bram Kragten 2023-08-02 13:48:48 +02:00 committed by GitHub
parent e8aa08b717
commit 5f95968c8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 11 deletions

View File

@ -36,6 +36,7 @@ const HIDE_DOMAIN = new Set([
"script", "script",
"sun", "sun",
"zone", "zone",
"event",
]); ]);
const HIDE_PLATFORM = new Set(["mobile_app"]); const HIDE_PLATFORM = new Set(["mobile_app"]);

View File

@ -68,16 +68,23 @@ class HuiEventEntityRow extends LitElement implements LovelaceRow {
hasDoubleClick: hasAction(this._config.double_tap_action), hasDoubleClick: hasAction(this._config.double_tap_action),
})} })}
> >
<div class="what">
${computeStateDisplay(
this.hass!.localize,
stateObj,
this.hass.locale,
this.hass.config,
this.hass.entities
)}
</div>
<div class="when"> <div class="when">
${isUnavailableState(stateObj.state)
? computeStateDisplay(
this.hass!.localize,
stateObj,
this.hass.locale,
this.hass.config,
this.hass.entities
)
: html`<hui-timestamp-display
.hass=${this.hass}
.ts=${new Date(stateObj.state)}
.format=${this._config.format}
capitalize
></hui-timestamp-display>`}
</div>
<div class="what">
${isUnavailableState(stateObj.state) ${isUnavailableState(stateObj.state)
? `` ? ``
: computeAttributeValueDisplay( : computeAttributeValueDisplay(
@ -104,10 +111,10 @@ class HuiEventEntityRow extends LitElement implements LovelaceRow {
text-align: right; text-align: right;
} }
.when { .when {
color: var(--secondary-text-color); color: var(--primary-text-color);
} }
.what { .what {
color: var(--primary-text-color); color: var(--secondary-text-color);
} }
`; `;
} }