audiobookshelf/client/store/globals.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

export const state = () => ({
2022-02-09 18:19:02 +01:00
isMobile: false,
isMobileLandscape: false,
showBatchUserCollectionModal: false,
showUserCollectionsModal: false,
showEditCollectionModal: false,
selectedCollection: null,
showBookshelfTextureModal: false,
isCasting: false, // Actively casting
isChromecastInitialized: false // Script loaded
})
2022-02-09 18:19:02 +01:00
export const getters = {}
export const mutations = {
2022-02-09 18:19:02 +01:00
updateWindowSize(state, { width, height }) {
2022-02-11 15:50:28 +01:00
state.isMobile = width < 640 || height < 640
2022-02-09 18:19:02 +01:00
state.isMobileLandscape = state.isMobile && height > width
},
setShowUserCollectionsModal(state, val) {
state.showBatchUserCollectionModal = false
state.showUserCollectionsModal = val
},
setShowBatchUserCollectionsModal(state, val) {
state.showBatchUserCollectionModal = true
state.showUserCollectionsModal = val
},
setShowEditCollectionModal(state, val) {
state.showEditCollectionModal = val
},
setEditCollection(state, collection) {
state.selectedCollection = collection
state.showEditCollectionModal = true
},
setShowBookshelfTextureModal(state, val) {
state.showBookshelfTextureModal = val
},
setChromecastInitialized(state, val) {
state.isChromecastInitialized = val
},
setCasting(state, val) {
state.isCasting = val
}
}