Skip to content

Commit 7b73991

Browse files
feat: add analyze game option post-game
1 parent 1de4c32 commit 7b73991

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

src/components/Play/PlayControls.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import { BaseGame } from 'src/types'
2+
13
interface Props {
4+
game: BaseGame
25
playerActive: boolean
36
gameOver: boolean
47
resign?: () => void
@@ -7,6 +10,7 @@ interface Props {
710
}
811

912
export const PlayControls: React.FC<Props> = ({
13+
game,
1014
playerActive,
1115
gameOver,
1216
resign,
@@ -16,13 +20,25 @@ export const PlayControls: React.FC<Props> = ({
1620
return (
1721
<div>
1822
{gameOver ? (
19-
<div className="flex flex-col p-4 text-center">
23+
<div className="flex flex-col gap-2 p-4 text-center">
24+
{game.id ? (
25+
<button
26+
onClick={() => {
27+
window.open(`/analysis/${game.id}/play`, '_blank')
28+
}}
29+
className="flex items-center justify-center rounded bg-engine-3 py-2 transition duration-200 hover:bg-engine-4"
30+
>
31+
<p className="font-medium uppercase tracking-wide">
32+
Analyze game
33+
</p>
34+
</button>
35+
) : null}
2036
{playAgain ? (
2137
<button
2238
onClick={playAgain}
2339
className="flex items-center justify-center rounded bg-human-3 py-2 transition duration-200 hover:bg-human-4"
2440
>
25-
<p className="text-lg">Play again</p>
41+
<p className="font-medium uppercase tracking-wide">Play again</p>
2642
</button>
2743
) : null}
2844
</div>

src/pages/play/maia.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ const PlayMaia: React.FC<Props> = ({
194194
<PlayControllerContext.Provider value={controller}>
195195
<GameplayInterface>
196196
<PlayControls
197+
game={controller.game}
197198
playerActive={controller.playerActive}
198199
gameOver={!!controller.game.termination}
199200
resign={

0 commit comments

Comments
 (0)