Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/views/Leaderboard/Leaderboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ td.step div:first-of-type {
}
#gold {
height: 250px;
margin: 20px auto;
}
#silver {
height: 200px;
Expand Down Expand Up @@ -119,3 +120,12 @@ button.resetButton {
width: min-content;
}
}
@media only screen and (min-device-width: 280px) and (max-device-width: 480px) {
td.step div:first-of-type {
margin: 20px 0px;
width: 75px;
}
#scorePageTitle {
font-size: 2rem;
}
}
17 changes: 7 additions & 10 deletions src/views/Leaderboard/Leaderboard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import './Leaderboard.css';

import Button from '../../components/Button/Button';
import '../../components/Button/Button.css';

Expand Down Expand Up @@ -56,15 +55,13 @@ function getScoreFromLocalStorage() {
const highScores = JSON.parse(localStorage.getItem('quizScores')) || [];
highScores.sort((a, b) => b.SCORE - a.SCORE);
function showScore() {
nick1.innerText = `${highScores[0].NAME} Pts:${highScores[0].SCORE}`;
nick2.innerText = `${highScores[1].NAME} Pts:${highScores[1].SCORE}`;
nick3.innerText = `${highScores[2].NAME} Pts:${highScores[2].SCORE}`;
nick4.innerText = `${highScores[3].NAME} Pts:${highScores[3].SCORE}`;
nick5.innerText = `${highScores[4].NAME} Pts:${highScores[4].SCORE}`;
nick6.innerText = `${highScores[5].NAME} Pts:${highScores[5].SCORE}`;
nick7.innerText = `${highScores[6].NAME} Pts:${highScores[6].SCORE}`;
nick8.innerText = `${highScores[7].NAME} Pts:${highScores[7].SCORE}`;
nick9.innerText = `${highScores[8].NAME} Pts:${highScores[8].SCORE}`;
for (let i = 1; i <= highScores.length; i++) {
if (i > 9) {
break;
}
const nick = `nick${i}`;
document.getElementById(nick).innerText = `${highScores[i - 1].NAME} Pts:${highScores[i - 1].SCORE}`;
}
}
return showScore();
}
Expand Down
1 change: 1 addition & 0 deletions src/views/ScorePage/ScorePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ function nicknameValidation() {
}

function saveQuizScore() {
alert('YOUR SCORE HAS BEEN SAVED');
const quizScores = JSON.parse(localStorage.getItem('quizScores')) || [];
const recentUserScore = getCurrentScore(userAnswers);
const nickName = document.getElementById('nickname');
Expand Down