diff --git a/resources/js/app.js b/resources/js/app.js index 9f52a119..6856b951 100755 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -145,7 +145,7 @@ const router = new VueRouter({ { path: '/login', component: LoginForm }, { path: '/admin', component: AdminLayout }, { path: '/media-player', component: MediaPlayer }, - { path: '/books', component: Books }, + { path: '/books/:bookId?', component: Books }, { path: '/chapters/read/:chapterId', component: TextReader }, { path: '/flashcards', component: FlashcardCollectionList }, { path: '/flashcards/edit/:flashcardCollectionId?', component: FlashcardCollection }, diff --git a/resources/js/components/Home/PatchNotes.vue b/resources/js/components/Home/PatchNotes.vue index c878d0aa..abb1be25 100644 --- a/resources/js/components/Home/PatchNotes.vue +++ b/resources/js/components/Home/PatchNotes.vue @@ -15,16 +15,27 @@
  • Added hotkeys for the text reader and review pages.
  • +
  • + Added proper finish reading screen. +
  • + Bug fixes: + + Other changes: + diff --git a/resources/js/components/Library/Books.vue b/resources/js/components/Library/Books.vue index 548f9aa1..aaeef8db 100644 --- a/resources/js/components/Library/Books.vue +++ b/resources/js/components/Library/Books.vue @@ -320,14 +320,24 @@ for (let bookIndex = 0; bookIndex < this.books.length; bookIndex ++) { if (bookId !== this.books[bookIndex].id) { this.books[bookIndex].chaptersVisible = false; + } else { this.anyChapterVisible = !this.books[bookIndex].chaptersVisible; this.books[bookIndex].chaptersVisible = !this.books[bookIndex].chaptersVisible; + setTimeout(() => { document.getElementById('book-' + bookId).scrollIntoView(); }, 500); } } + + if (this.anyChapterVisible && this.$router.currentRoute.fullPath !== ('/books/' + bookId)) { + this.$router.push('/books/' + bookId); + } + + if (!this.anyChapterVisible && this.$router.currentRoute.fullPath !== ('/books')) { + this.$router.push('/books'); + } }, showStartReviewDialog(bookId, bookName) { this.startReviewDialog.bookName = bookName; @@ -347,6 +357,10 @@ } this.books = response.data; + + if (this.$route.params.bookId !== undefined) { + this.toggleChapters(parseInt(this.$route.params.bookId)); + } }); }, formatNumber: formatNumber diff --git a/resources/js/components/Text/TextBlockGroup.vue b/resources/js/components/Text/TextBlockGroup.vue index 9e991d9c..bb07c7ef 100644 --- a/resources/js/components/Text/TextBlockGroup.vue +++ b/resources/js/components/Text/TextBlockGroup.vue @@ -107,7 +107,7 @@