From 3e9152fa5c8149457ebe96ba4d6e5a6b628ba9bc Mon Sep 17 00:00:00 2001 From: JubaAzul <118773284+JubaAzul@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:35:07 -0500 Subject: [PATCH] =?UTF-8?q?Confusion=20avec=20la=20navigation=20dans=20les?= =?UTF-8?q?=20questions=20=C3=A0=20rythme=20de=20l'enseignant=20Fixes=20#1?= =?UTF-8?q?45?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultipleChoiceQuestion.tsx | 4 +++ .../StudentModeQuiz/StudentModeQuiz.tsx | 27 +++++++++---------- .../pages/Teacher/ManageRoom/ManageRoom.tsx | 23 ++++++++-------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx b/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx index 4957d11..32f451a 100644 --- a/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx +++ b/client/src/components/Questions/MultipleChoiceQuestion/MultipleChoiceQuestion.tsx @@ -23,6 +23,7 @@ interface Props { } const MultipleChoiceQuestion: React.FC = (props) => { + const { questionStem: questionContent, choices, showAnswer, handleOnSubmitAnswer, globalFeedback } = props; const [answer, setAnswer] = useState(); @@ -73,7 +74,9 @@ const MultipleChoiceQuestion: React.FC = (props) => { {globalFeedback && showAnswer && (
{globalFeedback}
)} + {!showAnswer && handleOnSubmitAnswer && ( + )} diff --git a/client/src/components/StudentModeQuiz/StudentModeQuiz.tsx b/client/src/components/StudentModeQuiz/StudentModeQuiz.tsx index 6b8db94..15d6fba 100644 --- a/client/src/components/StudentModeQuiz/StudentModeQuiz.tsx +++ b/client/src/components/StudentModeQuiz/StudentModeQuiz.tsx @@ -1,13 +1,12 @@ // StudentModeQuiz.tsx import React, { useEffect, useState } from 'react'; import QuestionComponent from '../Questions/Question'; - import '../../pages/Student/JoinRoom/joinRoom.css'; import { QuestionType } from '../../Types/QuestionType'; // import { QuestionService } from '../../services/QuestionService'; import { Button } from '@mui/material'; -import QuestionNavigation from '../QuestionNavigation/QuestionNavigation'; -import { ChevronLeft, ChevronRight } from '@mui/icons-material'; +//import QuestionNavigation from '../QuestionNavigation/QuestionNavigation'; +//import { ChevronLeft, ChevronRight } from '@mui/icons-material'; import DisconnectButton from 'src/components/DisconnectButton/DisconnectButton'; interface StudentModeQuizProps { @@ -25,10 +24,10 @@ const StudentModeQuiz: React.FC = ({ const [isAnswerSubmitted, setIsAnswerSubmitted] = useState(false); // const [imageUrl, setImageUrl] = useState(''); - const previousQuestion = () => { - setQuestion(questions[Number(questionInfos.question?.id) - 2]); - setIsAnswerSubmitted(false); - }; + // const previousQuestion = () => { + // setQuestion(questions[Number(questionInfos.question?.id) - 2]); + // setIsAnswerSubmitted(false); + // }; useEffect(() => {}, [questionInfos]); @@ -55,12 +54,12 @@ const StudentModeQuiz: React.FC = ({
- + /> */}
= ({ />
- + */}
-
-
+ ); }; diff --git a/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx b/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx index 30add4e..7f1d744 100644 --- a/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx +++ b/client/src/pages/Teacher/ManageRoom/ManageRoom.tsx @@ -17,7 +17,7 @@ import LoadingCircle from 'src/components/LoadingCircle/LoadingCircle'; import { Refresh, Error } from '@mui/icons-material'; import StudentWaitPage from 'src/components/StudentWaitPage/StudentWaitPage'; import DisconnectButton from 'src/components/DisconnectButton/DisconnectButton'; -import QuestionNavigation from 'src/components/QuestionNavigation/QuestionNavigation'; +//import QuestionNavigation from 'src/components/QuestionNavigation/QuestionNavigation'; import Question from 'src/components/Questions/Question'; import ApiService from '../../../services/ApiService'; @@ -261,16 +261,16 @@ const ManageRoom: React.FC = () => { webSocketService.nextQuestion(roomName, quizQuestions[nextQuestionIndex]); }; - const previousQuestion = () => { - if (!quizQuestions || !currentQuestion || !quiz?.content) return; + // const previousQuestion = () => { + // if (!quizQuestions || !currentQuestion || !quiz?.content) return; - const prevQuestionIndex = Number(currentQuestion?.question.id) - 2; // -2 because question.id starts at index 1 + // const prevQuestionIndex = Number(currentQuestion?.question.id) - 2; // -2 because question.id starts at index 1 - if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return; + // if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return; - setCurrentQuestion(quizQuestions[prevQuestionIndex]); - webSocketService.nextQuestion(roomName, quizQuestions[prevQuestionIndex]); - }; + // setCurrentQuestion(quizQuestions[prevQuestionIndex]); + // webSocketService.nextQuestion(roomName, quizQuestions[prevQuestionIndex]); + // }; const initializeQuizQuestion = () => { const quizQuestionArray = quiz?.content; @@ -461,12 +461,12 @@ const ManageRoom: React.FC = () => { {quizMode === 'teacher' && (
- + /> */}
)} @@ -494,10 +494,11 @@ const ManageRoom: React.FC = () => { {quizMode === 'teacher' && (
-
+ )}