From 088d46f3845cbeaaaf52bb8dc59af3f121e6312e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Tue, 19 Oct 2021 15:46:12 +0200 Subject: [PATCH] Update: Hide play button for music folders --- dist/plex-meets-homeassistant.js | 12 ++++++++++++ src/modules/PlayController.ts | 5 +++++ src/plex-meets-homeassistant.ts | 7 +++++++ 3 files changed, 24 insertions(+) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 52d9307..6648597 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19826,6 +19826,10 @@ class PlayController { this.playButtons.push(playButton); return playButton; }; + this.setPlayActionDisplay = (displayValue) => { + const playActionButton = this.updateDetailPlayAction(); + playActionButton.style.display = displayValue; + }; this.setPlayActionButtonType = (mediaType) => { const playActionButton = this.updateDetailPlayAction(); playActionButton.setAttribute('data-mediaType', mediaType); @@ -22981,6 +22985,14 @@ class PlexMeetsHomeAssistant extends HTMLElement { lodash.includes(data.key, 'folder')) { childrenData = await this.plex.getLibraryData(data.key); } + if (this.playController) { + if (lodash.includes(data.key, 'folder')) { + this.playController.setPlayActionDisplay('none'); + } + else { + this.playController.setPlayActionDisplay('block'); + } + } let dataDetails = {}; if (!lodash.isNil(data.key)) { if (!lodash.includes(data.key, 'folder')) { diff --git a/src/modules/PlayController.ts b/src/modules/PlayController.ts index 233a229..bca777b 100644 --- a/src/modules/PlayController.ts +++ b/src/modules/PlayController.ts @@ -507,6 +507,11 @@ class PlayController { return playButton; }; + setPlayActionDisplay = (displayValue: string): void => { + const playActionButton = this.updateDetailPlayAction(); + playActionButton.style.display = displayValue; + }; + setPlayActionButtonType = (mediaType: string): void => { const playActionButton = this.updateDetailPlayAction(); playActionButton.setAttribute('data-mediaType', mediaType); diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 68ada28..cbab17b 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -1353,6 +1353,13 @@ class PlexMeetsHomeAssistant extends HTMLElement { ) { childrenData = await this.plex.getLibraryData(data.key); } + if (this.playController) { + if (_.includes(data.key, 'folder')) { + this.playController.setPlayActionDisplay('none'); + } else { + this.playController.setPlayActionDisplay('block'); + } + } let dataDetails: Record = {}; if (!_.isNil(data.key)) { if (!_.includes(data.key, 'folder')) {