From a59f26365f660fbf0ca6ffa70df029bf14f07ba9 Mon Sep 17 00:00:00 2001 From: Gauthier Roebroeck Date: Thu, 4 Jun 2020 11:44:26 +0800 Subject: [PATCH] feat(webui): read button on item card closes #133 --- komga-webui/src/components/ItemCard.vue | 44 ++++++++++++++++++-- komga-webui/src/styles/unread-triangle.css | 10 ----- komga-webui/src/views/BrowseBook.vue | 47 +++++----------------- 3 files changed, 50 insertions(+), 51 deletions(-) delete mode 100644 komga-webui/src/styles/unread-triangle.css diff --git a/komga-webui/src/components/ItemCard.vue b/komga-webui/src/components/ItemCard.vue index 1f1770a953..5c63ddf358 100644 --- a/komga-webui/src/components/ItemCard.vue +++ b/komga-webui/src/components/ItemCard.vue @@ -32,6 +32,7 @@ :opacity="hover ? 0.3 : 0" :class="`${hover ? 'item-border-darken' : selected ? 'item-border' : 'item-border-transparent'} overlay-full`" > + + + + mdi-book-open-page-variant + + + BookDto | SeriesDto, required: true, }, + // hide the bottom part of the card thumbnailOnly: { type: Boolean, default: false, }, + // disables the default link on clicking the card noLink: { type: Boolean, default: false, @@ -100,19 +116,23 @@ export default Vue.extend({ required: false, default: 150, }, + // when true, card will show the active border and circle icon full selected: { type: Boolean, default: false, }, + // when true, will display the border like if the card was hovered, and click anywhere will trigger onSelected preselect: { type: Boolean, required: false, }, + // callback function to call when selecting the card onSelected: { type: Function, default: undefined, required: false, }, + // callback function for the edit button onEdit: { type: Function, default: undefined, @@ -124,7 +144,7 @@ export default Vue.extend({ }, computed: { overlay (): boolean { - return this.onEdit !== undefined || this.onSelected !== undefined + return this.onEdit !== undefined || this.onSelected !== undefined || this.bookReady }, computedItem (): Item { return createItem(this.item) @@ -160,6 +180,12 @@ export default Vue.extend({ if ('seriesId' in this.item) return getReadProgressPercentage(this.item) return 0 }, + bookReady (): boolean { + if ('seriesId' in this.item) { + return this.item.media.status === 'READY' + } + return false + }, }, methods: { onClick () { @@ -187,9 +213,7 @@ export default Vue.extend({ diff --git a/komga-webui/src/styles/unread-triangle.css b/komga-webui/src/styles/unread-triangle.css deleted file mode 100644 index 31fb417fec..0000000000 --- a/komga-webui/src/styles/unread-triangle.css +++ /dev/null @@ -1,10 +0,0 @@ -.unread { - border-left: 25px solid transparent; - border-right: 25px solid orange; - border-bottom: 25px solid transparent; - height: 0; - width: 0; - position: absolute; - right: 0; - z-index: 2; -} diff --git a/komga-webui/src/views/BrowseBook.vue b/komga-webui/src/views/BrowseBook.vue index ff183e6b1f..62322640ba 100644 --- a/komga-webui/src/views/BrowseBook.vue +++ b/komga-webui/src/views/BrowseBook.vue @@ -46,40 +46,13 @@ - - - - + @@ -140,7 +113,7 @@ import Badge from '@/components/Badge.vue' import EditBooksDialog from '@/components/EditBooksDialog.vue' +import ItemCard from '@/components/ItemCard.vue' import ToolbarSticky from '@/components/ToolbarSticky.vue' import { groupAuthorsByRolePlural } from '@/functions/authors' import { getBookFormatFromMediaType } from '@/functions/book-format' @@ -206,7 +180,7 @@ import Vue from 'vue' export default Vue.extend({ name: 'BrowseBook', - components: { ToolbarSticky, Badge, EditBooksDialog }, + components: { ToolbarSticky, Badge, EditBooksDialog, ItemCard }, data: () => { return { book: {} as BookDto, @@ -288,5 +262,4 @@ export default Vue.extend({