Skip to content

Commit

Permalink
Switch to accepting action
Browse files Browse the repository at this point in the history
  • Loading branch information
pathofleastresistor committed Jan 13, 2024
1 parent 61b3f08 commit df632d5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
13 changes: 7 additions & 6 deletions polr-ytube-media-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -4345,7 +4345,6 @@ let PoLRYTubeBrowser = class PoLRYTubeBrowser extends s$1 {
}
updated(_changedProperties) {
if (_changedProperties.has("initialAction")) {
console.log(this.initialAction);
this._browseHistory = [];
this._previousBrowseHistory = [];
this._browse(this.initialAction);
Expand Down Expand Up @@ -8634,6 +8633,12 @@ class PoLRYTubePlayingCard extends s$1 {
this._config.header = "YouTube Music";
if (!("icon" in this._config))
this._config.searchTitle = "mdi:speaker";
if (!("initialAction" in this._config)) {
this._config.initialAction = new PoLRYTubeItem();
this._config.initialAction.title = "You";
this._config.initialAction.media_content_type = A;
this._config.initialAction.media_content_id = A;
}
if (!("media_content_type" in this._config))
this._config.media_content_type = A;
if (!("media_content_id" in this._config))
Expand Down Expand Up @@ -8798,10 +8803,6 @@ class PoLRYTubePlayingCard extends s$1 {
`;
}
_renderTab() {
const forYouItem = new PoLRYTubeItem();
forYouItem.title = "You";
forYouItem.media_content_type = this._config.media_content_type;
forYouItem.media_content_id = this._config.media_content_id;
return x `
<polr-ytube-playing
class="${this._activeTab == 0 /* PoLRYTubeTab.CURRENTLY_PLAYING */
Expand All @@ -8817,7 +8818,7 @@ class PoLRYTubePlayingCard extends s$1 {
: "hiddenTab"}"
.hass=${this._hass}
.entity=${this._entity}
.initialAction=${forYouItem}
.initialAction=${this._config.initialAction}
></polr-ytube-browser>
`;
}
Expand Down
13 changes: 7 additions & 6 deletions src/cards/polr-ytube-playing-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ export class PoLRYTubePlayingCard extends LitElement {
this._config = structuredClone(config);
if (!("header" in this._config)) this._config.header = "YouTube Music";
if (!("icon" in this._config)) this._config.searchTitle = "mdi:speaker";
if (!("initialAction" in this._config)) {
this._config.initialAction = new PoLRYTubeItem();
this._config.initialAction.title = "You";
this._config.initialAction.media_content_type = nothing;
this._config.initialAction.media_content_id = nothing;
}
if (!("media_content_type" in this._config))
this._config.media_content_type = nothing;
if (!("media_content_id" in this._config))
Expand Down Expand Up @@ -227,11 +233,6 @@ export class PoLRYTubePlayingCard extends LitElement {
}

_renderTab() {
const forYouItem = new PoLRYTubeItem();
forYouItem.title = "You";
forYouItem.media_content_type = this._config.media_content_type;
forYouItem.media_content_id = this._config.media_content_id;

return html`
<polr-ytube-playing
class="${this._activeTab == PoLRYTubeTab.CURRENTLY_PLAYING
Expand All @@ -247,7 +248,7 @@ export class PoLRYTubePlayingCard extends LitElement {
: "hiddenTab"}"
.hass=${this._hass}
.entity=${this._entity}
.initialAction=${forYouItem}
.initialAction=${this._config.initialAction}
></polr-ytube-browser>
`;
}
Expand Down
1 change: 0 additions & 1 deletion src/elements/polr-ytube-browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class PoLRYTubeBrowser extends LitElement {
_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>
): void {
if (_changedProperties.has("initialAction")) {
console.log(this.initialAction);
this._browseHistory = [];
this._previousBrowseHistory = [];
this._browse(this.initialAction);
Expand Down

0 comments on commit df632d5

Please sign in to comment.