Skip to content

Commit

Permalink
hide volume controls when not tv
Browse files Browse the repository at this point in the history
  • Loading branch information
iantrich committed Sep 2, 2019
1 parent f68a9c4 commit bbccf91
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 133 deletions.
143 changes: 77 additions & 66 deletions dist/roku-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -3428,73 +3428,84 @@ let RokuCard = class RokuCard extends LitElement {
`}
</div>
<div class="row">
${this._config.volume_mute &&
this._config.volume_mute.show === false
? html `
<paper-icon-button></paper-icon-button>
`
: html `
<paper-icon-button
.button="${"volume_mute"}"
icon="mdi:volume-mute"
title="Volume Mute"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_mute &&
this._config.volume_mute.dbltap_action &&
this._config.volume_mute.dbltap_action.action !== "none"}
.repeat=${this._config.volume_mute &&
this._config.volume_mute.hold_action &&
ifDefined(this._config.volume_mute.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_down &&
this._config.volume_down.show === false
${this._config.tv ||
(this._config.volume_mute && this._config.volume_mute.show) ||
(this._config.volume_down && this._config.volume_down.show) ||
(this._config.volume_up && this._config.volume_up.show)
? html `
<paper-icon-button></paper-icon-button>
`
: html `
<paper-icon-button
.button="${"volume_down"}"
icon="mdi:volume-minus"
title="Volume Down"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_down &&
this._config.volume_down.dbltap_action &&
this._config.volume_down.dbltap_action.action !== "none"}
.repeat=${this._config.volume_down &&
this._config.volume_down.hold_action &&
ifDefined(this._config.volume_down.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_up && this._config.volume_up.show === false
? html `
<paper-icon-button></paper-icon-button>
`
: html `
<paper-icon-button
.button="${"volume_up"}"
icon="mdi:volume-plus"
title="Volume Up"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_up &&
this._config.volume_up.dbltap_action &&
this._config.volume_up.dbltap_action.action !== "none"}
.repeat=${this._config.volume_up &&
this._config.volume_up.hold_action &&
ifDefined(this._config.volume_up.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
</div>
<div class="row">
${this._config.volume_mute &&
this._config.volume_mute.show === false
? html `
<paper-icon-button></paper-icon-button>
`
: html `
<paper-icon-button
.button="${"volume_mute"}"
icon="mdi:volume-mute"
title="Volume Mute"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_mute &&
this._config.volume_mute.dbltap_action &&
this._config.volume_mute.dbltap_action.action !==
"none"}
.repeat=${this._config.volume_mute &&
this._config.volume_mute.hold_action &&
ifDefined(this._config.volume_mute.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_down &&
this._config.volume_down.show === false
? html `
<paper-icon-button></paper-icon-button>
`
: html `
<paper-icon-button
.button="${"volume_down"}"
icon="mdi:volume-minus"
title="Volume Down"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_down &&
this._config.volume_down.dbltap_action &&
this._config.volume_down.dbltap_action.action !==
"none"}
.repeat=${this._config.volume_down &&
this._config.volume_down.hold_action &&
ifDefined(this._config.volume_down.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_up &&
this._config.volume_up.show === false
? html `
<paper-icon-button></paper-icon-button>
`
: html `
<paper-icon-button
.button="${"volume_up"}"
icon="mdi:volume-plus"
title="Volume Up"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_up &&
this._config.volume_up.dbltap_action &&
this._config.volume_up.dbltap_action.action !==
"none"}
.repeat=${this._config.volume_up &&
this._config.volume_up.hold_action &&
ifDefined(this._config.volume_up.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
</div>
`
: ""}
</div>
</ha-card>
`;
Expand Down
151 changes: 84 additions & 67 deletions src/roku-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,73 +370,90 @@ class RokuCard extends LitElement {
`}
</div>
<div class="row">
${this._config.volume_mute &&
this._config.volume_mute.show === false
? html`
<paper-icon-button></paper-icon-button>
`
: html`
<paper-icon-button
.button="${"volume_mute"}"
icon="mdi:volume-mute"
title="Volume Mute"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_mute &&
this._config.volume_mute.dbltap_action &&
this._config.volume_mute.dbltap_action.action !== "none"}
.repeat=${this._config.volume_mute &&
this._config.volume_mute.hold_action &&
ifDefined(this._config.volume_mute.hold_action!.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_down &&
this._config.volume_down.show === false
? html`
<paper-icon-button></paper-icon-button>
`
: html`
<paper-icon-button
.button="${"volume_down"}"
icon="mdi:volume-minus"
title="Volume Down"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_down &&
this._config.volume_down.dbltap_action &&
this._config.volume_down.dbltap_action.action !== "none"}
.repeat=${this._config.volume_down &&
this._config.volume_down.hold_action &&
ifDefined(this._config.volume_down.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_up && this._config.volume_up.show === false
? html`
<paper-icon-button></paper-icon-button>
`
: html`
<paper-icon-button
.button="${"volume_up"}"
icon="mdi:volume-plus"
title="Volume Up"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_up &&
this._config.volume_up.dbltap_action &&
this._config.volume_up.dbltap_action.action !== "none"}
.repeat=${this._config.volume_up &&
this._config.volume_up.hold_action &&
ifDefined(this._config.volume_up.hold_action.repeat)}
.longpress=${longPress()}
></paper-icon-button>
`}
</div>
${this._config.tv ||
(this._config.volume_mute && this._config.volume_mute.show) ||
(this._config.volume_down && this._config.volume_down.show) ||
(this._config.volume_up && this._config.volume_up.show)
? html`
<div class="row">
${this._config.volume_mute &&
this._config.volume_mute.show === false
? html`
<paper-icon-button></paper-icon-button>
`
: html`
<paper-icon-button
.button="${"volume_mute"}"
icon="mdi:volume-mute"
title="Volume Mute"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_mute &&
this._config.volume_mute.dbltap_action &&
this._config.volume_mute.dbltap_action.action !==
"none"}
.repeat=${this._config.volume_mute &&
this._config.volume_mute.hold_action &&
ifDefined(
this._config.volume_mute.hold_action!.repeat
)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_down &&
this._config.volume_down.show === false
? html`
<paper-icon-button></paper-icon-button>
`
: html`
<paper-icon-button
.button="${"volume_down"}"
icon="mdi:volume-minus"
title="Volume Down"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_down &&
this._config.volume_down.dbltap_action &&
this._config.volume_down.dbltap_action.action !==
"none"}
.repeat=${this._config.volume_down &&
this._config.volume_down.hold_action &&
ifDefined(
this._config.volume_down.hold_action.repeat
)}
.longpress=${longPress()}
></paper-icon-button>
`}
${this._config.volume_up &&
this._config.volume_up.show === false
? html`
<paper-icon-button></paper-icon-button>
`
: html`
<paper-icon-button
.button="${"volume_up"}"
icon="mdi:volume-plus"
title="Volume Up"
@ha-click="${this._handleTap}"
@ha-hold="${this._handleHold}"
@ha-dblclick=${this._handleDblTap}
.hasDblClick=${this._config.volume_up &&
this._config.volume_up.dbltap_action &&
this._config.volume_up.dbltap_action.action !==
"none"}
.repeat=${this._config.volume_up &&
this._config.volume_up.hold_action &&
ifDefined(
this._config.volume_up.hold_action.repeat
)}
.longpress=${longPress()}
></paper-icon-button>
`}
</div>
`
: ""}
</div>
</ha-card>
`;
Expand Down

0 comments on commit bbccf91

Please sign in to comment.