X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=empathy%2Fempathy.jsx;h=9f187d8d582ba1d8b7bf0a6cd0824e430d568921;hp=c216e4921b9b5d68d8731defddc353125a010d68;hb=03ec08e67b15cfb053bb8e7d48aefc331fdbda33;hpb=71a123df898044213dd6703c036d6bbbea7f7f8f diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index c216e49..9f187d8 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -89,6 +89,8 @@ events.addEventListener("game-state", event => { window.game.set_scores(state.scores); + window.game.set_new_game_votes(state.new_game_votes); + window.game.state_ready(); }); @@ -176,6 +178,18 @@ events.addEventListener("scores", event => { window.game.set_scores(scores); }); +events.addEventListener("vote-new-game", event => { + const player = JSON.parse(event.data); + + window.game.set_player_vote_new_game(player); +}); + +events.addEventListener("unvote-new-game", event => { + const player = JSON.parse(event.data); + + window.game.set_player_unvote_new_game(player); +}); + /********************************************************* * Game and supporting classes * *********************************************************/ @@ -349,6 +363,45 @@ class CategoryRequest extends React.PureComponent { } } +const PromptOption = React.memo(props => { + + const prompt = props.prompt; + + if (prompt.votes_against.find(v => v === props.player.name)) + return false; + + return ( + + ); +}); + const PromptOptions = React.memo(props => { if (props.prompts.length === 0) @@ -361,29 +414,7 @@ const PromptOptions = React.memo(props => { Select any categories below that you'd like to play. You can choose as many as you'd like.
- {props.prompts.map(p => { - return ( - - ); - })} + {props.prompts.map(p =>- The following players have completed judging: - {[...this.props.players_judged].join(', ')} -
-- Still waiting for the following players: + Still waiting for the following player + {judging_players.length > 1 ? 's' : '' } + :
+ The following players have completed judging:{' '} + {[...this.props.players_judged].join(', ')} +
+ {still_waiting} {move_on_button}- The following players have submitted their answers: - {[...this.props.players_answered].join(', ')} -
+ let still_waiting = null; + const answering_players = Object.keys(this.props.players_answering);; + if (answering_players.length) { + still_waiting = ( +- Still waiting for the following players: + Still waiting for the following player + {answering_players.length > 1 ? 's' : ''} + :
+ The following players have submitted their answers:{' '} + {[...this.props.players_answered].join(', ')} +
+ {still_waiting} {move_on_button}Remember, you're trying to match your answers with what the other players submit. - Give {this.props.prompt.items} answers for the following prompt: + Give {this.props.prompt.items} answer + {this.props.prompt.items > 1 ? 's' : ''} for the following prompt: