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("");
}
}
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
const response = await fetch_post_json(
`judged/${this.props.prompt.id}`,{
word_groups: this.state.word_sets.map(set => Array.from(set)),
- kudos: Array.from(this.state.starred)
+ kudos: this.state.starred ? Array.from(this.state.starred) : null
}
);
className="vote-button"
onClick={() => fetch_post_json(`end-judging/${this.props.prompt.id}`) }
>
- Move On
+ Move On Without Their Input
<div className="vote-choices">
{[...this.props.votes].map(v => {
return (
}
render() {
- let move_on_button = null;
- if (this.props.idle) {
- move_on_button =(
- <button
- className="vote-button"
- onClick={() => fetch_post_json(`end-answers/${this.props.prompt.id}`) }
- >
- Move On
- <div className="vote-choices">
- {[...this.props.votes].map(v => {
- return (
- <div
- key={v}
- className="vote-choice"
- >
- {v}
- </div>
- );
- })}
- </div>
- </button>
- );
- }
let still_waiting = null;
const answering_players = Object.keys(this.props.players_answering);;
);
}
+ let move_on_button = null;
+ if (this.props.idle) {
+ move_on_button =(
+ <button
+ className="vote-button"
+ onClick={() => fetch_post_json(`end-answers/${this.props.prompt.id}`) }
+ >
+ {answering_players.length ?
+ "Move On Without Their Answers" :
+ "Move On Without Anyone Else"}
+ <div className="vote-choices">
+ {[...this.props.votes].map(v => {
+ return (
+ <div
+ key={v}
+ className="vote-choice"
+ >
+ {v}
+ </div>
+ );
+ })}
+ </div>
+ </button>
+ );
+ }
+
if (this.props.players_answered.has(this.props.player.name)) {
return (
<div className="please-wait">