);
});
@@ -240,7 +303,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("");
}
}
@@ -268,6 +331,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
@@ -320,6 +389,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)
@@ -332,43 +440,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 =>
+ )}
);
});
const LetsPlay = React.memo(props => {
- const quorum = Math.round((props.num_players + 1) / 2);
+ const quorum = Math.max(0, props.num_players - props.prompts.length);
const max_votes = props.prompts.reduce(
(max_so_far, v) => Math.max(max_so_far, v.votes.length), 0);
- if (max_votes < quorum)
- return null;
+ if (max_votes < quorum) {
+ let text = `Before we play, we should collect a bit
+ more information about what category would
+ be interesting for this group. So, either
+ type a new category option above, or else`;
+ if (props.prompts.length) {
+ if (props.prompts.length > 1)
+ text += " vote on some of the categories below.";
+ else
+ text += " vote on the category below.";
+ } else {
+ text += " wait for others to submit, and then vote on them below.";
+ }
+
+ return (
+
+ The following players have completed judging:{' '}
+ {[...this.props.players_judged].join(', ')}
+
+ {still_waiting}
+ {move_on_button}
);
@@ -555,11 +715,17 @@ class Ambiguities extends React.PureComponent {
Judging Answers
- 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.
+
+ The following players have submitted their answers:{' '}
+ {[...this.props.players_answered].join(', ')}
+
+ {still_waiting}
+ {move_on_button}
);
@@ -709,7 +923,8 @@ class ActivePrompt extends React.PureComponent {
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: