diff --git a/client/assets/styles/controls.less b/client/assets/styles/controls.less index 4484d720..2410322e 100644 --- a/client/assets/styles/controls.less +++ b/client/assets/styles/controls.less @@ -1,3 +1,5 @@ +@import 'colours.less'; + aside { grid-area: ctrl; display: grid; @@ -93,3 +95,16 @@ aside { .team-page-ctrl h2 { padding: 0 0.75em 0 0.75em; } + +.abandon { + &:hover { + color: @red; + border-color: @red; + }; + + &:active, &.confirming { + background: @red; + color: black; + border: 1px solid black; + } +} \ No newline at end of file diff --git a/client/src/components/player.box.jsx b/client/src/components/player.box.jsx index 7ecc2fb1..a769d90f 100644 --- a/client/src/components/player.box.jsx +++ b/client/src/components/player.box.jsx @@ -1,4 +1,5 @@ const preact = require('preact'); +const { Component } = require('preact') const { connect } = require('preact-redux'); const addState = connect( @@ -8,52 +9,74 @@ const addState = connect( } ); -function Scoreboard(args) { - const { - abandon, - animating, - isPlayer, - player, - isGame, - clear, - } = args; - 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 ''; - }; +class Scoreboard extends Component { + constructor(props) { + super(props); + this.state = { + abandonState: false, + }; + } - if (!isPlayer) { + 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 ( +