Skip to content

Commit 3f7aa17

Browse files
committed
Fix rendering
1 parent 83e2b8b commit 3f7aa17

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/roku-card.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ export class RokuCard extends LitElement {
7373
? this._renderButton('power', 'mdi:power', 'Power')
7474
: ''}
7575
</div>
76-
${this._config.back?.show || this._config.info?.show || this._config.home?.show
76+
${(this._config.back && this._config.back.show !== false) ||
77+
(this._config.info && this._config.info.show !== false) ||
78+
(this._config.home && this._config.home.show !== false)
7779
? html`
7880
<div class="row">
7981
${this._renderButton('back', 'mdi:arrow-left', 'Back')}
@@ -82,14 +84,16 @@ export class RokuCard extends LitElement {
8284
</div>
8385
`
8486
: ''}
85-
${(this._config.apps && this._config.apps.length > 0) || this._config.up?.show
87+
${(this._config.apps && this._config.apps.length > 0) || (this._config.up && this._config.up.show !== false)
8688
? html`
8789
<div class="row">
8890
${this._renderImage(0)} ${this._renderButton('up', 'mdi:chevron-up', 'Up')} ${this._renderImage(1)}
8991
</div>
9092
`
9193
: ''}
92-
${this._config.left?.show || this._config.select?.show || this._config.right?.show
94+
${(this._config.left && this._config.left.show !== false) ||
95+
(this._config.select && this._config.select.show !== false) ||
96+
(this._config.right && this._config.right?.show !== false)
9397
? html`
9498
<div class="row">
9599
${this._renderButton('left', 'mdi:chevron-left', 'Left')}
@@ -98,15 +102,18 @@ export class RokuCard extends LitElement {
98102
</div>
99103
`
100104
: ''}
101-
${(this._config.apps && this._config.apps.length > 2) || this._config.down?.show
105+
${(this._config.apps && this._config.apps.length > 2) ||
106+
(this._config.down && this._config.down.show !== false)
102107
? html`
103108
<div class="row">
104109
${this._renderImage(2)} ${this._renderButton('down', 'mdi:chevron-down', 'Down')}
105110
${this._renderImage(3)}
106111
</div>
107112
`
108113
: ''}
109-
${this._config.reverse?.show || this._config.play?.show || this._config.forward?.show
114+
${(this._config.reverse && this._config.reverse.show !== false) ||
115+
(this._config.play && this._config.play.show !== false) ||
116+
(this._config.forward && this._config.forward?.show !== false)
110117
? html`
111118
<div class="row">
112119
${this._renderButton('reverse', 'mdi:rewind', 'Rewind')}
@@ -116,9 +123,9 @@ export class RokuCard extends LitElement {
116123
`
117124
: ''}
118125
${this._config.tv ||
119-
this._config.volume_mute?.show ||
120-
this._config.volume_down?.show ||
121-
this._config.volume_up?.show
126+
(this._config.volume_mute && this._config.volume_mute.show !== false) ||
127+
(this._config.volume_down && this._config.volume_down.show !== false) ||
128+
(this._config.volume_up && this._config.volume_up.show !== false)
122129
? html`
123130
<div class="row">
124131
${this._renderButton('volume_mute', 'mdi:volume-mute', 'Volume Mute')}
@@ -225,21 +232,21 @@ export class RokuCard extends LitElement {
225232
private _renderButton(button: string, icon: string, title: string): TemplateResult {
226233
if (this._config) {
227234
const config = this._config[button];
228-
return config && config.show === true
235+
return config && config.show === false
229236
? html`
237+
<ha-icon-button></ha-icon-button>
238+
`
239+
: html`
230240
<ha-icon-button
231241
.button=${button}
232-
icon=${config.icon ? config.icon : icon}
233-
title=${config.title ? config.title : title}
242+
icon=${config && config.icon ? config.icon : icon}
243+
title=${config && config.title ? config.title : title}
234244
@action=${this._handleAction}
235245
.actionHandler=${actionHandler({
236246
hasHold: config && hasAction(config.hold_action),
237247
hasDoubleClick: config && hasAction(config.double_tap_action),
238248
})}
239249
></ha-icon-button>
240-
`
241-
: html`
242-
<ha-icon-button></ha-icon-button>
243250
`;
244251
} else {
245252
return html``;

0 commit comments

Comments
 (0)