Update downloadable check in chapter list

Check for single chapter card was never updated and the downloadable condition was incorrectly changed with 6c01c222c3
This commit is contained in:
schroda
2024-09-18 12:50:04 +02:00
parent 34ebe82df1
commit fab5f0b860
2 changed files with 10 additions and 5 deletions

View File

@@ -50,11 +50,12 @@ export class ChaptersWithMeta {
return chapters.filter(({ chapter }) => !Chapters.isDownloaded(chapter));
}
static isDownloadable<Chapter extends ChapterWithMetaType>({ chapter, downloadChapter }: Chapter): boolean {
return !Chapters.isDownloaded(chapter) && (!downloadChapter || downloadChapter?.state === DownloadState.Error);
}
static getDownloadable<Chapter extends ChapterWithMetaType>(chapters: Chapter[]): Chapter[] {
return chapters.filter(
({ chapter, downloadChapter }) =>
!Chapters.isDownloaded(chapter) && (!downloadChapter || downloadChapter?.state === DownloadState.Error),
);
return chapters.filter(this.isDownloadable);
}
static getBookmarked<Chapter extends ChapterWithMetaType>(chapters: Chapter[]): Chapter[] {