File tree Expand file tree Collapse file tree
hooks/useAnalysisController Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,20 +83,6 @@ export const Feedback: React.FC<Props> = ({
8383 Try Again
8484 </ button >
8585 ) }
86- { status !== 'correct' && status !== 'incorrect' && (
87- < button
88- onClick = { ( ) => {
89- controller . reset ( )
90- if ( status !== 'success' && status !== 'forfeit' ) {
91- setStatus ( 'default' )
92- }
93- } }
94- disabled = { status == 'loading' || status == 'default' }
95- className = "flex w-full justify-center rounded-sm bg-engine-3 py-1.5 text-sm font-medium text-primary transition duration-300 hover:bg-engine-4 disabled:bg-backdrop disabled:text-secondary"
96- >
97- Reset
98- </ button >
99- ) }
10086 { status !== 'forfeit' && status !== 'correct' && (
10187 < button
10288 onClick = { setAndGiveUp }
Original file line number Diff line number Diff line change @@ -14,8 +14,11 @@ import { useEngineAnalysis } from './useEngineAnalysis'
1414import { useMoveRecommendations } from './useMoveRecommendations'
1515import { useBoardDescription } from './useBoardDescription'
1616
17- export const useAnalysisController = ( game : AnalyzedGame ) => {
18- const controller = useTreeController ( game . tree )
17+ export const useAnalysisController = (
18+ game : AnalyzedGame ,
19+ initialOrientation ?: 'white' | 'black' ,
20+ ) => {
21+ const controller = useTreeController ( game . tree , initialOrientation )
1922
2023 const [ analysisState , setAnalysisState ] = useState ( 0 )
2124 const inProgressAnalyses = useMemo ( ( ) => new Set < string > ( ) , [ ] )
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ import { useRouter } from 'next/router'
4646import type { Key } from 'chessground/types'
4747import { Chess , PieceSymbol } from 'chess.ts'
4848import { AnimatePresence } from 'framer-motion'
49+ import { useAnalysisController } from 'src/hooks'
4950import type { DrawBrushes , DrawShape } from 'chessground/draw'
50- import { useAnalysisController , useLocalStorage } from 'src/hooks'
5151import { ConfigurableScreens } from 'src/components/Analysis/ConfigurableScreens'
5252
5353const MAIA_MODELS = [
Original file line number Diff line number Diff line change @@ -244,7 +244,10 @@ const Train: React.FC<Props> = ({
244244 return convertTrainingGameToAnalyzedGame ( trainingGame )
245245 } , [ trainingGame ] )
246246
247- const analysisController = useAnalysisController ( analyzedGame )
247+ const analysisController = useAnalysisController (
248+ analyzedGame ,
249+ controller . orientation ,
250+ )
248251
249252 const { width } = useContext ( WindowSizeContext )
250253 const isMobile = useMemo ( ( ) => width > 0 && width <= 670 , [ width ] )
You can’t perform that action at this time.
0 commit comments