From df682327d6cfb19be062511a245ead47faed4c99 Mon Sep 17 00:00:00 2001 From: danis Date: Thu, 30 Nov 2023 13:34:20 +0100 Subject: [PATCH] feat(leaderboard): i might be dumb --- front/components/UI/ScaffoldCC.tsx | 2 +- front/views/HomeView.tsx | 2 +- front/views/LeaderboardView.tsx | 218 +++++++++++++++-------------- 3 files changed, 114 insertions(+), 108 deletions(-) diff --git a/front/components/UI/ScaffoldCC.tsx b/front/components/UI/ScaffoldCC.tsx index c761200..c6070a0 100644 --- a/front/components/UI/ScaffoldCC.tsx +++ b/front/components/UI/ScaffoldCC.tsx @@ -13,7 +13,7 @@ const menu = [ { type: 'main', title: 'menuProfile', icon: User, link: 'User' }, { type: 'main', title: 'menuMusic', icon: Music, link: 'Music' }, { type: 'main', title: 'menuSearch', icon: SearchNormal1, link: 'Search' }, - { type: 'main', title: 'menuLeaderBoard', icon: Cup, link: 'Score' }, + { type: 'main', title: 'menuLeaderBoard', icon: Cup, link: 'Leaderboard' }, { type: 'sub', title: 'menuSettings', icon: Setting2, link: 'Settings' }, ] as const; diff --git a/front/views/HomeView.tsx b/front/views/HomeView.tsx index 1023bd1..b057acd 100644 --- a/front/views/HomeView.tsx +++ b/front/views/HomeView.tsx @@ -122,7 +122,7 @@ const HomeView = (props: RouteProps<{}>) => { translate={{ translationKey: 'leaderboardTitle' }} colorScheme="primary" size="sm" - onPress={() => navigation.navigate('Leaderboard')} + onPress={() => navigation.navigate('Leaderboard', {})} /> { +const Leaderboardiew = (props: RouteProps<{}>) => { const navigation = useNavigation(); const scoresQuery = useQuery(API.getTopTwentyPlayers()); const screenSize = useBreakpointValue({ base: 'small', md: 'big' }); @@ -186,107 +186,43 @@ const Leaderboardiew = () => { return <>; } if (scoresQuery.data === undefined) { - return ; + return ( + + + + ); } return ( - - - {!isPhone ? ( - - - - - - ) : ( - - - + + + {!isPhone ? ( + - { userPseudo={scoresQuery.data?.at(2)?.name ?? '---'} userLvl={scoresQuery.data?.at(2)?.data.totalScore ?? 42} /> + + - - )} - {scoresQuery.data.slice(3).map((comp: any, index: number) => ( - - ))} - - + ) : ( + + + + + + + + )} + {scoresQuery.data.slice(3).map((comp: any, index: number) => ( + + ))} + + + ); };