diff --git a/package.json b/package.json index bebfe9d..53f9574 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", + "format": "prettier --write .", "format:check": "prettier --check ." }, "dependencies": { diff --git a/src/components/Board.tsx b/src/components/Board.tsx index 7a9fc1c..e5539ec 100644 --- a/src/components/Board.tsx +++ b/src/components/Board.tsx @@ -113,7 +113,7 @@ const Board: FC = (props) => { const gameResult = useMemo(() => { if (validMoves.length === 0) { - const checked = isChecked(currentState) + const checked = isChecked(currentState); return checked[sideToMove] ? 'checkmate' : 'stalemate'; } return false; @@ -188,10 +188,19 @@ const Board: FC = (props) => { - {gameResult &&
- {gameResult === 'checkmate' &&

Checkmate! Winner: {otherSide(sideToMove)}!

} - {gameResult === 'stalemate' &&

Stalemate! There are no legal moves {sideToMove} can make :/

} -
} + {gameResult && ( +
+ {gameResult === 'checkmate' && ( +

Checkmate! Winner: {otherSide(sideToMove)}!

+ )} + {gameResult === 'stalemate' && ( +

+ Stalemate! There are no legal moves {sideToMove} can + make :/ +

+ )} +
+ )} {promotionMove && (