abandon game
This commit is contained in:
parent
60bd7f65ba
commit
4a13656b9d
@ -1,15 +1,24 @@
|
||||
const preact = require('preact');
|
||||
const { connect } = require('preact-redux');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const { animating } = state;
|
||||
return { animating };
|
||||
}
|
||||
);
|
||||
|
||||
function Scoreboard(args) {
|
||||
const {
|
||||
abandon,
|
||||
animating,
|
||||
isPlayer,
|
||||
player,
|
||||
isGame,
|
||||
clear,
|
||||
} = args;
|
||||
|
||||
let scoreText = () => {
|
||||
const scoreText = () => {
|
||||
if (player.score === 'Zero') return '▫▫▫▫';
|
||||
if (player.score === 'One') return '■▫▫▫';
|
||||
if (player.score === 'Two') return '■■▫▫';
|
||||
@ -38,13 +47,13 @@ function Scoreboard(args) {
|
||||
<div>{player.name}</div>
|
||||
</div>
|
||||
<div>
|
||||
{(isPlayer && isGame) ? <button onClick={clear}>Clear</button> : null}
|
||||
{(isPlayer && isGame && !animating) ? <button onClick={clear}>Clear</button> : null}
|
||||
</div>
|
||||
<div>
|
||||
{abandon ? <button onClick={abandon}>Abandon</button> : null}
|
||||
{(abandon && !animating) ? <button onClick={abandon}>Abandon</button> : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = Scoreboard;
|
||||
module.exports = addState(Scoreboard);
|
||||
|
||||
@ -179,6 +179,7 @@ function registerEvents(store) {
|
||||
store.dispatch(actions.setActiveConstruct(first));
|
||||
}
|
||||
}
|
||||
if (v.phase === 'Finished') setGame(null);
|
||||
return store.dispatch(actions.setInstance(v));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user