X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;ds=sidebyside;f=empathy%2Fempathy.jsx;h=4ef6807fef559834be1fed0be1a6f9cb2f2ed889;hb=db513b3fa26652fd2cf42d727604df3ed2ad6002;hp=85738f3eb69a021a7e4cf3bc67fb728f0473b546;hpb=43502f89bf6346115c388b80a6c7f559a336d000;p=lmno.games diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 85738f3..4ef6807 100644 --- a/empathy/empathy.jsx +++ b/empathy/empathy.jsx @@ -283,7 +283,7 @@ class CategoryRequest extends React.PureComponent { const match = category.match(/[0-9]+/); if (match) { const num_items = parseInt(match[0], 10); - if (num_items <= MAX_PROMPT_ITEMS) + if (num_items > 0 && num_items <= MAX_PROMPT_ITEMS) category_input.setCustomValidity(""); } } @@ -311,6 +311,12 @@ class CategoryRequest extends React.PureComponent { return; } + if (num_items < 1) { + category_input.setCustomValidity("Category must require at least one item."); + form.reportValidity(); + return; + } + const response = await fetch_post_json("prompts", { items: num_items, prompt: category @@ -363,6 +369,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) @@ -375,43 +420,47 @@ 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( + prompt =>+ {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: