X-Git-Url: https://git.cworth.org/git?p=lmno.games;a=blobdiff_plain;f=empathy%2Fempathy.jsx;h=a9911d760188ba0736a8f8fb1db15057ab97bbc5;hp=0593b049a30e6a0811f355f1a044fd1e2cb84853;hb=2bb9bc00050a317973c677d8efa697e48ea1eaf6;hpb=ea6d5ea6192e6c1fe665248f51da203625a26f18 diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 0593b04..a9911d7 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 @@ -502,8 +508,11 @@ class Ambiguities extends React.PureComponent { const response = await fetch_post_json( `judged/${this.props.prompt.id}`,{ - word_groups: this.state.word_sets.map(set => Array.from(set)), - kudos: this.state.starred ? Array.from(this.state.starred) : null + word_groups: this.state.word_sets.map( + set => ({ + words: Array.from(set), + kudos: this.state.starred === set ? true : false + })) } ); @@ -783,29 +792,6 @@ class ActivePrompt extends React.PureComponent { } render() { - let move_on_button = null; - if (this.props.idle) { - move_on_button =( - - ); - } let still_waiting = null; const answering_players = Object.keys(this.props.players_answering);; @@ -839,6 +825,32 @@ class ActivePrompt extends React.PureComponent { ); } + let move_on_button = null; + if (this.props.idle) { + move_on_button =( + + ); + } + if (this.props.players_answered.has(this.props.player.name)) { return (
@@ -1206,12 +1218,18 @@ class Game extends React.PureComponent {