@@ -12,7 +12,11 @@ import Head from 'next/head'
1212import { useUnload } from 'src/hooks/useUnload'
1313import type { DrawShape } from 'chessground/draw'
1414import { useCallback , useContext , useMemo , useState } from 'react'
15- import { AuthContext , WindowSizeContext } from 'src/contexts'
15+ import {
16+ AuthContext ,
17+ WindowSizeContext ,
18+ TreeControllerContext ,
19+ } from 'src/contexts'
1620import { PlayControllerContext } from 'src/contexts/PlayControllerContext'
1721
1822interface Props {
@@ -36,6 +40,7 @@ export const GameplayInterface: React.FC<React.PropsWithChildren<Props>> = (
3640 orientation,
3741 timeControl,
3842 currentNode,
43+ setCurrentNode,
3944 maiaVersion,
4045 goToRootNode,
4146 goToNextNode,
@@ -156,30 +161,42 @@ export const GameplayInterface: React.FC<React.PropsWithChildren<Props>> = (
156161 style = { {
157162 maxWidth : 'min(20vw, 100vw - 75vh)' ,
158163 } }
159- className = "flex h-[75vh] w-[40vh] flex-col justify-between gap-1 "
164+ className = "flex h-[75vh] w-[40vh] flex-col"
160165 >
161- < GameInfo
162- icon = "swords"
163- type = { playType }
164- title = {
165- playType === 'againstMaia'
166- ? 'Play vs. Maia'
167- : 'Play Hand and Brain'
168- }
169- >
170- { Info }
171- </ GameInfo >
172- < div className = "flex w-full flex-col gap-2" >
173- < ExportGame
174- game = { game }
175- gameTree = { gameTree }
176- currentNode = { currentNode }
177- whitePlayer = { whitePlayer ?? 'Unknown' }
178- blackPlayer = { blackPlayer ?? 'Unknown' }
179- event = { `Play vs. ${ maiaTitle } ` }
180- type = "play"
181- />
182- < StatsDisplay stats = { stats } hideSession = { true } isGame = { true } />
166+ < div className = "flex h-full w-full flex-col overflow-hidden rounded-md border border-glassBorder bg-glass backdrop-blur-md" >
167+ < GameInfo
168+ icon = "swords"
169+ type = { playType }
170+ title = {
171+ playType === 'againstMaia'
172+ ? 'Play vs. Maia'
173+ : 'Play Hand and Brain'
174+ }
175+ embedded
176+ >
177+ { Info }
178+ </ GameInfo >
179+ < div className = "mt-auto flex flex-col" >
180+ < div className = "px-3 pb-4" >
181+ < ExportGame
182+ game = { game }
183+ gameTree = { gameTree }
184+ currentNode = { currentNode }
185+ whitePlayer = { whitePlayer ?? 'Unknown' }
186+ blackPlayer = { blackPlayer ?? 'Unknown' }
187+ event = { `Play vs. ${ maiaTitle } ` }
188+ type = "play"
189+ />
190+ </ div >
191+ < div className = "h-3 border-y border-glassBorder" />
192+ < StatsDisplay
193+ stats = { stats }
194+ hideSession = { true }
195+ isGame = { true }
196+ embedded
197+ hideEmbeddedBorder
198+ />
199+ </ div >
183200 </ div >
184201 </ div >
185202 < div
@@ -206,30 +223,38 @@ export const GameplayInterface: React.FC<React.PropsWithChildren<Props>> = (
206223 style = { {
207224 maxWidth : 'min(20vw, 100vw - 75vh)' ,
208225 } }
209- className = "flex h-[75vh] w-[40vh] flex-col justify-center gap-1 "
226+ className = "flex h-[75vh] w-[40vh] flex-col justify-center gap-2 "
210227 >
211228 { timeControl != 'unlimited' ? (
212229 < GameClock
213230 player = { orientation == 'white' ? 'black' : 'white' }
214231 reversed = { false }
215232 />
216233 ) : null }
217- < div className = "relative bottom-0 h-full min-h-[38px] flex-1" >
218- < MovesContainer game = { game } termination = { game . termination } />
219- </ div >
220- < div > { props . children } </ div >
221- < div className = "flex-none" >
222- < BoardController
223- orientation = { orientation }
224- setOrientation = { setOrientation }
225- currentNode = { currentNode }
226- plyCount = { plyCount }
227- goToNode = { goToNode }
228- goToNextNode = { goToNextNode }
229- goToPreviousNode = { goToPreviousNode }
230- goToRootNode = { goToRootNode }
231- gameTree = { gameTree }
232- />
234+ < div className = "flex h-full flex-col overflow-hidden rounded-lg border border-glassBorder bg-glass backdrop-blur-md" >
235+ < div className = "flex-1 overflow-hidden border-b border-glassBorder" >
236+ < MovesContainer
237+ game = { game }
238+ termination = { game . termination }
239+ embedded
240+ heightClass = "h-full"
241+ />
242+ </ div >
243+ < div className = "border-b border-glassBorder" >
244+ < BoardController
245+ orientation = { orientation }
246+ setOrientation = { setOrientation }
247+ currentNode = { currentNode }
248+ plyCount = { plyCount }
249+ goToNode = { goToNode }
250+ goToNextNode = { goToNextNode }
251+ goToPreviousNode = { goToPreviousNode }
252+ goToRootNode = { goToRootNode }
253+ gameTree = { gameTree }
254+ embedded
255+ />
256+ </ div >
257+ < div className = "px-4 py-3" > { props . children } </ div >
233258 </ div >
234259 { timeControl != 'unlimited' ? (
235260 < GameClock player = { orientation } reversed = { true } />
@@ -276,25 +301,32 @@ export const GameplayInterface: React.FC<React.PropsWithChildren<Props>> = (
276301 { timeControl != 'unlimited' ? (
277302 < GameClock player = { orientation } reversed = { true } />
278303 ) : null }
279- < div className = "flex-none" >
280- < BoardController
281- orientation = { orientation }
282- setOrientation = { setOrientation }
283- currentNode = { currentNode }
284- plyCount = { plyCount }
285- goToNode = { goToNode }
286- goToNextNode = { goToNextNode }
287- goToPreviousNode = { goToPreviousNode }
288- goToRootNode = { goToRootNode }
289- gameTree = { gameTree }
290- />
291- </ div >
292- < div className = "w-full overflow-x-auto" >
293- < div className = "flex flex-row whitespace-nowrap py-2" >
294- < MovesContainer game = { game } termination = { game . termination } />
304+ < div className = "w-full" >
305+ < div className = "flex flex-col overflow-hidden rounded-lg border border-glassBorder bg-glass backdrop-blur-md" >
306+ < div className = "border-b border-glassBorder" >
307+ < MovesContainer
308+ game = { game }
309+ termination = { game . termination }
310+ embedded
311+ />
312+ </ div >
313+ < div className = "border-b border-glassBorder" >
314+ < BoardController
315+ orientation = { orientation }
316+ setOrientation = { setOrientation }
317+ currentNode = { currentNode }
318+ plyCount = { plyCount }
319+ goToNode = { goToNode }
320+ goToNextNode = { goToNextNode }
321+ goToPreviousNode = { goToPreviousNode }
322+ goToRootNode = { goToRootNode }
323+ gameTree = { gameTree }
324+ embedded
325+ />
326+ </ div >
327+ < div className = "px-4 py-3" > { props . children } </ div >
295328 </ div >
296329 </ div >
297- < div className = "w-screen" > { props . children } </ div >
298330 < StatsDisplay stats = { stats } hideSession = { true } isGame = { true } />
299331 < div className = "px-2" >
300332 < ExportGame
@@ -321,7 +353,22 @@ export const GameplayInterface: React.FC<React.PropsWithChildren<Props>> = (
321353 < title > Maia Chess - Play</ title >
322354 < meta name = "description" content = "Turing survey" />
323355 </ Head >
324- { layouts }
356+ < TreeControllerContext . Provider
357+ value = { {
358+ gameTree,
359+ currentNode,
360+ setCurrentNode,
361+ orientation,
362+ setOrientation,
363+ goToNode,
364+ goToNextNode,
365+ goToPreviousNode,
366+ goToRootNode,
367+ plyCount,
368+ } }
369+ >
370+ { layouts }
371+ </ TreeControllerContext . Provider >
325372 </ >
326373 )
327374}
0 commit comments