From 9788e5713e31da1c3f49275630085714ac9ebdf3 Mon Sep 17 00:00:00 2001 From: Eric Smith Date: Thu, 23 Dec 2021 11:49:53 -0500 Subject: [PATCH 1/6] Layer changes --- .../frontend/components/response_panes.jsx | 144 ++++++++++++------ .../tasks/model_chat/model_chat_blueprint.py | 7 +- 2 files changed, 101 insertions(+), 50 deletions(-) diff --git a/parlai/crowdsourcing/tasks/model_chat/frontend/components/response_panes.jsx b/parlai/crowdsourcing/tasks/model_chat/frontend/components/response_panes.jsx index 7f96f99c72c..cc71ab44286 100644 --- a/parlai/crowdsourcing/tasks/model_chat/frontend/components/response_panes.jsx +++ b/parlai/crowdsourcing/tasks/model_chat/frontend/components/response_panes.jsx @@ -8,13 +8,7 @@ import React from "react"; -import { - FormControl, - Button, - Col, - FormGroup, - ControlLabel, -} from "react-bootstrap"; +import { Button, Col, ControlLabel, Form, FormControl, FormGroup } from "react-bootstrap"; function hasAnyAnnotations(annotations) { @@ -28,26 +22,8 @@ function hasAnyAnnotations(annotations) { } return false; } - -function FinalSurvey({ taskConfig, onMessageSend, active, currentCheckboxes}) { - const [rating, setRating] = React.useState(0); - const [sending, setSending] = React.useState(false); - - const tryMessageSend = React.useCallback(() => { - if (active && !sending) { - setSending(true); - onMessageSend({ - text: "", - task_data: { - problem_data_for_prior_message: currentCheckboxes, - final_rating: rating, - }, - }).then(() => { - setSending(false); - }); - } - }, [active, sending, rating, onMessageSend]); +function RatingSelector({ active, ratings, sending, ratingQuestion, ratingIndex, setRatings }) { const ratingOptions = [