From 1f5ae7bd197c6da2d37b9c8570050064cb4e7bfd Mon Sep 17 00:00:00 2001 From: orsonclark <140166629+orsonclark@users.noreply.github.com> Date: Sun, 23 Jul 2023 21:01:42 +0100 Subject: [PATCH] Fix friends sorting (#158) --- src/hooks/friends/useFriends.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/hooks/friends/useFriends.ts b/src/hooks/friends/useFriends.ts index 05437b2a..68666500 100644 --- a/src/hooks/friends/useFriends.ts +++ b/src/hooks/friends/useFriends.ts @@ -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 ]);