frontendove optimalizacie

This commit is contained in:
tim
2026-07-03 01:11:26 +02:00
parent 7a5202195b
commit 3615fa2bb1
7 changed files with 53 additions and 60 deletions
+2 -4
View File
@@ -1,4 +1,5 @@
import { emit } from '../lib/socket';
import { forbiddenGuess } from '../lib/gameRules';
interface Props {
cardsInRound: number;
@@ -9,11 +10,8 @@ interface Props {
}
export default function GuessControls({ cardsInRound, guesses, myOrder, activePlayer, activePlayerName }: Props) {
const guessCount = Object.keys(guesses).length;
const isMyTurn = activePlayer === myOrder;
const isLastToGuess = guessCount === 3;
const alreadySum = Object.values(guesses).reduce((a, b) => a + b, 0);
const forbidden = isLastToGuess ? cardsInRound - alreadySum : -1;
const forbidden = forbiddenGuess(cardsInRound, guesses);
if (!isMyTurn) {
return (