This commit is contained in:
parent
40aa200cbb
commit
c9dfebb6a7
2 changed files with 15 additions and 5 deletions
|
@ -6,6 +6,7 @@
|
|||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"preview": "vite preview",
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check ."
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -113,7 +113,7 @@ const Board: FC<Props> = (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> = (props) => {
|
|||
<Files />
|
||||
</div>
|
||||
|
||||
{gameResult && <div>
|
||||
{gameResult === 'checkmate' && <h1>Checkmate! Winner: {otherSide(sideToMove)}!</h1>}
|
||||
{gameResult === 'stalemate' && <h1>Stalemate! There are no legal moves {sideToMove} can make :/</h1>}
|
||||
</div>}
|
||||
{gameResult && (
|
||||
<div>
|
||||
{gameResult === 'checkmate' && (
|
||||
<h1>Checkmate! Winner: {otherSide(sideToMove)}!</h1>
|
||||
)}
|
||||
{gameResult === 'stalemate' && (
|
||||
<h1>
|
||||
Stalemate! There are no legal moves {sideToMove} can
|
||||
make :/
|
||||
</h1>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{promotionMove && (
|
||||
<div>
|
||||
|
|
Loading…
Reference in a new issue