Skip to content

Commit f33a7d8

Browse files
fix: build errors
1 parent 5478882 commit f33a7d8

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/components/Home/LiveChessBoard.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AnimatePresence, motion } from 'framer-motion'
44
import { Chess } from 'chess.ts'
55
import Chessground from '@react-chess/chessground'
66
import { getLichessTVGame, streamLichessGame } from 'src/api/lichess/streaming'
7+
import { StreamedGame, StreamedMove } from 'src/types/stream'
78

89
interface LiveGameData {
910
gameId: string
@@ -35,21 +36,21 @@ export const LiveChessBoard: React.FC = () => {
3536
const [error, setError] = useState<string | null>(null)
3637
const abortController = useRef<AbortController | null>(null)
3738

38-
const handleGameStart = useCallback((gameData: any) => {
39+
const handleGameStart = useCallback((gameData: StreamedGame) => {
3940
console.log('Live board - Game started:', gameData)
4041
if (gameData.fen) {
4142
setCurrentFen(gameData.fen)
4243
}
4344
setLiveGame({
44-
gameId: gameData.id || gameData.gameId,
45-
white: gameData.players?.white || gameData.white,
46-
black: gameData.players?.black || gameData.black,
45+
gameId: gameData.id,
46+
white: gameData.players?.white,
47+
black: gameData.players?.black,
4748
currentFen: gameData.fen,
4849
isLive: true,
4950
})
5051
}, [])
5152

52-
const handleMove = useCallback((moveData: any) => {
53+
const handleMove = useCallback((moveData: StreamedMove) => {
5354
console.log('Live board - New move:', moveData)
5455
if (moveData.fen) {
5556
setCurrentFen(moveData.fen)

src/pages/analysis/[...id].tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -659,10 +659,10 @@ const Analysis: React.FC<Props> = ({
659659
{player.rating ? <>({player.rating})</> : null}
660660
</span>
661661
</div>
662-
{analyzedGame.termination.winner ===
662+
{analyzedGame.termination?.winner ===
663663
(index == 0 ? 'white' : 'black') ? (
664664
<p className="text-xs text-engine-3">1</p>
665-
) : analyzedGame.termination.winner !== 'none' ? (
665+
) : analyzedGame.termination?.winner !== 'none' ? (
666666
<p className="text-xs text-human-3">0</p>
667667
) : analyzedGame.termination === undefined ? (
668668
<></>
@@ -684,16 +684,16 @@ const Analysis: React.FC<Props> = ({
684684
)}
685685
</div>
686686
<div className="flex items-center gap-1">
687-
{analyzedGame.termination.winner === 'none' ? (
687+
{analyzedGame.termination?.winner === 'none' ? (
688688
<span className="font-medium text-primary/80">½-½</span>
689689
) : (
690690
<span className="font-medium">
691691
<span className="text-primary/70">
692-
{analyzedGame.termination.winner === 'white' ? '1' : '0'}
692+
{analyzedGame.termination?.winner === 'white' ? '1' : '0'}
693693
</span>
694694
<span className="text-primary/70">-</span>
695695
<span className="text-primary/70">
696-
{analyzedGame.termination.winner === 'black' ? '1' : '0'}
696+
{analyzedGame.termination?.winner === 'black' ? '1' : '0'}
697697
</span>
698698
</span>
699699
)}
@@ -837,7 +837,7 @@ const Analysis: React.FC<Props> = ({
837837
: analyzedGame.whitePlayer.rating
838838
}
839839
color={controller.orientation === 'white' ? 'black' : 'white'}
840-
termination={analyzedGame.termination.winner}
840+
termination={analyzedGame.termination?.winner}
841841
/>
842842
<div className="desktop-board-container relative flex aspect-square">
843843
<GameBoard
@@ -907,7 +907,7 @@ const Analysis: React.FC<Props> = ({
907907
: analyzedGame.blackPlayer.rating
908908
}
909909
color={controller.orientation === 'white' ? 'white' : 'black'}
910-
termination={analyzedGame.termination.winner}
910+
termination={analyzedGame.termination?.winner}
911911
showArrowLegend={true}
912912
/>
913913
</div>

0 commit comments

Comments
 (0)