Fix:Batch selecting ebooks showing play button in appbar #1235

This commit is contained in:
advplyr 2022-11-30 17:09:00 -06:00
parent d917f0e37d
commit 725f8eecdb
16 changed files with 117 additions and 89 deletions

View file

@ -16,6 +16,7 @@ export const state = () => ({
selectedPlaylist: null,
selectedCollection: null,
selectedAuthor: null,
selectedMediaItems: [],
isCasting: false, // Actively casting
isChromecastInitialized: false, // Script loadeds
showBatchQuickMatchModal: false,
@ -64,6 +65,9 @@ export const getters = {
return `http://localhost:3333${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}`
}
return `${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}`
},
getIsBatchSelectingMediaItems: (state) => {
return state.selectedMediaItems.length
}
}
@ -134,5 +138,28 @@ export const mutations = {
},
setShowBatchQuickMatchModal(state, val) {
state.showBatchQuickMatchModal = val
},
resetSelectedMediaItems(state) {
// Vue.set(state, 'selectedMediaItems', [])
state.selectedMediaItems = []
},
toggleMediaItemSelected(state, item) {
if (state.selectedMediaItems.some(i => i.id === item.id)) {
state.selectedMediaItems = state.selectedMediaItems.filter(i => i.id !== item.id)
} else {
// const newSel = state.selectedMediaItems.concat([{...item}])
// Vue.set(state, 'selectedMediaItems', newSel)
state.selectedMediaItems.push(item)
}
},
setMediaItemSelected(state, { item, selected }) {
const index = state.selectedMediaItems.findIndex(i => i.id === item.id)
if (index && !selected) {
state.selectedMediaItems = state.selectedMediaItems.filter(i => i.id !== item.id)
} else if (selected && !index) {
state.selectedMediaItems.splice(index, 1, item)
// var newSel = state.selectedMediaItems.concat([libraryItemId])
// Vue.set(state, 'selectedMediaItems', newSel)
}
}
}