Skip to content

Commit

Permalink
feat(webreader): mark progress while reading
Browse files Browse the repository at this point in the history
progress will be marked after each page is read
progress will be restored when opening a book

related to #25
  • Loading branch information
gotson committed Jun 2, 2020
1 parent 24c994f commit 10895a3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions komga-webui/src/views/BookReader.vue
Expand Up @@ -271,15 +271,15 @@
</template>

<script lang="ts">
import SettingsSwitch from '@/components/SettingsSwitch.vue'
import SettingsSelect from '@/components/SettingsSelect.vue'
import SettingsSwitch from '@/components/SettingsSwitch.vue'
import ThumbnailExplorerDialog from '@/components/ThumbnailExplorerDialog.vue'
import { getBookTitleCompact } from '@/functions/book-title'
import { checkWebpFeature } from '@/functions/check-webp'
import { bookPageUrl } from '@/functions/urls'
import Vue from 'vue'
import { getBookTitleCompact } from '@/functions/book-title'
import { ReadingDirection } from '@/types/enum-books'
import Vue from 'vue'
const cookieFit = 'webreader.fit'
const cookieReadingDirection = 'webreader.readingDirection'
Expand Down Expand Up @@ -397,6 +397,7 @@ export default Vue.extend({
currentPage (val) {
this.updateRoute()
this.goToPage = val
this.markProgress(val)
},
async book (val) {
if (this.$_.has(val, 'name')) {
Expand Down Expand Up @@ -564,6 +565,8 @@ export default Vue.extend({
this.pages = await this.$komgaBooks.getBookPages(bookId)
if (page >= 1 && page <= this.pagesCount) {
this.goTo(page)
} else if (this.book.readProgress?.completed === false) {
this.goTo(this.book.readProgress?.page!!)
} else {
this.goToFirst()
}
Expand Down Expand Up @@ -696,6 +699,9 @@ export default Vue.extend({
setter(value)
}
},
async markProgress (page: number) {
this.$komgaBooks.updateReadProgress(this.bookId, { page: page })
},
},
})
</script>
Expand Down

0 comments on commit 10895a3

Please sign in to comment.