mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feat-930] added added date sorting for maps/songs (#931)
* [feat-930] added added date sorting for maps/songs * [feat-930] add translations * [feat-930] fixed date format issue --------- Co-authored-by: Zagrios <40181755+Zagrios@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,12 @@ export interface BsmLocalMap {
|
||||
mapInfo: MapInfo;
|
||||
songDetails?: SongDetails;
|
||||
path: string;
|
||||
metadata?: BsmLocalMapMetadata;
|
||||
}
|
||||
|
||||
export interface BsmLocalMapMetadata {
|
||||
// Date of download or import
|
||||
addedDate: string;
|
||||
}
|
||||
|
||||
export interface BsmLocalMapsProgress {
|
||||
|
||||
@@ -35,6 +35,13 @@ export const mapSorter = new Sorter<BsmLocalMap>({
|
||||
|
||||
return !map2.songDetails ? Comparison.GREATER : map1.songDetails.uploadedAt - map2.songDetails.uploadedAt;
|
||||
},
|
||||
"added-date": (map1, map2) => {
|
||||
if (!map1.metadata) {
|
||||
return map2.metadata ? Comparison.LESSER : Comparison.EQUAL;
|
||||
}
|
||||
|
||||
return !map2.metadata ? Comparison.GREATER : map1.metadata.addedDate.localeCompare(map2.metadata.addedDate);
|
||||
}
|
||||
},
|
||||
tiebreak: sortName,
|
||||
defaultKey: "name"
|
||||
|
||||
Reference in New Issue
Block a user