Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
kalkih#1129

Just a quick stub. To be tested still.
  • Loading branch information
akloeckner authored Aug 26, 2024
1 parent 47edf81 commit e2cfa30
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ class MiniGraphCard extends LitElement {

shouldUpdate(changedProps) {
if (UPDATE_PROPS.some(prop => changedProps.has(prop))) {
this.color = this.computeColor(
this.tooltip.value !== undefined
? this.tooltip.value : this.entity[0] && this.entity[0].state,
this.tooltip.entity || 0,
);
return true;
}
}
Expand Down Expand Up @@ -238,7 +233,7 @@ class MiniGraphCard extends LitElement {
const { icon, icon_adaptive_color } = this.config.show;
return icon ? html`
<div class="icon" loc=${this.config.align_icon}
style=${icon_adaptive_color ? `color: ${this.color};` : ''}>
style=${icon_adaptive_color ? `color: ${this.computeColor(this.tooltip.value ?? this.getEntityState(0), this.tooltip.entity ?? 0)};` : ''}>
<ha-icon .icon=${this.computeIcon(this.entity[0])}></ha-icon>
</div>
` : '';
Expand All @@ -249,7 +244,7 @@ class MiniGraphCard extends LitElement {
const name = this.tooltip.entity !== undefined
? this.computeName(this.tooltip.entity)
: this.config.name || this.computeName(0);
const color = this.config.show.name_adaptive_color ? `opacity: 1; color: ${this.color};` : '';
const color = this.config.show.name_adaptive_color ? `opacity: 1; color: ${this.computeColor(this.tooltip.value ?? this.getEntityState(0), this.tooltip.entity ?? 0)}};` : '';

return html`
<div class="name flex">
Expand Down

0 comments on commit e2cfa30

Please sign in to comment.