Fix:Show Manage Local Files & Add to Playlist in more menu correctly

This commit is contained in:
advplyr 2022-12-10 14:26:58 -06:00
parent feec1ab55a
commit 0ddee6f44e

View file

@ -358,26 +358,20 @@ export default {
return this.$store.state.isCasting return this.$store.state.isCasting
}, },
moreMenuItems() { moreMenuItems() {
if (this.isLocal) { const items = []
return [ if (this.localLibraryItemId) {
{ items.push({
text: 'Manage Local Files', text: 'Manage Local Files',
value: 'manageLocal' value: 'manageLocal'
}, })
{
text: 'View Details',
value: 'details'
} }
]
} else {
const items = [
{
text: 'View Details',
value: 'details'
}
]
if (!this.isPodcast) { items.push({
text: 'View Details',
value: 'details'
})
if (!this.isPodcast && this.serverLibraryItemId) {
items.push({ items.push({
text: 'Add to Playlist', text: 'Add to Playlist',
value: 'playlist' value: 'playlist'
@ -386,13 +380,12 @@ export default {
return items return items
} }
}
}, },
methods: { methods: {
moreMenuAction(action) { moreMenuAction(action) {
this.showMoreMenu = false this.showMoreMenu = false
if (action === 'manageLocal') { if (action === 'manageLocal') {
this.$router.push(`/localMedia/item/${this.libraryItemId}`) this.$router.push(`/localMedia/item/${this.localLibraryItemId}`)
} else if (action === 'details') { } else if (action === 'details') {
this.showDetailsModal = true this.showDetailsModal = true
} else if (action === 'playlist') { } else if (action === 'playlist') {
@ -407,7 +400,7 @@ export default {
this.$store.commit('openReader', this.libraryItem) this.$store.commit('openReader', this.libraryItem)
}, },
async playClick() { async playClick() {
var episodeId = null let episodeId = null
await this.$hapticsImpactMedium() await this.$hapticsImpactMedium()
if (this.isPodcast) { if (this.isPodcast) {
@ -415,7 +408,7 @@ export default {
return String(b.publishedAt).localeCompare(String(a.publishedAt), undefined, { numeric: true, sensitivity: 'base' }) return String(b.publishedAt).localeCompare(String(a.publishedAt), undefined, { numeric: true, sensitivity: 'base' })
}) })
var episode = this.episodes.find((ep) => { let episode = this.episodes.find((ep) => {
var podcastProgress = null var podcastProgress = null
if (!this.isLocal) { if (!this.isLocal) {
podcastProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, ep.id) podcastProgress = this.$store.getters['user/getUserMediaProgress'](this.libraryItemId, ep.id)
@ -429,13 +422,13 @@ export default {
episodeId = episode.id episodeId = episode.id
var localEpisode = null let localEpisode = null
if (this.hasLocal && !this.isLocal) { if (this.hasLocal && !this.isLocal) {
localEpisode = this.localLibraryItem.media.episodes.find((ep) => ep.serverEpisodeId == episodeId) localEpisode = this.localLibraryItem.media.episodes.find((ep) => ep.serverEpisodeId == episodeId)
} else if (this.isLocal) { } else if (this.isLocal) {
localEpisode = episode localEpisode = episode
} }
var serverEpisodeId = !this.isLocal ? episodeId : localEpisode ? localEpisode.serverEpisodeId : null const serverEpisodeId = !this.isLocal ? episodeId : localEpisode ? localEpisode.serverEpisodeId : null
if (serverEpisodeId && this.serverLibraryItemId && this.isCasting) { if (serverEpisodeId && this.serverLibraryItemId && this.isCasting) {
// If casting and connected to server for local library item then send server library item id // If casting and connected to server for local library item then send server library item id