diff --git a/backend/src/utils.ts b/backend/src/utils.ts index 1485dbf..db8f8a9 100644 --- a/backend/src/utils.ts +++ b/backend/src/utils.ts @@ -55,4 +55,4 @@ export function getCardImageName(card: UNOCard): string { } else { return `${getColorAbbreviation(card.color)}${card.value}`; } -} +} \ No newline at end of file diff --git a/frontend/src/library/Player.tsx b/frontend/src/library/Player.tsx new file mode 100644 index 0000000..f4d4146 --- /dev/null +++ b/frontend/src/library/Player.tsx @@ -0,0 +1,48 @@ +import React from 'react'; + +interface Player { + name: string; + cards: { length: number }; +} + +interface PlayerProps { + player: Player; + highlighted: boolean; + positionStyle: React.CSSProperties; +} + +const Player: React.FC = ({ + player, + highlighted, + positionStyle, +}) => { + return ( +
+
+ {player.cards.length} +
+
+ {player.name} +
+
+ ); +}; + +export default Player; diff --git a/frontend/src/pages/Game.tsx b/frontend/src/pages/Game.tsx index af8da91..70b8e3a 100644 --- a/frontend/src/pages/Game.tsx +++ b/frontend/src/pages/Game.tsx @@ -11,6 +11,7 @@ import { useNavigate } from 'react-router-dom'; import { triggerEvent } from '../channel'; import { useAuth } from '../contexts/AuthContext'; import { useToast } from '../library/toast/toast-context'; +import Player from '../library/Player'; function Game() { const { gameState } = useGameContext(); @@ -192,10 +193,6 @@ function Game() { { top: '75%', left: '85%', transform: 'translate(-50%, -50%)' }, ]; - const cardStyles = { - filter: 'brightness(1)', - }; - if (!gameState) { return (
@@ -203,6 +200,7 @@ function Game() {
); } + return (
@@ -212,26 +210,12 @@ function Game() {
{/* Players */} {gameState.players.slice(0, 6).map((player, index) => ( -
-
- {player.cards.length} -
-
+ player={player} + highlighted={index === gameState.currentPlayerIndex} + positionStyle={playerPositions[index]} + /> ))} {/* Center Deck and UNO Button */}