import { FillBlanksExercise, TrueFalseExercise } from "@/interfaces/exam"; import clsx from "clsx"; import reactStringReplace from "react-string-replace"; import { CommonProps } from "."; import { Fragment } from "react"; import Button from "../Low/Button"; type Solution = "true" | "false" | "not_given"; export default function TrueFalseSolution({ prompt, type, id, questions, userSolutions, headerButtons, footerButtons }: TrueFalseExercise & CommonProps) { const getButtonColor = (buttonSolution: Solution, solution: Solution, userSolution: Solution | undefined) => { if (buttonSolution !== userSolution && buttonSolution !== solution) return "purple"; if (userSolution) { if (userSolution === buttonSolution && solution === buttonSolution) { return "purple"; } if (solution === buttonSolution) { return "purple"; } return "rose"; } return "gray"; }; return (
{headerButtons}
{prompt.split("\\n").map((line, index) => ( {line}
))}

For each of the questions below, select

TRUE FALSE NOT GIVEN if the statement agrees with the information if the statement contradicts with the information if there is no information on this
You can click a selected option again to deselect it.
{userSolutions && questions.map((question, index) => { const userSolution = userSolutions.find((x) => x.id === question.id.toString()); const solution = question?.solution?.toString().toLowerCase() as Solution; return (
{index + 1}. {question.prompt}
); })}
Correct
Unanswered
Wrong
{footerButtons}
); }