Add more chapter list sort options
- by chapter number - by upload date
This commit is contained in:
@@ -420,8 +420,10 @@
|
|||||||
},
|
},
|
||||||
"sort": {
|
"sort": {
|
||||||
"label": {
|
"label": {
|
||||||
|
"by_chapter_number": "By chapter number",
|
||||||
"by_fetch_date": "By date fetched",
|
"by_fetch_date": "By date fetched",
|
||||||
"by_source": "By source"
|
"by_source": "By source",
|
||||||
|
"by_upload_date": "By upload date"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"time": {
|
"time": {
|
||||||
|
|||||||
@@ -92,6 +92,12 @@ const sortChapters = (
|
|||||||
case 'fetchedAt':
|
case 'fetchedAt':
|
||||||
sortedChapters.sort((a, b) => Number(a.fetchedAt ?? 0) - Number(b.fetchedAt ?? 0));
|
sortedChapters.sort((a, b) => Number(a.fetchedAt ?? 0) - Number(b.fetchedAt ?? 0));
|
||||||
break;
|
break;
|
||||||
|
case 'chapterNumber':
|
||||||
|
sortedChapters.sort((a, b) => a.chapterNumber - b.chapterNumber);
|
||||||
|
break;
|
||||||
|
case 'uploadedAt':
|
||||||
|
sortedChapters.sort((a, b) => Number(a.uploadDate ?? 0) - Number(b.uploadDate ?? 0));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
@@ -125,6 +131,8 @@ export const useChapterOptions = (mangaId: number) =>
|
|||||||
|
|
||||||
export const SORT_OPTIONS: [ChapterSortMode, TranslationKey][] = [
|
export const SORT_OPTIONS: [ChapterSortMode, TranslationKey][] = [
|
||||||
['source', 'global.sort.label.by_source'],
|
['source', 'global.sort.label.by_source'],
|
||||||
|
['chapterNumber', 'global.sort.label.by_chapter_number'],
|
||||||
|
['uploadedAt', 'global.sort.label.by_upload_date'],
|
||||||
['fetchedAt', 'global.sort.label.by_fetch_date'],
|
['fetchedAt', 'global.sort.label.by_fetch_date'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ export type PaginatedMangaList = {
|
|||||||
|
|
||||||
export type NullAndUndefined<T> = T | null | undefined;
|
export type NullAndUndefined<T> = T | null | undefined;
|
||||||
|
|
||||||
export type ChapterSortMode = 'fetchedAt' | 'source';
|
export type ChapterSortMode = 'fetchedAt' | 'source' | 'chapterNumber' | 'uploadedAt';
|
||||||
|
|
||||||
export interface ChapterListOptions {
|
export interface ChapterListOptions {
|
||||||
active: boolean;
|
active: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user