X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=empathy%2Fempathy.jsx;h=53d7763c84f7a27643ac5f90b935dd945c601335;hb=c4f9db9ff6ba1f1f94490a0d8e96acccf0eb549e;hp=0593b049a30e6a0811f355f1a044fd1e2cb84853;hpb=ea6d5ea6192e6c1fe665248f51da203625a26f18;p=lmno.games diff --git a/empathy/empathy.jsx b/empathy/empathy.jsx index 0593b04..53d7763 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 @@ -783,29 +789,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 +822,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 (