From 3138865d6935dfb785a5766ddf0a5d2ae4c05bca Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 24 Mar 2023 17:57:41 -0500 Subject: [PATCH] Update toc menu and media progress display --- client/components/cards/LazyBookCard.vue | 7 +- client/components/readers/EpubReader.vue | 104 +++++++++++++---------- client/components/readers/Reader.vue | 39 ++++----- client/pages/item/_id/index.vue | 9 +- 4 files changed, 89 insertions(+), 70 deletions(-) diff --git a/client/components/cards/LazyBookCard.vue b/client/components/cards/LazyBookCard.vue index 649b25a8..c4d3e967 100644 --- a/client/components/cards/LazyBookCard.vue +++ b/client/components/cards/LazyBookCard.vue @@ -325,8 +325,13 @@ export default { if (this.episodeProgress) return this.episodeProgress return this.store.getters['user/getUserMediaProgress'](this.libraryItemId) }, + useEBookProgress() { + if (!this.userProgress || this.userProgress.progress) return false + return this.userProgress.ebookProgress > 0 + }, userProgressPercent() { - return this.userProgress ? Math.max(this.userProgress.progress || 0, this.userProgress.ebookProgress || 0) : 0 + if (this.useEBookProgress) return Math.max(Math.min(1, this.userProgress.ebookProgress), 0) + return this.userProgress ? Math.max(Math.min(1, this.userProgress.progress), 0) || 0 : 0 }, itemIsFinished() { return this.userProgress ? !!this.userProgress.isFinished : false diff --git a/client/components/readers/EpubReader.vue b/client/components/readers/EpubReader.vue index e8fb0cff..8e7d016c 100644 --- a/client/components/readers/EpubReader.vue +++ b/client/components/readers/EpubReader.vue @@ -2,26 +2,22 @@
- chevron_left + chevron_left
-
+
- chevron_right + chevron_right
diff --git a/client/components/readers/Reader.vue b/client/components/readers/Reader.vue index 1d7ef6d6..a7383fb7 100644 --- a/client/components/readers/Reader.vue +++ b/client/components/readers/Reader.vue @@ -1,13 +1,11 @@ @@ -145,13 +141,10 @@ export default { }, methods: { toggleToC() { - this.tocOpen = !this.tocOpen; - this.chapters = this.$refs.readerComponent.chapters; - this.$refs.tocContainer.classList.toggle('invisible') - this.$refs.tocOverlay.classList.toggle('opacity-0') - this.$refs.tocOverlay.classList.toggle('opacity-50') + this.tocOpen = !this.tocOpen + this.chapters = this.$refs.readerComponent.chapters }, - openSettings() { }, + openSettings() {}, hotkey(action) { console.log('Reader hotkey', action) if (!this.$refs.readerComponent) return @@ -192,4 +185,8 @@ export default { .ebook-viewer { height: calc(100% - 96px); } +.tocContent { + height: calc(100% - 36px); + overflow-y: auto; +} \ No newline at end of file diff --git a/client/pages/item/_id/index.vue b/client/pages/item/_id/index.vue index 988b89cc..dfcdf38b 100644 --- a/client/pages/item/_id/index.vue +++ b/client/pages/item/_id/index.vue @@ -156,7 +156,7 @@

{{ $strings.LabelYourProgress }}: {{ Math.round(progressPercent * 100) }}%

{{ $strings.LabelFinished }} {{ $formatDate(userProgressFinishedAt, dateFormat) }}

-

{{ $getString('LabelTimeRemaining', [$elapsedPretty(userTimeRemaining)]) }}

+

{{ $getString('LabelTimeRemaining', [$elapsedPretty(userTimeRemaining)]) }}

{{ $strings.LabelStarted }} {{ $formatDate(userProgressStartedAt, dateFormat) }}

@@ -471,8 +471,13 @@ export default { const duration = this.userMediaProgress.duration || this.duration return duration - this.userMediaProgress.currentTime }, + useEBookProgress() { + if (!this.userMediaProgress || this.userMediaProgress.progress) return false + return this.userMediaProgress.ebookProgress > 0 + }, progressPercent() { - return this.userMediaProgress ? Math.max(Math.min(1, Math.max(this.userMediaProgress.progress || 0, this.userMediaProgress.ebookProgress || 0)), 0) : 0 + if (this.useEBookProgress) return Math.max(Math.min(1, this.userMediaProgress.ebookProgress), 0) + return this.userMediaProgress ? Math.max(Math.min(1, this.userMediaProgress.progress), 0) : 0 }, userProgressStartedAt() { return this.userMediaProgress ? this.userMediaProgress.startedAt : 0