Reader progress bars

This commit is contained in:
schroda
2024-09-28 03:24:16 +02:00
parent 51fb660c7b
commit 7434ed0152
42 changed files with 1587 additions and 34 deletions

View File

@@ -7,6 +7,7 @@
*/
import { NullAndUndefined } from '@/Base.types.ts';
import { ChapterReaderFieldsFragment } from '@/lib/graphql/generated/graphql.ts';
export type ChapterSortMode = 'fetchedAt' | 'source' | 'chapterNumber' | 'uploadedAt';
@@ -25,3 +26,5 @@ export type ChapterOptionsReducerAction =
| { type: 'sortBy'; sortBy: ChapterSortMode }
| { type: 'sortReverse' }
| { type: 'showChapterNumber' };
export type TChapterReader = ChapterReaderFieldsFragment;

View File

@@ -92,6 +92,7 @@ export type ChapterDownloadInfo = ChapterIdInfo & Pick<ChapterType, 'isDownloade
export type ChapterBookmarkInfo = ChapterIdInfo & Pick<ChapterType, 'isBookmarked'>;
export type ChapterReadInfo = ChapterIdInfo & Pick<ChapterType, 'isRead'>;
export type ChapterNumberInfo = ChapterIdInfo & Pick<ChapterType, 'chapterNumber'>;
export type ChapterSourceOrderInfo = ChapterIdInfo & Pick<ChapterType, 'sourceOrder'>;
export type ChapterScanlatorInfo = ChapterIdInfo & Pick<ChapterType, 'scanlator'>;
export type ChapterRealUrlInfo = Pick<ChapterType, 'realUrl'>;
@@ -115,6 +116,10 @@ export class Chapters {
});
}
static getReaderUrl<Chapter extends ChapterMangaInfo & ChapterSourceOrderInfo>(chapter: Chapter): string {
return `manga/${chapter.mangaId}/chapter/${chapter.sourceOrder}`;
}
static isDownloading(id: number): boolean {
return !!requestManager.graphQLClient.client.cache.readFragment<ChapterType>({
id: requestManager.graphQLClient.client.cache.identify({