File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 11import "../styles/leaderboard.css" ;
2+ import "../styles/codezilla.css"
3+ import { useBodyClass } from '../utils/useBodyClass' ;
24import { useQuery } from "@apollo/client" ;
35import { GET_USERS } from "@/graphql/queries" ;
46import { useNavigate } from "react-router-dom" ;
57
8+
69function LeaderBoard ( ) {
710 const navigate = useNavigate ( ) ;
811
912 const { loading, data } = useQuery ( GET_USERS ) ;
1013
1114 const allUsers = data ?. getAllUsers || [ ] ;
1215
16+ useBodyClass ( 'background-image' ) ;
17+
1318 if ( loading ) return < p > Loading...</ p > ;
1419
20+ const sortedUsers = [ ...allUsers ] . sort ( ( a , b ) => b . correctAnswers - a . correctAnswers ) ;
21+
1522 console . log ( allUsers ) ;
1623
1724 return (
1825 < div className = "leaderboard-page" >
1926 < div className = "leaderboard-container" >
2027 < h2 className = "leaderboard-subtitle" > Leaderboard</ h2 >
2128 < div className = "leaderboard-actions" >
22- { allUsers . map ( ( user : any , index : number ) => {
29+ { sortedUsers . map ( ( user : any , index : number ) => {
2330 if ( index < 5 ) {
2431 return (
2532 < div className = "player-info" >
Original file line number Diff line number Diff line change 2323 margin : 0 ; /* Remove default margin */
2424 text-align : center; /* Align text to the left */
2525 flex : 1 ; /* Allow the text to take up equal space */
26- color : rgb (168 , 97 , 4 );
27- /* rgb(17, 223, 110); */
28- /* rgb(161, 82, 252); */
26+ color : rgb (161 , 82 , 252 );
2927}
3028
3129.leaderboard-actions {
5654 text-align : center;
5755 width : 100% ;
5856
57+ }
58+
59+ /* BACKGROUND IMAGE */
60+ .background-image {
61+ background-image : url ('/backgrounds/game-bg.jpg' );
62+ position : absolute;
63+ inset : 0 ;
64+ width : 100% ;
65+ height : 100% ;
66+ object-fit : cover;
67+ object-position : center top;
68+ z-index : 0 ;
5969}
You can’t perform that action at this time.
0 commit comments