From 908b9da112f1fdb94149cc029899e9d5e0d33450 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 3 Nov 2021 17:45:47 -0500 Subject: [PATCH] Change: Bookmark UI #115 --- client/components/app/StreamContainer.vue | 30 +------ client/components/modals/BookmarksModal.vue | 83 ++++++++----------- .../modals/bookmarks/BookmarkItem.vue | 75 ++++++++++++++--- package-lock.json | 8 +- package.json | 4 +- server/Db.js | 10 ++- 6 files changed, 115 insertions(+), 95 deletions(-) diff --git a/client/components/app/StreamContainer.vue b/client/components/app/StreamContainer.vue index e86f10d2..08ec55d9 100644 --- a/client/components/app/StreamContainer.vue +++ b/client/components/app/StreamContainer.vue @@ -27,7 +27,7 @@ - + @@ -58,7 +58,7 @@ export default { }, bookmarks() { if (!this.userAudiobook) return [] - return this.userAudiobook.bookmarks || [] + return (this.userAudiobook.bookmarks || []).map((bm) => ({ ...bm })).sort((a, b) => a.time - b.time) }, isLoading() { if (!this.streamAudiobook) return false @@ -111,38 +111,12 @@ export default { this.bookmarkCurrentTime = currentTime this.showBookmarksModal = true }, - // bookmarkCreated(time) { - // if (time === this.bookmarkTimeProcessing) { - // this.bookmarkTimeProcessing = 0 - // this.$toast.success(`${this.$secondsToTimestamp(time)} Bookmarked`) - // } - // }, - createBookmark(bookmark) { - // this.bookmarkTimeProcessing = bookmark.time - this.$root.socket.emit('create_bookmark', bookmark) - this.showBookmarksModal = false - }, - // bookmarkUpdated(time) { - // if (time === this.bookmarkTimeProcessing) { - // this.bookmarkTimeProcessing = 0 - // this.$toast.success(`Bookmark @${this.$secondsToTimestamp(time)} Updated`) - // } - // }, - updateBookmark(bookmark) { - // this.bookmarkTimeProcessing = bookmark.time - this.$root.socket.emit('update_bookmark', bookmark) - this.showBookmarksModal = false - }, selectBookmark(bookmark) { if (this.$refs.audioPlayer) { this.$refs.audioPlayer.selectBookmark(bookmark) } this.showBookmarksModal = false }, - deleteBookmark(bookmark) { - this.$root.socket.emit('delete_bookmark', bookmark) - this.showBookmarksModal = false - }, filterByAuthor() { if (this.$route.name !== 'index') { this.$router.push(`/library/${this.libraryId || this.$store.state.libraries.currentLibraryId}/bookshelf`) diff --git a/client/components/modals/BookmarksModal.vue b/client/components/modals/BookmarksModal.vue index b934281f..b416c538 100644 --- a/client/components/modals/BookmarksModal.vue +++ b/client/components/modals/BookmarksModal.vue @@ -1,38 +1,27 @@