feat: amélioration de la navigation du Reader + correction affichage des chapitres non visibles

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-06-06 15:46:44 +02:00
parent 72d7c233f7
commit 05dd7262eb
10 changed files with 627 additions and 22 deletions

View File

@@ -19,7 +19,9 @@ export const useReaderStore = defineStore('reader', {
getters: {
isFirstPage: state => state.currentPage === 0,
isLastPage: state => state.currentPage === state.totalPages - 1,
currentPageData: state => state.pages[state.currentPage]
currentPageData: state => state.pages[state.currentPage],
hasPreviousChapter: state => Boolean(state.currentChapter?.navigation?.previousChapter),
hasNextChapter: state => Boolean(state.currentChapter?.navigation?.nextChapter)
},
actions: {
@@ -159,6 +161,24 @@ export const useReaderStore = defineStore('reader', {
setZoom(level) {
this.zoom = level;
},
async goToPreviousChapter() {
if (this.currentChapter?.navigation?.previousChapter) {
await this.loadChapter(this.currentChapter.navigation.previousChapter);
// Aller à la dernière page du chapitre précédent
this.currentPage = Math.max(0, this.totalPages - 1);
// S'assurer que la page est chargée
if (this.totalPages > 0) {
await this.loadPageData(this.currentPage);
}
}
},
async goToNextChapter() {
if (this.currentChapter?.navigation?.nextChapter) {
await this.loadChapter(this.currentChapter.navigation.nextChapter);
}
}
}
});