From 32616aa4416b4eac6493191812d8ef0d35919b99 Mon Sep 17 00:00:00 2001 From: MxMarx Date: Mon, 23 Oct 2023 20:37:51 -0700 Subject: [PATCH] show a modal with cover images when clicked --- client/components/app/StreamContainer.vue | 2 +- client/components/covers/BookCover.vue | 19 ++++++++++++++++++- client/pages/item/_id/index.vue | 8 ++++---- client/store/globals.js | 4 ++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/client/components/app/StreamContainer.vue b/client/components/app/StreamContainer.vue index 1aecbf4e..3439910f 100644 --- a/client/components/app/StreamContainer.vue +++ b/client/components/app/StreamContainer.vue @@ -2,7 +2,7 @@
- +
diff --git a/client/components/covers/BookCover.vue b/client/components/covers/BookCover.vue index be39ae3c..810baa43 100644 --- a/client/components/covers/BookCover.vue +++ b/client/components/covers/BookCover.vue @@ -5,7 +5,14 @@
- + + + +
+ +
+
+

{{ title }}

@@ -43,10 +50,12 @@ export default { type: Number, default: 120 }, + expandOnClick: Boolean, bookCoverAspectRatio: Number }, data() { return { + showImageModal: false, loading: true, imageFailed: false, showCoverBg: false, @@ -102,6 +111,11 @@ export default { var store = this.$store || this.$nuxt.$store return store.getters['globals/getLibraryItemCoverSrc'](this.libraryItem, this.placeholderUrl) }, + rawCoverUrl() { + if (!this.libraryItem) return null + var store = this.$store || this.$nuxt.$store + return store.getters['globals/getLibraryItemCoverSrc'](this.libraryItem, null, true) + }, cover() { return this.media.coverPath || this.placeholderUrl }, @@ -132,6 +146,9 @@ export default { } }, methods: { + clickCover() { + this.showImageModal = true + }, setCoverBg() { if (this.$refs.coverBg) { this.$refs.coverBg.style.backgroundImage = `url("${this.fullCoverUrl}")` diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 0f4f17b2..eff240f7 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -3,21 +3,21 @@
-
- +
+
-
+
play_circle_filled
- edit + edit
diff --git a/client/store/globals.js b/client/store/globals.js index a202d685..44b35f88 100644 --- a/client/store/globals.js +++ b/client/store/globals.js @@ -80,7 +80,7 @@ export const state = () => ({ }) export const getters = { - getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = null) => { + getLibraryItemCoverSrc: (state, getters, rootState, rootGetters) => (libraryItem, placeholder = null, raw = false) => { if (!placeholder) placeholder = `${rootState.routerBasePath}/book_placeholder.jpg` if (!libraryItem) return placeholder const media = libraryItem.media @@ -94,7 +94,7 @@ export const getters = { const libraryItemId = libraryItem.libraryItemId || libraryItem.id // Workaround for /users/:id page showing media progress covers if (process.env.NODE_ENV !== 'production') { // Testing - return `http://localhost:3333${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}&ts=${lastUpdate}` + return `http://localhost:3333${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}&ts=${lastUpdate}${raw ? '&raw=1' : ''}` } return `${rootState.routerBasePath}/api/items/${libraryItemId}/cover?token=${userToken}&ts=${lastUpdate}`