X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=empathy%2Fempathy.jsx;h=90bf0fd360829299facce85a1e3593c3a82db63a;hb=3b5d17e14224eeb4befeaef409f54fb29af831ed;hp=044d4e07ad5e3e62885648410f0d6977d5b62525;hpb=5e235932d1940d4849d2f3adbee33f6ecef4ed6b;p=lmno.games diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 044d4e0..90bf0fd 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -48,7 +48,7 @@ events.addEventListener("player-enter", event => { events.addEventListener("player-exit", event => { const info = JSON.parse(event.data); - window.game.remove_player(info); + window.game.disable_player(info); }); events.addEventListener("player-update", event => { @@ -227,23 +227,43 @@ const PlayerInfo = React.memo(props => { if (! props.player.id) return null; - const all_players = [props.player, ...props.other_players]; + const all_players = [{...props.player, active:true}, ...props.other_players]; const sorted_players = all_players.sort((a,b) => { return b.score - a.score; }); - const names_and_scores = sorted_players.map(player => { - if (player.score) - return `${player.name} (${player.score})`; - else - return player.name; - }).join(', '); + /* Return a new array with the separator interspersed between + * each element of the array passed in as the argument. + */ + function intersperse(arr, sep) { + return arr.reduce((acc, val) => [...acc, sep, val], []).slice(1); + } + + let names_and_scores = sorted_players.map(player => { + if (player.score) { + return ( + + {player.name} ({player.score}) + + ); + } else { + if (player.active) + return player.name; + else + return null; + } + }).filter(component => component != null); + + names_and_scores = intersperse(names_and_scores, ", "); return (
+ {text} +
+- The following players have completed judging: - {[...this.props.players_judged].join(', ')} -
+ let still_waiting = null; + const judging_players = Object.keys(this.props.players_judging); + if (judging_players.length) { + still_waiting = ( +- 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}- Click on each pair of answers that should be scored as equivalent, - (and click any word twice to split it out from a group). Remember, + Click/tap on each pair of answers that should be scored as equivalent, + (or click a word twice to split it out from a group). Remember, what goes around comes around, so it's best to be generous when judging.
++ Also, for an especially fun or witty answer, you can give kudos + by clicking the star on the right. You may only do this for one + word/group. +
++ Still waiting for the following player + {answering_players.length > 1 ? 's' : ''} + : +
+- The following players have submitted their answers: + The following players have submitted their answers:{' '} {[...this.props.players_answered].join(', ')}
-- Still waiting for the following players: -
-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: