Updated the Writing exercise to have the evaluation in the user solutions instead of the exercise itself

This commit is contained in:
Tiago Ribeiro
2023-06-23 10:28:33 +01:00
parent 9cbb5b93c8
commit b2cc706a5e
5 changed files with 44 additions and 38 deletions

View File

@@ -10,7 +10,7 @@ import {toast} from "react-toastify";
import Button from "../Low/Button";
import {Dialog, Transition} from "@headlessui/react";
export default function Writing({id, prompt, info, evaluation, attachment, userSolutions, onNext, onBack}: WritingExercise & CommonProps) {
export default function Writing({id, prompt, info, attachment, userSolutions, onNext, onBack}: WritingExercise & CommonProps) {
const [isModalOpen, setIsModalOpen] = useState(false);
return (
@@ -74,20 +74,24 @@ export default function Writing({id, prompt, info, evaluation, attachment, userS
className="w-full h-full min-h-[320px] cursor-text px-7 py-8 input border-2 border-mti-gray-platinum bg-white rounded-3xl"
contentEditable={false}
readOnly
value={userSolutions[0] as any}
value={userSolutions[0]!.solution}
/>
</div>
)}
<div className="flex flex-col gap-4 w-full">
<div className="flex gap-4 px-1">
{Object.keys(evaluation!.task_response).map((key) => (
<div className="bg-ielts-writing text-ielts-writing-light rounded-xl px-4 py-2" key={key}>
{key}: Level {evaluation!.task_response[key]}
</div>
))}
{userSolutions && userSolutions.length > 0 && (
<div className="flex flex-col gap-4 w-full">
<div className="flex gap-4 px-1">
{Object.keys(userSolutions[0].evaluation!.task_response).map((key) => (
<div className="bg-ielts-writing text-ielts-writing-light rounded-xl px-4 py-2" key={key}>
{key}: Level {userSolutions[0].evaluation!.task_response[key]}
</div>
))}
</div>
<div className="w-full h-full min-h-fit cursor-text px-7 py-8 bg-mti-gray-smoke rounded-3xl">
{userSolutions[0].evaluation!.comment}
</div>
</div>
<div className="w-full h-full min-h-fit cursor-text px-7 py-8 bg-mti-gray-smoke rounded-3xl">{evaluation!.comment}</div>
</div>
)}
</div>
</div>