mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Fix friends sorting (#158)
This commit is contained in:
parent
616c6668d9
commit
1f5ae7bd19
@ -16,14 +16,7 @@ const useFriendsState = () =>
|
|||||||
{
|
{
|
||||||
const onlineFriends = friends.filter(friend => friend.online);
|
const onlineFriends = friends.filter(friend => friend.online);
|
||||||
|
|
||||||
onlineFriends.sort((a, b) =>
|
onlineFriends.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||||
{
|
|
||||||
if( a.name < b.name ) return -1;
|
|
||||||
|
|
||||||
if( a.name > b.name ) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
return onlineFriends;
|
return onlineFriends;
|
||||||
}, [ friends ]);
|
}, [ friends ]);
|
||||||
@ -32,14 +25,7 @@ const useFriendsState = () =>
|
|||||||
{
|
{
|
||||||
const offlineFriends = friends.filter(friend => !friend.online);
|
const offlineFriends = friends.filter(friend => !friend.online);
|
||||||
|
|
||||||
offlineFriends.sort((a, b) =>
|
offlineFriends.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
||||||
{
|
|
||||||
if( a.name < b.name ) return -1;
|
|
||||||
|
|
||||||
if( a.name > b.name ) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
return offlineFriends;
|
return offlineFriends;
|
||||||
}, [ friends ]);
|
}, [ friends ]);
|
||||||
|
Loading…
Reference in New Issue
Block a user