import {MatchSentencesExercise} from "@/interfaces/exam"; import clsx from "clsx"; import LineTo from "react-lineto"; import {CommonProps} from "."; import {errorButtonStyle, infoButtonStyle} from "@/constants/buttonStyles"; import {mdiArrowLeft, mdiArrowRight} from "@mdi/js"; import Icon from "@mdi/react"; import {Fragment} from "react"; import Button from "../Low/Button"; import Xarrow from "react-xarrows"; export default function MatchSentencesSolutions({ id, type, options, prompt, sentences, userSolutions, onNext, onBack, }: MatchSentencesExercise & CommonProps) { const calculateScore = () => { const total = sentences.length; const correct = userSolutions.filter( (x) => sentences.find((y) => y.id.toString() === x.question.toString())?.solution === x.option || false, ).length; const missing = total - userSolutions.filter((x) => sentences.find((y) => y.id.toString() === x.question.toString())).length; return {total, correct, missing}; }; return ( <>