Fix friends sorting (#158)

This commit is contained in:
orsonclark 2023-07-23 21:01:42 +01:00 committed by GitHub
parent 616c6668d9
commit 1f5ae7bd19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,14 +16,7 @@ const useFriendsState = () =>
{
const onlineFriends = friends.filter(friend => friend.online);
onlineFriends.sort((a, b) =>
{
if( a.name < b.name ) return -1;
if( a.name > b.name ) return 1;
return 0;
});
onlineFriends.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
return onlineFriends;
}, [ friends ]);
@ -32,14 +25,7 @@ const useFriendsState = () =>
{
const offlineFriends = friends.filter(friend => !friend.online);
offlineFriends.sort((a, b) =>
{
if( a.name < b.name ) return -1;
if( a.name > b.name ) return 1;
return 0;
});
offlineFriends.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
return offlineFriends;
}, [ friends ]);