+
{game.phase === 'Finish' ? quitBtn : readyBtn}
-
+
+
+
+
+
);
diff --git a/client/src/components/player.box.jsx b/client/src/components/player.box.jsx
index 39a4cb2b..4b626171 100644
--- a/client/src/components/player.box.jsx
+++ b/client/src/components/player.box.jsx
@@ -1,82 +1,47 @@
const preact = require('preact');
-const { Component } = require('preact')
-const { connect } = require('preact-redux');
-const addState = connect(
- function receiveState(state) {
- const { animating } = state;
- return { animating };
- }
-);
+function Scoreboard(args) {
+ const {
+ isPlayer,
+ ready,
+ player,
+ leave,
+ } = args;
-class Scoreboard extends Component {
- constructor(props) {
- super(props);
- this.state = {
- abandonState: false,
- };
- }
+ let scoreText = () => {
+ if (player.score === 'Zero') return '▫▫▫▫';
+ if (player.score === 'One') return '■▫▫▫';
+ if (player.score === 'Two') return '■■▫▫';
+ if (player.score === 'Three') return '■■■▫';
+ if (player.score === 'Adv') return '■■■+';
+ if (player.score === 'Win') return '■■■■';
+ return '';
+ };
- render(args, state) {
- const {
- abandon,
- animating,
- isPlayer,
- player,
- isGame,
- clear,
- } = args;
-
- const { abandonState } = state;
-
- const scoreText = () => {
- if (player.score === 'Zero') return '▫▫▫▫';
- if (player.score === 'One') return '■▫▫▫';
- if (player.score === 'Two') return '■■▫▫';
- if (player.score === 'Three') return '■■■▫';
- if (player.score === 'Adv') return '■■■+';
- if (player.score === 'Win') return '■■■■';
- return '';
- };
-
- const divClick = e => {
- e.stopPropagation();
- return this.setState({ abandonState: false });
- };
- const abandonStateTrue = e => {
- e.stopPropagation();
- this.setState({ abandonState: true });
- };
-
- if (!isPlayer) {
- return (
-
- );
- }
- const abandonClasses = `abandon ${abandonState ? 'confirming' : ''}`;
- const abandonAction = abandonState ? abandon : abandonStateTrue;
+ if (!isPlayer) {
return (
-
+
+
{scoreText()}
-
- {(isPlayer && isGame) ? : null}
-
-
- {(abandon) ? : null}
-
);
}
+
+ return (
+
+
{scoreText()}
+
+
+ {leave ? : null}
+
+
+ );
}
-module.exports = addState(Scoreboard);
+module.exports = Scoreboard;