1
0

Move QUIT to an action instead of in the active player list

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-02-03 12:00:51 -08:00
parent ebaa4529a4
commit 22156373e0

View File

@ -283,14 +283,19 @@ const Action = ({ table }) => {
const passClick = (event) => { const passClick = (event) => {
} }
const quitClick = (event) => {
table.setSelected("");
}
if (!table.game) { if (!table.game) {
console.log("Why no game?"); console.log("Why no game?");
return (<Paper className="Action"/>); return (<Paper className="Action"/>);
} }
const inLobby = table.game.state === 'lobby';
return ( return (
<Paper className="Action"> <Paper className="Action">
{ table.game.state === 'lobby' && <> { inLobby && <>
<StartButton table={table}/> <StartButton table={table}/>
<Button disabled={!table.game.color} onClick={newTableClick}>New table</Button> <Button disabled={!table.game.color} onClick={newTableClick}>New table</Button>
<Button disabled={table.game.color ? true : false} onClick={() => {table.setState({ pickName: true})}}>Change name</Button> </> } <Button disabled={table.game.color ? true : false} onClick={() => {table.setState({ pickName: true})}}>Change name</Button> </> }
@ -300,6 +305,9 @@ const Action = ({ table }) => {
<Button onClick={rollClick}>Roll Dice</Button> <Button onClick={rollClick}>Roll Dice</Button>
<Button disabled onClick={passClick}>Pass Turn</Button> <Button disabled onClick={passClick}>Pass Turn</Button>
</> } </> }
{ !inLobby &&
<Button onClick={quitClick}>Quit</Button>
}
</Paper> </Paper>
); );
} }
@ -384,9 +392,6 @@ const Players = ({ table }) => {
{ item.status + ' ' } { item.status + ' ' }
{ item.status !== 'Not active' && <Moment fromNow date={item.lastActive > Date.now() ? Date.now() : item.lastActive}/>} { item.status !== 'Not active' && <Moment fromNow date={item.lastActive > Date.now() ? Date.now() : item.lastActive}/>}
</>)} /> </>)} />
{ !inLobby && table.game.color === color &&
<Button onClick={() => toggleSelected(color)}>Quit</Button>
}
</div> </div>
)); ));
} }