refactor: move project to frontend directory
This commit is contained in:
20
frontend/src/components/manga/util.manga.ts
Normal file
20
frontend/src/components/manga/util.manga.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type {ViewEntry} from '@/components/manga/MangaList.vue';
|
||||
import type {MangaUpdatesChapter} from '@/data/models/mangaupdates/MangaUpdatesChapter';
|
||||
|
||||
export function latestChaptersSorted(entry: ViewEntry): MangaUpdatesChapter[] {
|
||||
return entry.chapters.sort((l, r) => l.chapter - r.chapter);
|
||||
}
|
||||
|
||||
export function latestChapterString(entry: ViewEntry): string {
|
||||
if (entry.media?.chapters) {
|
||||
return '' + entry.media.chapters;
|
||||
} else if (entry.chapters.length) {
|
||||
return entry.chapters.reduce((l, r) => Math.max(l, r.chapter), 0) + '+';
|
||||
}
|
||||
return '?';
|
||||
}
|
||||
|
||||
export function newChapterCount(entry: ViewEntry): number {
|
||||
const max = entry.media?.chapters || entry.chapters.reduce((l, r) => Math.max(l, r.chapter), 0);
|
||||
return Math.max(0, max - entry.entry.progress);
|
||||
}
|
||||
Reference in New Issue
Block a user