feat: ajout du lecteur de chapitres avec gestion des pages, des modes de lecture et des paramètres de zoom

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-03-26 22:52:48 +01:00
parent bf8ca79290
commit 85abca7906
10 changed files with 3500 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
export class Chapter {
constructor({ id, mangaId, number, title, pages = [], read = false, lastReadPage = 0 }) {
this.id = id;
this.mangaId = mangaId;
this.number = number;
this.title = title;
this.pages = pages;
this.read = read;
this.lastReadPage = lastReadPage;
}
static create(data) {
return new Chapter(data);
}
markAsRead() {
this.read = true;
this.lastReadPage = this.pages.length;
}
markAsUnread() {
this.read = false;
this.lastReadPage = 0;
}
updateLastReadPage(pageNumber) {
this.lastReadPage = pageNumber;
this.read = pageNumber === this.pages.length;
}
}

View File

@@ -0,0 +1,31 @@
export class ChapterRepositoryInterface {
/**
* Récupère les informations d'un chapitre
* @param {string} chapterId - L'identifiant du chapitre
* @returns {Promise<Object>} Les informations du chapitre
*/
async getChapter(chapterId) {
throw new Error('Method not implemented');
}
/**
* Récupère la liste des pages d'un chapitre
* @param {string} chapterId - L'identifiant du chapitre
* @param {number} page - Le numéro de page
* @param {number} itemsPerPage - Le nombre d'éléments par page
* @returns {Promise<Object>} La liste des pages avec leurs métadonnées
*/
async getChapterPages(chapterId, page = 1, itemsPerPage = 20) {
throw new Error('Method not implemented');
}
/**
* Récupère une page spécifique d'un chapitre
* @param {string} chapterId - L'identifiant du chapitre
* @param {number} pageNumber - Le numéro de la page
* @returns {Promise<Object>} Les données de la page
*/
async getChapterPage(chapterId, pageNumber) {
throw new Error('Method not implemented');
}
}