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
Select any categories below that you'd like to play.
You can choose as many as you'd like.
</p>
- {props.prompts.map(p => <PromptOption prompt={p} player={props.player} />)}
+ {props.prompts.map(
+ prompt => <PromptOption
+ key={prompt.id}
+ prompt={prompt}
+ player={props.player}
+ />
+ )}
</div>
);
});
for (let word of props.words) {
const word_canon = canonize(word);
- console.log("Canonized " + word + " to " + word_canon);
let found_match = false;
for (let set of word_sets) {
const set_canon = canonize(set.values().next().value);
- console.log("Comparing " + word_canon + " to " + set_canon);
if (word_canon === set_canon) {
set.add(word);
found_match = true;;
this.state = {
word_sets: word_sets,
- selected: null
+ selected: null,
+ starred: null
};
this.submitted = false;
const response = await fetch_post_json(
`judged/${this.props.prompt.id}`,{
- word_groups: this.state.word_sets.map(set => Array.from(set))
+ word_groups: this.state.word_sets.map(set => Array.from(set)),
+ 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 (
</button>
);
})}
+ <span
+ className={this.state.starred === set ?
+ "star-button selected" : "star-button"
+ }
+ onClick={(event) => {
+ event.stopPropagation();
+ this.setState({
+ starred: set
+ });
+ }}
+ >
+ {this.state.starred === set ?
+ '★' : '☆'
+ }
+ </span>
</div>
);
})}
}
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">