diff --git a/client/components/app/LazyBookshelf.vue b/client/components/app/LazyBookshelf.vue index fa47ce99..6137cdca 100644 --- a/client/components/app/LazyBookshelf.vue +++ b/client/components/app/LazyBookshelf.vue @@ -601,6 +601,30 @@ export default { this.executeRebuild() } }, + shareOpen(mediaItemShare) { + if (this.entityName === 'items' || this.entityName === 'series-books') { + var indexOf = this.entities.findIndex((ent) => ent?.media?.id === mediaItemShare.mediaItemId) + if (indexOf >= 0) { + if (this.entityComponentRefs[indexOf]) { + const libraryItem = { ...this.entityComponentRefs[indexOf].libraryItem } + libraryItem.mediaItemShare = mediaItemShare + this.entityComponentRefs[indexOf].setEntity?.(libraryItem) + } + } + } + }, + shareClosed(mediaItemShare) { + if (this.entityName === 'items' || this.entityName === 'series-books') { + var indexOf = this.entities.findIndex((ent) => ent?.media?.id === mediaItemShare.mediaItemId) + if (indexOf >= 0) { + if (this.entityComponentRefs[indexOf]) { + const libraryItem = { ...this.entityComponentRefs[indexOf].libraryItem } + libraryItem.mediaItemShare = null + this.entityComponentRefs[indexOf].setEntity?.(libraryItem) + } + } + } + }, updatePagesLoaded() { let numPages = Math.ceil(this.totalEntities / this.booksPerFetch) for (let page = 0; page < numPages; page++) { @@ -703,6 +727,8 @@ export default { this.$root.socket.on('playlist_added', this.playlistAdded) this.$root.socket.on('playlist_updated', this.playlistUpdated) this.$root.socket.on('playlist_removed', this.playlistRemoved) + this.$root.socket.on('share_open', this.shareOpen) + this.$root.socket.on('share_closed', this.shareClosed) } else { console.error('Bookshelf - Socket not initialized') } @@ -730,6 +756,8 @@ export default { this.$root.socket.off('playlist_added', this.playlistAdded) this.$root.socket.off('playlist_updated', this.playlistUpdated) this.$root.socket.off('playlist_removed', this.playlistRemoved) + this.$root.socket.off('share_open', this.shareOpen) + this.$root.socket.off('share_closed', this.shareClosed) } else { console.error('Bookshelf - Socket not initialized') } diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 5bb406e4..37af853d 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -528,6 +528,12 @@ export default { func: 'openPlaylists', text: this.$strings.LabelAddToPlaylist }) + if (this.userIsAdminOrUp) { + items.push({ + func: 'openShare', + text: this.$strings.LabelShare + }) + } } if (this.ebookFormat && this.store.state.libraries.ereaderDevices?.length) { items.push({ @@ -880,6 +886,10 @@ export default { this.store.commit('globals/setSelectedPlaylistItems', [{ libraryItem: this.libraryItem, episode: this.recentEpisode }]) this.store.commit('globals/setShowPlaylistsModal', true) }, + openShare() { + this.store.commit('setSelectedLibraryItem', this.libraryItem) + this.store.commit('globals/setShareModal', this.mediaItemShare) + }, deleteLibraryItem() { const payload = { message: this.$strings.MessageConfirmDeleteLibraryItem, diff --git a/client/components/controls/LibraryFilterSelect.vue b/client/components/controls/LibraryFilterSelect.vue index e3cb0d16..d8951321 100644 --- a/client/components/controls/LibraryFilterSelect.vue +++ b/client/components/controls/LibraryFilterSelect.vue @@ -89,6 +89,9 @@ export default { this.$emit('input', val) } }, + userIsAdminOrUp() { + return this.$store.getters['user/getIsAdminOrUp'] + }, libraryMediaType() { return this.$store.getters['libraries/getCurrentLibraryMediaType'] }, @@ -148,7 +151,7 @@ export default { ] }, bookItems() { - return [ + const items = [ { text: this.$strings.LabelAll, value: 'all' @@ -229,13 +232,16 @@ export default { text: this.$strings.LabelRSSFeedOpen, value: 'feed-open', sublist: false - }, - { + } + ] + if (this.userIsAdminOrUp) { + items.push({ text: this.$strings.LabelShareOpen, value: 'share-open', sublist: false - } - ] + }) + } + return items }, podcastItems() { return [ diff --git a/client/components/modals/ShareModal.vue b/client/components/modals/ShareModal.vue index dc781a74..42f9c29a 100644 --- a/client/components/modals/ShareModal.vue +++ b/client/components/modals/ShareModal.vue @@ -53,17 +53,7 @@