Hide default image if unavailable
parent
e7d89d0f9a
commit
355440c0fa
|
@ -167,7 +167,9 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
||||||
|
|
||||||
const isOffState = OFF_STATES.includes(stateObj.state);
|
const isOffState = OFF_STATES.includes(stateObj.state);
|
||||||
const isUnavailable =
|
const isUnavailable =
|
||||||
stateObj.state === UNAVAILABLE || stateObj.state === UNKNOWN;
|
stateObj.state === UNAVAILABLE ||
|
||||||
|
stateObj.state === UNKNOWN ||
|
||||||
|
(stateObj.state === "off" && !supportsFeature(stateObj, SUPPORT_TURN_ON));
|
||||||
const hasNoImage = !this._image;
|
const hasNoImage = !this._image;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
|
@ -176,6 +178,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
||||||
class="background ${classMap({
|
class="background ${classMap({
|
||||||
"no-image": hasNoImage,
|
"no-image": hasNoImage,
|
||||||
off: isOffState || isUnavailable,
|
off: isOffState || isUnavailable,
|
||||||
|
unavailable: isUnavailable,
|
||||||
})}"
|
})}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -221,8 +224,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
||||||
></paper-icon-button>
|
></paper-icon-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${isUnavailable ||
|
${isUnavailable
|
||||||
(isOffState && !supportsFeature(stateObj, SUPPORT_TURN_ON))
|
|
||||||
? ""
|
? ""
|
||||||
: html`
|
: html`
|
||||||
<div
|
<div
|
||||||
|
@ -609,6 +611,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
|
||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unavailable .no-img,
|
||||||
.background:not(.off):not(.no-image) .no-img {
|
.background:not(.off):not(.no-image) .no-img {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue