@@ -22,6 +22,8 @@ type BaseCollectionSorting =
2222 | "END_DATE_DESC"
2323 | "SCORE"
2424 | "SCORE_DESC"
25+ | "AUDIENCE_SCORE"
26+ | "AUDIENCE_SCORE_DESC"
2527 | "RELEASE_DATE"
2628 | "RELEASE_DATE_DESC"
2729 | "PROGRESS"
@@ -36,9 +38,9 @@ type CollectionSorting<T extends CollectionType> = BaseCollectionSorting | (T ex
3638 | "AIRDATE"
3739 | "AIRDATE_DESC"
3840 : T extends "manga" ?
39- "PROGRESS"
40- | "PROGRESS_DESC"
41- : never )
41+ "PROGRESS"
42+ | "PROGRESS_DESC"
43+ : never )
4244
4345
4446type ContinueWatchingSorting =
@@ -76,6 +78,8 @@ export const COLLECTION_SORTING_OPTIONS = [
7678 { label : "Lowest score" , value : "SCORE" } ,
7779 { label : "Title" , value : "TITLE" } ,
7880 { label : "Title (Z-A)" , value : "TITLE_DESC" } ,
81+ { label : "Highest audience score" , value : "AUDIENCE_SCORE_DESC" } ,
82+ { label : "Lowest audience score" , value : "AUDIENCE_SCORE" } ,
7983 { label : "Highest progress" , value : "PROGRESS_DESC" } ,
8084 { label : "Lowest progress" , value : "PROGRESS" } ,
8185 { label : "Started recently" , value : "START_DATE_DESC" } ,
@@ -240,6 +244,11 @@ export function filterListEntries<T extends AL_MangaCollection_MediaListCollecti
240244 if ( getParamValue ( params . sorting ) === "SCORE_DESC" )
241245 arr = sortBy ( arr , n => n ?. score || 0 ) . reverse ( )
242246
247+ if ( getParamValue ( params . sorting ) === "AUDIENCE_SCORE" )
248+ arr = sortBy ( arr , n => n ?. media ?. meanScore || 999999 )
249+ if ( getParamValue ( params . sorting ) === "AUDIENCE_SCORE_DESC" )
250+ arr = sortBy ( arr , n => n ?. media ?. meanScore || 0 ) . reverse ( )
251+
243252 // Sort by start date
244253 // if (getParamValue(params.sorting) === "START_DATE" || getParamValue(params.sorting) === "START_DATE_DESC") {
245254 // arr = arr?.filter(n => n.startedAt && !!n.startedAt.year && !!n.startedAt.month && !!n.startedAt.day)
0 commit comments