Skip to content

Commit 93cac5e

Browse files
chore: clean up components+names
1 parent fe6175a commit 93cac5e

5 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/api/analysis.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export const fetchPgnOfLichessGame = async (id: string): Promise<string> => {
7272
return res.text()
7373
}
7474

75-
export const fetchAnalyzedTournamentGame = async (gameId = ['FkgYSri1']) => {
75+
export const fetchAnalyzedWorldChampionshipGame = async (
76+
gameId = ['FkgYSri1'],
77+
) => {
7678
const res = await fetch(
7779
buildUrl(`analysis/analysis_list/${gameId.join('/')}`),
7880
)

src/components/Analysis/AnalysisGameList.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import {
1616
getFavoritesAsWebGames,
1717
addFavoriteGame,
1818
removeFavoriteGame,
19-
updateFavoriteName,
20-
isFavoriteGame,
2119
} from 'src/lib/favorites'
2220
import { MaiaGameListEntry } from 'src/types'
2321
import { useRouter } from 'next/router'

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
fetchPgnOfLichessGame,
1212
fetchAnalyzedMaiaGame,
1313
fetchAnalyzedPgnGame,
14-
fetchAnalyzedTournamentGame,
14+
fetchAnalyzedWorldChampionshipGame,
1515
retrieveGameAnalysisCache,
1616
} from 'src/api'
1717
import {
@@ -100,7 +100,7 @@ const AnalysisPage: NextPage = () => {
100100
) => {
101101
let game
102102
try {
103-
game = await fetchAnalyzedTournamentGame(newId)
103+
game = await fetchAnalyzedWorldChampionshipGame(newId)
104104
} catch (e) {
105105
router.push('/401')
106106
return

src/types/analysis.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Player } from './player'
2+
import { BaseGame } from './common'
23
import { AvailableMoves } from './puzzle'
3-
import { Dispatch, SetStateAction } from 'react'
4-
import { BaseGame, GameNode, GameTree } from './common'
54

65
export interface MoveValueMapping {
76
[move: string]: number
@@ -16,19 +15,6 @@ export interface AnalyzedGame extends BaseGame {
1615
termination?: Termination
1716
}
1817

19-
export interface BaseTreeControllerContext {
20-
gameTree: GameTree
21-
currentNode: GameNode
22-
setCurrentNode: Dispatch<SetStateAction<GameNode>>
23-
goToNode: (node: GameNode) => void
24-
goToNextNode: () => void
25-
goToPreviousNode: () => void
26-
goToRootNode: () => void
27-
plyCount: number
28-
orientation: 'white' | 'black'
29-
setOrientation: (orientation: 'white' | 'black') => void
30-
}
31-
3218
export interface MaiaEvaluation {
3319
value: number
3420
policy: { [key: string]: number }

src/types/common.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { GameTree } from './tree'
1+
import { GameNode, GameTree } from './tree'
2+
import { Dispatch, SetStateAction } from 'react'
23

34
export * from './tree'
45

@@ -19,3 +20,16 @@ export interface RawMove {
1920
export type Check = false | 'white' | 'black'
2021

2122
export type Color = 'white' | 'black'
23+
24+
export interface BaseTreeControllerContext {
25+
gameTree: GameTree
26+
currentNode: GameNode
27+
setCurrentNode: Dispatch<SetStateAction<GameNode>>
28+
goToNode: (node: GameNode) => void
29+
goToNextNode: () => void
30+
goToPreviousNode: () => void
31+
goToRootNode: () => void
32+
plyCount: number
33+
orientation: 'white' | 'black'
34+
setOrientation: (orientation: 'white' | 'black') => void
35+
}

0 commit comments

Comments
 (0)