mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-23 05:33:07 +01:00
add sort by unread count util
This commit is contained in:
parent
9ab16edb4b
commit
69727735b7
1 changed files with 8 additions and 0 deletions
|
@ -30,3 +30,11 @@ export const factoryRoomIdByAtoZ =
|
|||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
export const factoryRoomIdByUnreadCount =
|
||||
(getUnreadCount: (roomId: string) => number): SortFunc<string> =>
|
||||
(a, b) => {
|
||||
const aT = getUnreadCount(a) ?? 0;
|
||||
const bT = getUnreadCount(b) ?? 0;
|
||||
return bT - aT;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue