Skip to content

Commit 4dc25b9

Browse files
authored
Merge pull request #104 from Treevyy/feature/FixingErrors
updated leaderboard and fixed other errors
2 parents 337a67e + f830ca9 commit 4dc25b9

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

client/src/components/LeaderBoard.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
import "../styles/leaderboard.css";
2+
import "../styles/codezilla.css"
3+
import { useBodyClass } from '../utils/useBodyClass';
24
import { useQuery } from "@apollo/client";
35
import { GET_USERS } from "@/graphql/queries";
46
import { useNavigate } from "react-router-dom";
57

8+
69
function 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">

client/src/styles/leaderboard.css

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
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 {
@@ -56,4 +54,16 @@
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
}

0 commit comments

Comments
 (0)