diff --git a/client/components/modals/playlists/AddCreateModal.vue b/client/components/modals/playlists/AddCreateModal.vue new file mode 100644 index 00000000..9fbcecdd --- /dev/null +++ b/client/components/modals/playlists/AddCreateModal.vue @@ -0,0 +1,214 @@ + + + + + {{ title }} + + + + + + + {{ $strings.LabelAddToPlaylist }} + {{ $getString('LabelAddToPlaylistBatch', [selectedPlaylistItems.length]) }} + + + + + + + + + + {{ $strings.MessageNoUserPlaylists }} + + + + + + + + {{ $strings.ButtonCreate }} + + + + + + + + + + \ No newline at end of file diff --git a/client/components/modals/playlists/UserPlaylistItem.vue b/client/components/modals/playlists/UserPlaylistItem.vue new file mode 100644 index 00000000..fe6f8a56 --- /dev/null +++ b/client/components/modals/playlists/UserPlaylistItem.vue @@ -0,0 +1,58 @@ + + + + + + + + {{ playlist.name }} + + + add + remove + + + + + \ No newline at end of file diff --git a/client/layouts/default.vue b/client/layouts/default.vue index bb93a054..7b316db8 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -11,6 +11,7 @@ + diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 2be5f4e4..12cba278 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -138,7 +138,7 @@ - + @@ -158,6 +158,10 @@ + + + + @@ -608,6 +612,10 @@ export default { this.$store.commit('setSelectedLibraryItem', this.libraryItem) this.$store.commit('globals/setShowCollectionsModal', true) }, + playlistsClick() { + this.$store.commit('globals/setSelectedPlaylistItems', [{ libraryItem: this.libraryItem }]) + this.$store.commit('globals/setShowPlaylistsModal', true) + }, clickRSSFeed() { this.showRssFeedModal = true }, diff --git a/client/store/globals.js b/client/store/globals.js index cf1b5672..b86d6d79 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -4,12 +4,14 @@ export const state = () => ({ showBatchCollectionModal: false, showCollectionsModal: false, showEditCollectionModal: false, + showPlaylistsModal: false, showEditPodcastEpisode: false, showViewPodcastEpisodeModal: false, showConfirmPrompt: false, confirmPromptOptions: null, showEditAuthorModal: false, selectedEpisode: null, + selectedPlaylistItems: null, selectedCollection: null, selectedAuthor: null, isCasting: false, // Actively casting @@ -79,6 +81,9 @@ export const mutations = { setShowEditCollectionModal(state, val) { state.showEditCollectionModal = val }, + setShowPlaylistsModal(state, val) { + state.showPlaylistsModal = val + }, setShowEditPodcastEpisodeModal(state, val) { state.showEditPodcastEpisode = val }, @@ -99,6 +104,9 @@ export const mutations = { setSelectedEpisode(state, episode) { state.selectedEpisode = episode }, + setSelectedPlaylistItems(state, items) { + state.selectedPlaylistItems = items + }, showEditAuthorModal(state, author) { state.selectedAuthor = author state.showEditAuthorModal = true diff --git a/client/store/user.js b/client/store/user.js index 7b57b169..d6b82306 100644 --- a/client/store/user.js +++ b/client/store/user.js @@ -9,7 +9,8 @@ export const state = () => ({ collapseSeries: false, collapseBookSeries: false }, - settingsListeners: [] + settingsListeners: [], + playlists: [] }) export const getters = { @@ -163,5 +164,19 @@ export const mutations = { }, removeSettingsListener(state, listenerId) { state.settingsListeners = state.settingsListeners.filter(l => l.id !== listenerId) + }, + setPlaylists(state, playlists) { + state.playlists = playlists + }, + addUpdatePlaylist(state, playlist) { + const indexOf = state.playlists.findIndex(p => p.id == playlist.id) + if (indexOf >= 0) { + state.playlists.splice(indexOf, 1, playlist) + } else { + state.playlists.push(playlist) + } + }, + removePlaylist(state, playlist) { + state.playlists = state.playlists.filter(p => p.id !== playlist.id) } } \ No newline at end of file diff --git a/client/strings/en-us.json b/client/strings/en-us.json index d92fd606..8d5f5f0f 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -147,6 +147,8 @@ "LabelAddedAt": "Added At", "LabelAddToCollection": "Add to Collection", "LabelAddToCollectionBatch": "Add {0} Books to Collection", + "LabelAddToPlaylist": "Add to Playlist", + "LabelAddToPlaylistBatch": "Add {0} Items to Playlist", "LabelAll": "All", "LabelAllUsers": "All Users", "LabelAuthor": "Author", @@ -282,6 +284,7 @@ "LabelPermissionsUpdate": "Can Update", "LabelPermissionsUpload": "Can Upload", "LabelPhotoPathURL": "Photo Path/URL", + "LabelPlaylists": "Playlists", "LabelPlayMethod": "Play Method", "LabelPodcast": "Podcast", "LabelPodcasts": "Podcasts", @@ -468,6 +471,7 @@ "MessageNotYetImplemented": "Not yet implemented", "MessageNoUpdateNecessary": "No update necessary", "MessageNoUpdatesWereNecessary": "No updates were necessary", + "MessageNoUserPlaylists": "You have no playlists", "MessageOr": "or", "MessagePauseChapter": "Pause chapter playback", "MessagePlayChapter": "Listen to beginning of chapter", @@ -503,6 +507,7 @@ "NoteUploaderUnsupportedFiles": "Unsupported files are ignored. When choosing or dropping a folder, other files that are not in an item folder are ignored.", "PlaceholderNewCollection": "New collection name", "PlaceholderNewFolderPath": "New folder path", + "PlaceholderNewPlaylist": "New playlist name", "PlaceholderSearch": "Search..", "ToastAccountUpdateFailed": "Failed to update account", "ToastAccountUpdateSuccess": "Account updated", @@ -570,4 +575,4 @@ "WeekdayThursday": "Thursday", "WeekdayTuesday": "Tuesday", "WeekdayWednesday": "Wednesday" -} +} \ No newline at end of file
{{ title }}
{{ $strings.MessageNoUserPlaylists }}