Added sort by last read (#254)
This commit is contained in:
@@ -70,6 +70,8 @@ const sortByTitle = (a: IMangaCard, b: IMangaCard): number => a.title.localeComp
|
||||
|
||||
const sortByDateAdded = (a: IMangaCard, b: IMangaCard): number => a.inLibraryAt - b.inLibraryAt;
|
||||
|
||||
const sortByLastRead = (a: IMangaCard, b: IMangaCard): number => b.lastReadAt - a.lastReadAt;
|
||||
|
||||
const sortManga = (
|
||||
manga: IMangaCard[],
|
||||
sort: NullAndUndefined<LibrarySortMode>,
|
||||
@@ -87,6 +89,9 @@ const sortManga = (
|
||||
case 'sortToRead':
|
||||
result.sort(sortByUnread);
|
||||
break;
|
||||
case 'sortLastRead':
|
||||
result.sort(sortByLastRead);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ const SORT_OPTIONS: [LibrarySortMode, string][] = [
|
||||
['sortToRead', 'By Unread chapters'],
|
||||
['sortAlph', 'Alphabetically'],
|
||||
['sortDateAdded', 'Date Added'],
|
||||
['sortLastRead', 'Last Read'],
|
||||
];
|
||||
|
||||
interface IProps {
|
||||
|
||||
Reference in New Issue
Block a user