File tree Expand file tree Collapse file tree 3 files changed +38
-26
lines changed
Expand file tree Collapse file tree 3 files changed +38
-26
lines changed Original file line number Diff line number Diff line change @@ -149,21 +149,29 @@ export const HandBrainPlayControls: React.FC<Props> = ({
149149 { offerDraw ? (
150150 < button
151151 onClick = { offerDraw }
152- className = "flex w-full justify-center rounded bg-engine-3 py-2 text-primary transition duration-200 hover:bg-engine-4"
152+ disabled = { ! playerActive }
153+ className = { `flex w-full justify-center rounded px-4 py-2 text-primary transition duration-200 ${
154+ playerActive
155+ ? 'bg-engine-3 hover:bg-engine-4'
156+ : 'cursor-not-allowed bg-background-2 text-primary/50'
157+ } `}
153158 >
154159 < p className = "font-medium uppercase tracking-wide" >
155160 Offer draw
156161 </ p >
157162 </ button >
158163 ) : null }
159- { resign ? (
160- < button
161- onClick = { resign }
162- className = "flex w-full justify-center rounded bg-human-3 px-4 py-1.5 text-primary transition duration-200 hover:bg-human-4"
163- >
164- < p className = "text-sm font-medium" > Resign</ p >
165- </ button >
166- ) : null }
164+ < button
165+ onClick = { resign }
166+ disabled = { ! resign || ! playerActive }
167+ className = { `flex w-full justify-center rounded px-4 py-1.5 text-primary transition duration-200 ${
168+ resign && playerActive
169+ ? 'bg-human-3 hover:bg-human-4'
170+ : 'cursor-not-allowed bg-background-2 text-primary/50'
171+ } `}
172+ >
173+ < p className = "text-sm font-medium" > Resign</ p >
174+ </ button >
167175 </ div >
168176 ) }
169177 </ div >
Original file line number Diff line number Diff line change @@ -86,19 +86,27 @@ export const PlayControls: React.FC<Props> = ({
8686 { offerDraw ? (
8787 < button
8888 onClick = { offerDraw }
89- className = "flex w-full items-center justify-center rounded bg-engine-3 py-2 transition duration-200 hover:bg-engine-4"
89+ disabled = { ! playerActive }
90+ className = { `flex w-full items-center justify-center rounded px-4 py-2 transition duration-200 ${
91+ playerActive
92+ ? 'bg-engine-3 hover:bg-engine-4'
93+ : 'cursor-not-allowed bg-background-2 text-primary/50'
94+ } `}
9095 >
9196 < p className = "font-medium uppercase tracking-wide" > Offer draw</ p >
9297 </ button >
9398 ) : null }
94- { resign ? (
95- < button
96- onClick = { resign }
97- className = "flex items-center justify-center rounded bg-human-3 px-4 py-1.5 transition duration-200 hover:bg-human-4"
98- >
99- < p className = "text-sm font-medium" > Resign</ p >
100- </ button >
101- ) : null }
99+ < button
100+ onClick = { resign }
101+ disabled = { ! resign || ! playerActive }
102+ className = { `flex items-center justify-center rounded px-4 py-1.5 transition duration-200 ${
103+ resign && playerActive
104+ ? 'bg-human-3 hover:bg-human-4'
105+ : 'cursor-not-allowed bg-background-2 text-primary/50'
106+ } `}
107+ >
108+ < p className = "text-sm font-medium" > Resign</ p >
109+ </ button >
102110 </ div >
103111 ) }
104112 </ div >
Original file line number Diff line number Diff line change @@ -60,14 +60,10 @@ const PlayMaia: React.FC<Props> = ({
6060 game = { controller . game }
6161 playerActive = { controller . playerActive }
6262 gameOver = { ! ! controller . game . termination }
63- resign = {
64- controller . playerActive
65- ? ( ) => {
66- controller . updateClock ( )
67- controller . setResigned ( true )
68- }
69- : undefined
70- }
63+ resign = { ( ) => {
64+ controller . updateClock ( )
65+ controller . setResigned ( true )
66+ } }
7167 playAgain = { playAgain }
7268 simulateMaiaTime = { simulateMaiaTime }
7369 setSimulateMaiaTime = { setSimulateMaiaTime }
You can’t perform that action at this time.
0 commit comments