From 88d4342ef5a17bb65f966b77620cd8dfbd7e42b9 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Wed, 6 Jan 2021 15:12:19 +0800 Subject: [PATCH] feat(webui): navigate between books of a readlist --- komga-webui/src/components/Dialogs.vue | 1 + komga-webui/src/components/ItemCard.vue | 6 +- .../components/ReadListsExpansionPanels.vue | 3 + komga-webui/src/components/SearchBox.vue | 1 + .../components/dialogs/EditBooksDialog.vue | 1 + .../dialogs/ReadListAddToDialog.vue | 1 + .../src/components/menus/BookActionsMenu.vue | 1 + .../components/readers/ContinuousReader.vue | 1 + .../src/components/readers/PagedReader.vue | 1 + komga-webui/src/functions/authors.ts | 1 + komga-webui/src/functions/book-format.ts | 2 + komga-webui/src/functions/book-progress.ts | 1 + komga-webui/src/functions/page.ts | 2 + .../src/services/komga-books.service.ts | 1 + .../src/services/komga-readlists.service.ts | 25 +++++++ .../src/services/komga-series.service.ts | 1 + komga-webui/src/store.ts | 1 + komga-webui/src/types/context.ts | 9 +++ komga-webui/src/types/events.ts | 2 + komga-webui/src/types/items.ts | 29 ++++++++- komga-webui/src/types/komga-books.ts | 25 ++++--- komga-webui/src/views/BookReader.vue | 1 + komga-webui/src/views/BrowseBook.vue | 65 +++++++++++++++++-- komga-webui/src/views/BrowseReadList.vue | 3 + komga-webui/src/views/BrowseSeries.vue | 1 + komga-webui/src/views/Dashboard.vue | 1 + komga-webui/src/views/Search.vue | 1 + .../src/views/SettingsMediaAnalysis.vue | 1 + 28 files changed, 170 insertions(+), 18 deletions(-) create mode 100644 komga-webui/src/types/context.ts diff --git a/komga-webui/src/components/Dialogs.vue b/komga-webui/src/components/Dialogs.vue index 38014566e..fb407c51b 100644 --- a/komga-webui/src/components/Dialogs.vue +++ b/komga-webui/src/components/Dialogs.vue @@ -92,6 +92,7 @@ import Vue from 'vue' import ReadListAddToDialog from '@/components/dialogs/ReadListAddToDialog.vue' import ReadListDeleteDialog from '@/components/dialogs/ReadListDeleteDialog.vue' import ReadListEditDialog from '@/components/dialogs/ReadListEditDialog.vue' +import { BookDto } from '@/types/komga-books' export default Vue.extend({ name: 'Dialogs', diff --git a/komga-webui/src/components/ItemCard.vue b/komga-webui/src/components/ItemCard.vue index af3e85f4c..f505e978a 100644 --- a/komga-webui/src/components/ItemCard.vue +++ b/komga-webui/src/components/ItemCard.vue @@ -50,7 +50,7 @@ x-large color="accent" style="position: absolute; top: 50%; left: 50%; margin-left: -36px; margin-top: -36px" - :to="{name: 'read-book', params: { bookId: item.id}}" + :to="fabTo" > mdi-book-open-page-variant @@ -124,6 +124,7 @@ import { createItem, Item, ItemTypes } from '@/types/items' import Vue from 'vue' import { RawLocation } from 'vue-router' import ReadListActionsMenu from '@/components/menus/ReadListActionsMenu.vue' +import { BookDto } from '@/types/komga-books' export default Vue.extend({ name: 'ItemCard', @@ -232,6 +233,9 @@ export default Vue.extend({ to (): RawLocation { return this.computedItem.to() }, + fabTo (): RawLocation { + return this.computedItem.fabTo() + }, }, methods: { onClick () { diff --git a/komga-webui/src/components/ReadListsExpansionPanels.vue b/komga-webui/src/components/ReadListsExpansionPanels.vue index 00ff9adeb..ed10ecda3 100644 --- a/komga-webui/src/components/ReadListsExpansionPanels.vue +++ b/komga-webui/src/components/ReadListsExpansionPanels.vue @@ -30,6 +30,8 @@ import HorizontalScroller from '@/components/HorizontalScroller.vue' import ItemBrowser from '@/components/ItemBrowser.vue' import Vue from 'vue' +import { BookDto } from '@/types/komga-books' +import { ContextOrigin } from '@/types/context' export default Vue.extend({ name: 'ReadListsExpansionPanels', @@ -62,6 +64,7 @@ export default Vue.extend({ const rlId = this.readLists[val].id if (this.$_.isEmpty(this.readListsContent[val])) { const content = (await this.$komgaReadLists.getBooks(rlId, { unpaged: true } as PageRequest)).content + content.forEach((x: BookDto) => x.context = { origin: ContextOrigin.READLIST, id: rlId }) this.readListsContent.splice(val, 1, content) } } diff --git a/komga-webui/src/components/SearchBox.vue b/komga-webui/src/components/SearchBox.vue index cdf66d79d..92ebf6107 100644 --- a/komga-webui/src/components/SearchBox.vue +++ b/komga-webui/src/components/SearchBox.vue @@ -105,6 +105,7 @@ import { bookThumbnailUrl, collectionThumbnailUrl, readListThumbnailUrl, seriesThumbnailUrl } from '@/functions/urls' import { debounce } from 'lodash' import Vue from 'vue' +import { BookDto } from '@/types/komga-books' export default Vue.extend({ name: 'SearchBox', diff --git a/komga-webui/src/components/dialogs/EditBooksDialog.vue b/komga-webui/src/components/dialogs/EditBooksDialog.vue index a3c33ba8a..64d663308 100644 --- a/komga-webui/src/components/dialogs/EditBooksDialog.vue +++ b/komga-webui/src/components/dialogs/EditBooksDialog.vue @@ -279,6 +279,7 @@ import { authorRoles } from '@/types/author-roles' import moment from 'moment' import Vue from 'vue' import { helpers, requiredIf } from 'vuelidate/lib/validators' +import { BookDto } from '@/types/komga-books' const validDate = (value: any) => !helpers.req(value) || moment(value, 'YYYY-MM-DD', true).isValid() diff --git a/komga-webui/src/components/dialogs/ReadListAddToDialog.vue b/komga-webui/src/components/dialogs/ReadListAddToDialog.vue index b23736966..e75be329c 100644 --- a/komga-webui/src/components/dialogs/ReadListAddToDialog.vue +++ b/komga-webui/src/components/dialogs/ReadListAddToDialog.vue @@ -80,6 +80,7 @@