From 459f561d36337b583cbc2d612c996cb548b6f568 Mon Sep 17 00:00:00 2001 From: Melanie St-Hilaire Date: Mon, 8 Apr 2024 21:37:11 -0400 Subject: [PATCH] Modification affichage latex et titres --- .../MultipleChoiceQuestion.tsx | 10 +++++++--- .../NumericalQuestion/NumericalQuestion.tsx | 14 +++++++++----- client/src/components/Questions/Question.tsx | 15 ++++++++++----- .../ShortAnswerQuestion/ShortAnswerQuestion.tsx | 14 +++++++++----- .../TrueFalseQuestion/TrueFalseQuestion.tsx | 10 +++++++--- client/src/components/Questions/questionStyle.css | 5 +++++ 6 files changed, 47 insertions(+), 21 deletions(-) diff --git a/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx b/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx index 84ab45a..54022a3 100644 --- a/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx +++ b/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx @@ -12,7 +12,8 @@ type Choices = { }; interface Props { - questionTitle: string; + questionTitle: string | null; + questionContent: string; choices: Choices[]; globalFeedback?: string | undefined; handleOnSubmitAnswer?: (answer: string) => void; @@ -20,7 +21,7 @@ interface Props { } const MultipleChoiceQuestion: React.FC = (props) => { - const { questionTitle, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; + const { questionTitle, questionContent, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const [answer, setAnswer] = useState(); const handleOnClickAnswer = (choice: string) => { @@ -32,7 +33,10 @@ const MultipleChoiceQuestion: React.FC = (props) => { return (
- {questionTitle} + {questionTitle} +
+
+ {questionContent}
{choices.map((choice, i) => { diff --git a/client/src/components/Questions/NumericalQuestion/NumericalQuestion.tsx b/client/src/components/Questions/NumericalQuestion/NumericalQuestion.tsx index 9611888..0fcc56b 100644 --- a/client/src/components/Questions/NumericalQuestion/NumericalQuestion.tsx +++ b/client/src/components/Questions/NumericalQuestion/NumericalQuestion.tsx @@ -12,7 +12,8 @@ type CorrectAnswer = { }; interface Props { - questionTitle: string; + questionTitle: string | null; + questionContent: string; correctAnswers: CorrectAnswer; globalFeedback?: string | undefined; handleOnSubmitAnswer?: (answer: number) => void; @@ -20,7 +21,7 @@ interface Props { } const NumericalQuestion: React.FC = (props) => { - const { questionTitle, correctAnswers, showAnswer, handleOnSubmitAnswer, globalFeedback } = + const { questionTitle, questionContent, correctAnswers, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const [answer, setAnswer] = useState(); @@ -33,7 +34,10 @@ const NumericalQuestion: React.FC = (props) => { return (
- {questionTitle} + {questionTitle} +
+
+ {questionContent}
{showAnswer ? ( <> @@ -45,8 +49,8 @@ const NumericalQuestion: React.FC = (props) => {
) => { setAnswer(e.target.valueAsNumber); }} diff --git a/client/src/components/Questions/Question.tsx b/client/src/components/Questions/Question.tsx index 5038541..ca23679 100644 --- a/client/src/components/Questions/Question.tsx +++ b/client/src/components/Questions/Question.tsx @@ -30,7 +30,8 @@ const Question: React.FC = ({ case 'TF': questionTypeComponent = ( = ({ case 'MC': questionTypeComponent = ( = ({ if (!Array.isArray(question.choices)) { questionTypeComponent = ( = ({ } else { questionTypeComponent = ( = ({ case 'Short': questionTypeComponent = ( void; @@ -20,13 +21,16 @@ interface Props { } const ShortAnswerQuestion: React.FC = (props) => { - const { questionTitle, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; + const { questionTitle, questionContent, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const [answer, setAnswer] = useState(); return (
- {questionTitle} + {questionTitle} +
+
+ {questionContent}
{showAnswer ? ( <> @@ -42,8 +46,8 @@ const ShortAnswerQuestion: React.FC = (props) => {
{ setAnswer(e.target.value); }} diff --git a/client/src/components/Questions/TrueFalseQuestion/TrueFalseQuestion.tsx b/client/src/components/Questions/TrueFalseQuestion/TrueFalseQuestion.tsx index e8dac26..e56eb4b 100644 --- a/client/src/components/Questions/TrueFalseQuestion/TrueFalseQuestion.tsx +++ b/client/src/components/Questions/TrueFalseQuestion/TrueFalseQuestion.tsx @@ -5,7 +5,8 @@ import '../questionStyle.css'; import { Button } from '@mui/material'; interface Props { - questionTitle: string; + questionTitle: string | null; + questionContent: string; correctAnswer: boolean; globalFeedback?: string | undefined; handleOnSubmitAnswer?: (answer: boolean) => void; @@ -13,7 +14,7 @@ interface Props { } const TrueFalseQuestion: React.FC = (props) => { - const { questionTitle, correctAnswer, showAnswer, handleOnSubmitAnswer, globalFeedback } = + const { questionTitle, questionContent, correctAnswer, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const [answer, setAnswer] = useState(undefined); @@ -26,7 +27,10 @@ const TrueFalseQuestion: React.FC = (props) => { return (
- {questionTitle} + {questionTitle} +
+
+ {questionContent}