import {errorButtonStyle, infoButtonStyle} from "@/constants/buttonStyles"; import {FillBlanksExercise} from "@/interfaces/exam"; import {mdiArrowLeft, mdiArrowRight} from "@mdi/js"; import Icon from "@mdi/react"; import clsx from "clsx"; import reactStringReplace from "react-string-replace"; import {CommonProps} from "."; import {Fragment} from "react"; export default function FillBlanksSolutions({prompt, solutions, text, userSolutions, onNext, onBack}: FillBlanksExercise & CommonProps) { const renderLines = (line: string) => { return ( {reactStringReplace(line, /({{\d}})/g, (match) => { const id = match.replaceAll(/[\{\}]/g, ""); const userSolution = userSolutions.find((x) => x.id === id); const solution = solutions.find((x) => x.id === id)!; if (!userSolution) { return ( <> > ); } if (userSolution.solution === solution.solution) { return ; } if (userSolution.solution !== solution.solution) { return ( <> > ); } })} ); }; return ( <>