@@ -105,9 +105,9 @@ const StreamAnalysisPage: NextPage = () => {
105105 }
106106 } , [ streamController . game , analysisController ] )
107107
108+ // When we finish streaming and load the game, we want to set the current node to the last move
108109 useEffect ( ( ) => {
109110 if ( streamController . game ?. loaded ) {
110- console . log ( 'GAME LOADED' )
111111 analysisController . setCurrentNode (
112112 streamController . game . tree . getMainLine ( ) [
113113 streamController . game . tree . getMainLine ( ) . length - 1
@@ -116,48 +116,48 @@ const StreamAnalysisPage: NextPage = () => {
116116 }
117117 } , [ streamController . game ?. loaded ] )
118118
119- if (
120- streamController . streamState . isConnecting &&
121- ! streamController . streamState . gameStarted
122- ) {
123- return (
124- < >
125- < Head >
126- < title > Connecting to Live Game – Maia Chess</ title >
127- < meta
128- name = "description"
129- content = "Connecting to live chess game stream for real-time analysis with Maia AI."
130- />
131- </ Head >
132- < DelayedLoading isLoading = { true } >
133- < div className = "flex flex-col items-center justify-center gap-4" >
134- < div className = "text-center" >
135- < h2 className = "mb-2 text-xl font-semibold" >
136- { streamController . streamState . error
137- ? 'Connection Error'
138- : 'Connecting to Live Game' }
139- </ h2 >
140- { streamController . streamState . error ? (
141- < div className = "mb-4 text-red-400" >
142- < p > { streamController . streamState . error } </ p >
143- < button
144- onClick = { streamController . reconnect }
145- className = "mt-2 rounded bg-human-4 px-4 py-2 text-white transition hover:bg-human-4/80"
146- >
147- Try Again
148- </ button >
149- </ div >
150- ) : (
151- < p className = "text-secondary" >
152- Establishing connection to Lichess game { gameId } ...
153- </ p >
154- ) }
155- </ div >
156- </ div >
157- </ DelayedLoading >
158- </ >
159- )
160- }
119+ // if (
120+ // streamController.streamState.isConnecting &&
121+ // !streamController.streamState.gameStarted
122+ // ) {
123+ // return (
124+ // <>
125+ // <Head>
126+ // <title>Connecting to Live Game – Maia Chess</title>
127+ // <meta
128+ // name="description"
129+ // content="Connecting to live chess game stream for real-time analysis with Maia AI."
130+ // />
131+ // </Head>
132+ // <DelayedLoading isLoading={true}>
133+ // <div className="flex flex-col items-center justify-center gap-4">
134+ // <div className="text-center">
135+ // <h2 className="mb-2 text-xl font-semibold">
136+ // {streamController.streamState.error
137+ // ? 'Connection Error'
138+ // : 'Connecting to Live Game' }
139+ // </h2>
140+ // {streamController.streamState.error ? (
141+ // <div className="mb-4 text-red-400">
142+ // <p>{streamController.streamState.error}</p>
143+ // <button
144+ // onClick={streamController.reconnect}
145+ // className="mt-2 rounded bg-human-4 px-4 py-2 text-white transition hover:bg-human-4/80"
146+ // >
147+ // Try Again
148+ // </button>
149+ // </div>
150+ // ) : (
151+ // <p className="text-secondary">
152+ // Establishing connection to Lichess game {gameId}...
153+ // </p>
154+ // )}
155+ // </div>
156+ // </div>
157+ // </DelayedLoading>
158+ // </>
159+ // )
160+ // }
161161
162162 return (
163163 < >
@@ -184,13 +184,15 @@ const StreamAnalysisPage: NextPage = () => {
184184 </ AnimatePresence >
185185
186186 < TreeControllerContext . Provider value = { analysisController } >
187- { ! streamController . game ?. loaded && streamController . game && (
187+ { ! streamController . game ?. loaded &&
188+ streamController . game &&
189+ ! streamController . streamState . gameEnded ? (
188190 < div className = "absolute left-0 top-0 z-50" >
189191 < DelayedLoading transparent isLoading = { true } >
190192 < p > Loading...</ p >
191193 </ DelayedLoading >
192194 </ div >
193- ) }
195+ ) : null }
194196 { analysisController && (
195197 < StreamAnalysis
196198 game = { streamController . game || dummyGame }
0 commit comments