X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=inline;f=empathy%2Fempathy.jsx;h=90bf0fd360829299facce85a1e3593c3a82db63a;hb=ca50b4b8fd8fc7d5fe23b7bba2544d1eef8de33e;hp=39889f7d8d7d16e4aba10f4385d8564931696a57;hpb=78536d0d2b714d5a88dcb67124c2de963c2e316d;p=lmno.games diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 39889f7..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 (
- 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. +