Skip to content

Commit 67c25e1

Browse files
chore: fix build + lint errors
1 parent 80a0564 commit 67c25e1

6 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/components/Board/BoardController.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { GameNode } from 'src/types'
21
import { useWindowSize } from 'src/hooks'
2+
import { GameNode, GameTree } from 'src/types'
33
import { FlipIcon } from 'src/components/Icons/icons'
44
import { useCallback, useEffect, useMemo } from 'react'
55

66
interface Props {
7-
// Controller data
87
orientation: 'white' | 'black'
98
setOrientation: (orientation: 'white' | 'black') => void
109
currentNode: GameNode
@@ -13,9 +12,7 @@ interface Props {
1312
goToNextNode: () => void
1413
goToPreviousNode: () => void
1514
goToRootNode: () => void
16-
gameTree?: any
17-
18-
// Optional event handler
15+
gameTree: GameTree
1916
setCurrentMove?: (move: [string, string] | null) => void
2017
}
2118

src/components/Turing/TuringGames.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ import { useContext } from 'react'
33
import { TuringControllerContext } from 'src/contexts'
44

55
export const TuringGames: React.FC = () => {
6-
const { gameIds, setCurrentId, games } = useContext(TuringControllerContext)
6+
const { gameIds, setCurrentGameId, games } = useContext(
7+
TuringControllerContext,
8+
)
79
return (
810
<div className="flex flex-row flex-wrap items-start justify-start gap-1 overflow-y-auto">
911
{gameIds.map((id) => {
1012
const game = games[id]
1113
return (
1214
<button
1315
key={id}
14-
onClick={() => setCurrentId(id)}
16+
onClick={() => setCurrentGameId(id)}
1517
className={`${!game.result ? 'bg-button-secondary' : game.result?.correct ? 'bg-engine-4' : 'bg-human-4'} h-10 w-10 cursor-pointer rounded-sm`}
1618
>
1719
{game.result?.ratingDiff ? (

src/contexts/PlayControllerContext/PlayControllerContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface IPlayControllerContext extends BaseTreeControllerContext {
2222
stats: ReturnType<typeof usePlayController>['stats']
2323
setResigned: ReturnType<typeof usePlayController>['setResigned']
2424
reset: ReturnType<typeof usePlayController>['reset']
25-
makePlayerMove: ReturnType<typeof usePlayController>['makeMove']
25+
makePlayerMove: ReturnType<typeof usePlayController>['makePlayerMove']
2626
updateClock: ReturnType<typeof usePlayController>['updateClock']
2727
setCurrentNode: ReturnType<typeof usePlayController>['setCurrentNode']
2828
addMove: ReturnType<typeof usePlayController>['addMove']
@@ -37,7 +37,7 @@ const defaultGameTree = new GameTree(new Chess().fen())
3737

3838
export const PlayControllerContext =
3939
React.createContext<IPlayControllerContext>({
40-
game: { id: '', moves: [], turn: 'black' },
40+
game: { id: '', moves: [], turn: 'black', tree: defaultGameTree },
4141
playType: 'againstMaia',
4242
timeControl: 'unlimited',
4343
player: 'white',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ const Analysis: React.FC<Props> = ({
496496
type="analysis"
497497
/>
498498
<BoardController
499+
gameTree={controller.gameTree}
499500
orientation={controller.orientation}
500501
setOrientation={controller.setOrientation}
501502
currentNode={controller.currentNode}
@@ -680,6 +681,7 @@ const Analysis: React.FC<Props> = ({
680681
<div className="flex w-full flex-col gap-0">
681682
<div className="w-full !flex-grow-0">
682683
<BoardController
684+
gameTree={controller.gameTree}
683685
orientation={controller.orientation}
684686
setOrientation={controller.setOrientation}
685687
currentNode={controller.currentNode}

src/pages/turing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Turing: React.FC<Props> = (props: Props) => {
126126
<StatsDisplay stats={stats} />
127127
</div>
128128
<div className="relative flex aspect-square w-full max-w-[75vh]">
129-
<GameBoard game={game} currentNode={controller.currentNode!} />
129+
<GameBoard game={game} currentNode={controller.currentNode} />
130130
</div>
131131
<div
132132
style={{

src/types/turing/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BaseGame } from '../base'
44
export interface TuringGame extends BaseGame {
55
termination: Termination
66
result?: TuringSubmissionResult
7-
tree?: GameTree
7+
tree: GameTree
88
}
99

1010
export interface TuringSubmissionResult {

0 commit comments

Comments
 (0)