Skip to content

Commit 71cf6d7

Browse files
Merge pull request #123 from Treevyy/frontend/fixes
Frontend/fixes
2 parents 3112f5b + eaae923 commit 71cf6d7

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

client/src/components/LeaderBoard.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import "../styles/leaderboard.css";
2-
import { useBodyClass } from '../utils/useBodyClass';
2+
// import { useBodyClass } from '../utils/useBodyClass';
33
import { useQuery } from "@apollo/client";
44
import { GET_USERS } from "@/graphql/queries";
55
import { useNavigate } from "react-router-dom";
6+
import { useEffect } from 'react';
7+
8+
69

710

811
function LeaderBoard() {
@@ -12,14 +15,20 @@ function LeaderBoard() {
1215

1316
const allUsers = data?.getAllUsers || [];
1417

15-
useBodyClass('background-image');
18+
useEffect(() => {
19+
document.body.classList.add('gameover-background');
20+
return () => {
21+
document.body.classList.remove('gameover-background');
22+
};
23+
}, []);
1624

1725
if (loading) return <p>Loading...</p>;
1826

1927
const sortedUsers = [...allUsers].sort((a, b) => b.correctAnswers - a.correctAnswers);
2028

2129
console.log(allUsers);
2230

31+
2332
return (
2433
<div className="leaderboard-page">
2534
<div className="leaderboard-container">

client/src/components/screens/GameMap.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ const GameMap: React.FC = () => {
7070
id: '4',
7171
xPercent: 70,
7272
yPercent: 45,
73+
7374
image: '../../../public/assets/minions/pie-thon.png',
7475
name: 'Pie-Thon',
7576
questionId: 'q4',

client/src/components/screens/GameOver.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ const GameOverPage = ({
88
}) => {
99
const navigate = useNavigate();
1010

11+
useEffect(() => {
12+
document.body.classList.add('gameover-background');
13+
14+
return () => {
15+
document.body.classList.remove('gameover-background');
16+
};
17+
}, []);
18+
1119
useEffect(() => {
1220
const music = new Audio('/game_over.mp3');
1321
const roar = new Audio('/godzilla.roar.mp3');

client/src/components/screens/Victory.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export default function VictoryPage({
99
}) {
1010
const navigate = useNavigate();
1111

12+
13+
1214
useEffect(() => {
1315
const victoryMusic = new Audio('/totalwin1.mp3');
1416
victoryMusic.volume = 0.5;
@@ -17,6 +19,12 @@ export default function VictoryPage({
1719
});
1820
}, []);
1921

22+
useEffect(() => {
23+
document.body.classList.add('gameover-background');
24+
return () => {
25+
document.body.classList.remove('gameover-background');
26+
};
27+
}, []);
2028
const handlePlayAgain = () => {
2129
navigate('/map');
2230
};

0 commit comments

Comments
 (0)