From 2e820d6c54edc46ea8f7cf585a06636ae39e7b74 Mon Sep 17 00:00:00 2001 From: Lucia_F Date: Thu, 24 Oct 2024 12:11:50 +0100 Subject: [PATCH] Removed medals from guess table, set horizontal scroll to hidden --- frontend/src/components/Table.jsx | 29 +++++++++++++---------- frontend/src/components/TableCarousel.jsx | 8 +++---- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/Table.jsx b/frontend/src/components/Table.jsx index dd911aa..278f635 100644 --- a/frontend/src/components/Table.jsx +++ b/frontend/src/components/Table.jsx @@ -1,16 +1,15 @@ import { Gold, Silver, Bronze } from "../assets/Medals"; -export function Table({ players, sortBy }) { - +export function Table({ players, sortBy, showMedals }) { const position = (number) => { if (number === 0) { return ; } else if (number === 1) { - return + return ; } else if (number === 2) { - return + return ; } - return number + 1 + return number + 1; }; return ( @@ -18,14 +17,16 @@ export function Table({ players, sortBy }) { - + {showMedals && ( + + )} @@ -35,7 +36,7 @@ export function Table({ players, sortBy }) { key={index} className="bg-white border-b dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600" > - + {showMedals && } - - + + ))} diff --git a/frontend/src/components/TableCarousel.jsx b/frontend/src/components/TableCarousel.jsx index 0c1ce81..3b1f2fd 100644 --- a/frontend/src/components/TableCarousel.jsx +++ b/frontend/src/components/TableCarousel.jsx @@ -28,7 +28,7 @@ const carouselTheme = { icon: "h-5 w-5 text-gray-600 sm:h-3 sm:w-3", }, scrollContainer: { - base: "flex snap-mandatory overflow-y-hidden overflow-x-scroll scroll-smooth rounded-lg", + base: "flex snap-mandatory overflow-y-hidden overflow-x-hidden scroll-smooth rounded-lg", snap: "snap-x", }, }; @@ -41,14 +41,14 @@ export function TableCarousel({ players, weight }) { const playersByGuess = players && [...players].sort((a, b) => Math.abs(weight - a.currentGuess) - Math.abs(weight - b.currentGuess)) return ( -
+
Last Game - {players &&
- Pos. - + Pos. + Name - {sortBy === "totalScore" ? "Score" : "Guess"} + {sortBy === "totalScore" ? "Score" : "Guess"}
{position(index)}{position(index)}
{" "} @@ -49,8 +50,12 @@ export function Table({ players, sortBy }) { {player.name}
{sortBy === "totalScore" ? player.totalScore : player.currentGuess} + {sortBy === "totalScore" + ? player.totalScore + : player.currentGuess} +
} + {players &&
}
Leaderboard - {players &&
} + {players &&
} );