@@ -105,7 +105,8 @@ function Board({gameState, setGameState}) {
105
105
let dragging = useLayoutStore ( state => state . dragging )
106
106
let muted = useMuteStore ( state => state . muted )
107
107
let howler = useRef ( )
108
- let showMoveNumbers = ctrlKeyDown && ( isKibitz ( gameState , auth ) || gameHasEnded ( gameState ) )
108
+ let end = gameHasEnded ( gameState )
109
+ let showMoveNumbers = ctrlKeyDown && ( isKibitz ( gameState , auth ) || end )
109
110
let intervalIdRef = useRef ( )
110
111
111
112
let resetCountdown = useCallback ( ( ) => {
@@ -174,10 +175,7 @@ function Board({gameState, setGameState}) {
174
175
} , [ board . length ] )
175
176
176
177
let getCountingGroup = useCallback ( ( ) => {
177
- if ( gameHasEnded ( gameState ) ) {
178
- return undefined
179
- }
180
- if ( ! counting ) {
178
+ if ( end || ! counting ) {
181
179
return undefined
182
180
}
183
181
if ( ! isCursorInBounds ( ) ) {
@@ -190,7 +188,7 @@ function Board({gameState, setGameState}) {
190
188
return undefined
191
189
}
192
190
return has
193
- } , [ gameState , counting , board , isCursorInBounds ] )
191
+ } , [ counting , board , isCursorInBounds , end ] )
194
192
195
193
let context = useMemo ( ( ) => {
196
194
let dim = board . length
@@ -251,10 +249,10 @@ function Board({gameState, setGameState}) {
251
249
} , [ board , canvasRef , zoom ] )
252
250
253
251
useEffect ( ( ) => {
254
- if ( ! showMoveNumbers ) {
252
+ if ( ! showMoveNumbers && ! counting && ! end ) {
255
253
paintLastMove ( context , lastMove , timeout )
256
254
}
257
- } , [ showMoveNumbers , context , lastMove , timeout ] )
255
+ } , [ showMoveNumbers , context , lastMove , timeout , counting , end ] )
258
256
259
257
let onMouseMove = useCallback ( ( e ) => {
260
258
if ( dragging ) {
@@ -286,7 +284,7 @@ function Board({gameState, setGameState}) {
286
284
}
287
285
return
288
286
}
289
- if ( gameHasEnded ( gameState ) ) {
287
+ if ( end ) {
290
288
return
291
289
}
292
290
if ( ! board . length ) {
@@ -323,7 +321,7 @@ function Board({gameState, setGameState}) {
323
321
destination : "/app/game/move" ,
324
322
body : JSON . stringify ( move ) ,
325
323
} )
326
- } , [ gameState , setGameState , auth , board , stompClient , counting , forbidden_x , forbidden_y , myColor , playClickSound , isCursorInBounds , showMoveNumbers , resetCountdown ] )
324
+ } , [ gameState , setGameState , auth , board , stompClient , counting , forbidden_x , forbidden_y , myColor , playClickSound , isCursorInBounds , showMoveNumbers , resetCountdown , end ] )
327
325
328
326
useEffect ( ( ) => {
329
327
if ( ! board . length ) {
@@ -344,8 +342,10 @@ function Board({gameState, setGameState}) {
344
342
paintStones ( context , board , showMoveNumbers )
345
343
if ( showMoveNumbers ) {
346
344
paintMoveNumbers ( context , board )
347
- } else {
345
+ } else if ( ! counting && ! end ) {
348
346
paintLastMove ( context , lastMove , timeoutRef . current )
347
+ } else {
348
+ paintLastMove ( context , lastMove )
349
349
}
350
350
if ( currentPlayer ( gameState ) !== auth . name ) {
351
351
return
@@ -362,10 +362,10 @@ function Board({gameState, setGameState}) {
362
362
if ( cursor_x == forbidden_x && cursor_y == forbidden_y ) {
363
363
return
364
364
}
365
- if ( ! showMoveNumbers ) {
365
+ if ( ! showMoveNumbers && ! counting && ! end ) {
366
366
paintShadow ( context , cursor_x , cursor_y , currentColor ( gameState ) )
367
367
}
368
- } , [ gameState , context , cursor_x , cursor_y , ctrlKeyDown , canvasRef , auth , board , counting , forbidden_x , forbidden_y , lastMove , isCursorInBounds , getCountingGroup , showMoveNumbers ] )
368
+ } , [ gameState , context , cursor_x , cursor_y , ctrlKeyDown , canvasRef , auth , board , counting , forbidden_x , forbidden_y , lastMove , isCursorInBounds , getCountingGroup , showMoveNumbers , end ] )
369
369
370
370
useEffect ( ( ) => {
371
371
if ( id === gameId && queueStatus === "up_to_date" ) {
0 commit comments