diff --git a/assets/vue/app/domain/manga/infrastructure/api/apiMangaRepository.js b/assets/vue/app/domain/manga/infrastructure/api/apiMangaRepository.js index 15e27aa..f06dd56 100644 --- a/assets/vue/app/domain/manga/infrastructure/api/apiMangaRepository.js +++ b/assets/vue/app/domain/manga/infrastructure/api/apiMangaRepository.js @@ -52,9 +52,12 @@ export class ApiMangaRepository { page++; } + // Filtrer pour ne garder que les chapitres visibles + const visibleChapters = allChapters.filter(chapter => chapter.isVisible === true); + return { - items: allChapters, - total: allChapters.length + items: visibleChapters, + total: visibleChapters.length }; } catch (error) { console.error('API Error:', error); diff --git a/assets/vue/app/domain/reader/application/store/readerStore.js b/assets/vue/app/domain/reader/application/store/readerStore.js index 0492a46..1305a45 100644 --- a/assets/vue/app/domain/reader/application/store/readerStore.js +++ b/assets/vue/app/domain/reader/application/store/readerStore.js @@ -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); + } } } }); diff --git a/assets/vue/app/domain/reader/domain/entities/Chapter.js b/assets/vue/app/domain/reader/domain/entities/Chapter.js index ea84aef..5e2413b 100644 --- a/assets/vue/app/domain/reader/domain/entities/Chapter.js +++ b/assets/vue/app/domain/reader/domain/entities/Chapter.js @@ -1,5 +1,5 @@ export class Chapter { - constructor({ id, mangaId, number, title, pages = [], read = false, lastReadPage = 0 }) { + constructor({ id, mangaId, number, title, pages = [], read = false, lastReadPage = 0, navigation = {} }) { this.id = id; this.mangaId = mangaId; this.number = number; @@ -7,6 +7,10 @@ export class Chapter { this.pages = pages; this.read = read; this.lastReadPage = lastReadPage; + this.navigation = { + previousChapter: navigation.previousChapter || null, + nextChapter: navigation.nextChapter || null + }; } static create(data) { diff --git a/assets/vue/app/domain/reader/presentation/components/ChapterNavigation.vue b/assets/vue/app/domain/reader/presentation/components/ChapterNavigation.vue new file mode 100644 index 0000000..7d9fd16 --- /dev/null +++ b/assets/vue/app/domain/reader/presentation/components/ChapterNavigation.vue @@ -0,0 +1,89 @@ + + + + + diff --git a/assets/vue/app/domain/reader/presentation/components/ChapterReader.vue b/assets/vue/app/domain/reader/presentation/components/ChapterReader.vue index f677e88..f7c7b6a 100644 --- a/assets/vue/app/domain/reader/presentation/components/ChapterReader.vue +++ b/assets/vue/app/domain/reader/presentation/components/ChapterReader.vue @@ -1,7 +1,7 @@