diff --git a/src/mockData/QuizDetails.ts b/src/mockData/QuizDetails.ts index 135d179..50c329d 100644 --- a/src/mockData/QuizDetails.ts +++ b/src/mockData/QuizDetails.ts @@ -1,6 +1,6 @@ import { QuizDetails } from "../models/QuizDetails"; -const Quiz_Details: QuizDetails[] = [ +const QUIZ_DETAILS: QuizDetails[] = [ { question: "How would you correctly display, “Hello, how are you?”?", options: [ @@ -24,7 +24,7 @@ const Quiz_Details: QuizDetails[] = [ ], answer: ["alert('Hello World');"], result: false, - timeLimit: 10, + timeLimit: 20, type: "singleSelect" }, @@ -73,4 +73,4 @@ export let test = [ }, ] -export default Quiz_Details; \ No newline at end of file +export default QUIZ_DETAILS; \ No newline at end of file diff --git a/src/pages/interviewRounds/StepDescreption.tsx b/src/pages/interviewRounds/StepDescreption.tsx index c02dc05..f305399 100644 --- a/src/pages/interviewRounds/StepDescreption.tsx +++ b/src/pages/interviewRounds/StepDescreption.tsx @@ -51,7 +51,7 @@ const StepsDescription: React.FC = (props) => { {props.isRoundCompleted ? - Completed + Completed : diff --git a/src/pages/quiz/Options.tsx b/src/pages/quiz/Options.tsx index ac6ce11..8b3ca6b 100644 --- a/src/pages/quiz/Options.tsx +++ b/src/pages/quiz/Options.tsx @@ -1,7 +1,6 @@ import { IonButton, IonCheckbox, IonItem, IonLabel, IonList, IonRadio, IonRadioGroup } from '@ionic/react'; import { useEffect, useRef, useState } from 'react'; import { Link } from 'react-router-dom'; -import Input from '../../components/formInput/Input'; import styles from './Options.module.scss'; interface OwnProps { @@ -59,12 +58,7 @@ const Options: React.FC = (props) => { setTextInput(inputRef.current?.value!) } - if ((selected || textInput)) { - console.log("decision"); - } - if (props.lastQuestion) { - console.log("last"); localStorage.setItem("answer", answers.toString()); } @@ -122,7 +116,7 @@ const Options: React.FC = (props) => { } {props.lastQuestion && - < Link to="/preliminaryRoundResults" className={styles.button + " " + (selected ? styles.active : "")}> + < Link to="/preliminaryRoundResults" className={styles.button + " " + ((selected || selectedOptions.length > 0 || textInput) ? styles.active : "")}> Next Step } diff --git a/src/pages/quiz/Question.tsx b/src/pages/quiz/Question.tsx index eac0982..43aa1fb 100644 --- a/src/pages/quiz/Question.tsx +++ b/src/pages/quiz/Question.tsx @@ -16,22 +16,27 @@ const Question: React.FC = (props) => { const [duration, setDuration] = useState(props.timeLimit); const displaySeconds = seconds % 60; - // useEffect(() => { - // setSeconds(props.timeLimit); - // setDuration(props.timeLimit); - // }, [props.questionNumber]); - - // useEffect(() => { - // console.log(seconds); - // setTimeout(() => { - // if (seconds > 0) { - // setSeconds(seconds - 1); - // } else { - // props.updateQuestionNumber(); - // } - // }, 1000); - - // }, [seconds]); + useEffect(() => { + setSeconds(props.timeLimit); + setDuration(props.timeLimit); + }, [props.questionNumber]); + + useEffect(() => { + + const timeOut = setTimeout(() => { + if (seconds > 0) { + setSeconds(seconds - 1); + } else { + props.updateQuestionNumber(); + } + }, 1000); + + return () => clearInterval(timeOut); + + }, [seconds]); + + console.log("seconds", seconds); + const renderTime = () => { return ( @@ -58,12 +63,12 @@ const Question: React.FC = (props) => { { - // return { shouldRepeat: true, delay: 1.5 } - // }} + onComplete={() => { + return { shouldRepeat: true, delay: 1.5 } + }} strokeWidth={5} > {renderTime} diff --git a/src/pages/quiz/Quiz.tsx b/src/pages/quiz/Quiz.tsx index d6a9e86..54153c9 100644 --- a/src/pages/quiz/Quiz.tsx +++ b/src/pages/quiz/Quiz.tsx @@ -4,17 +4,17 @@ import { IonButton, IonIcon } from '@ionic/react'; import Options from './Options'; import { closeOutline } from 'ionicons/icons' import { Link } from 'react-router-dom'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import Question from './Question'; -import Quiz_Details from '../../mockData/QuizDetails'; +import QUIZ_DETAILS from '../../mockData/QuizDetails'; const Quiz: React.FC = () => { const [questionNumber, setQuestionNumber] = useState(1); - const timeLimit = Quiz_Details[questionNumber - 1].timeLimit; + const timeLimit = QUIZ_DETAILS[questionNumber - 1].timeLimit; const updateQuestionNumber = () => { - if (Quiz_Details.length > questionNumber) { + if (QUIZ_DETAILS.length > questionNumber) { setQuestionNumber((questionNumber) => questionNumber + 1); } } @@ -29,7 +29,8 @@ const Quiz: React.FC = () => { - @@ -39,18 +40,14 @@ const Quiz: React.FC = () => {
- {/* - Next - */} -
diff --git a/src/pages/technicalInterview/TechnicalInterview.tsx b/src/pages/technicalInterview/TechnicalInterview.tsx index 4b2bacd..60fbc29 100644 --- a/src/pages/technicalInterview/TechnicalInterview.tsx +++ b/src/pages/technicalInterview/TechnicalInterview.tsx @@ -15,7 +15,7 @@ const TechnicalInterview: React.FC = () => { const [isDateSet, setDate] = useState(false); const [isTimeSlot, setTimeSlot] = useState(false); - const [days, hours, minutes, seconds] = useCountdown(new Date('may 6, 2022 07:00:00')); + const [days, hours, minutes, seconds] = useCountdown(new Date('may 7, 2022 07:00:00')); const getDate = () => { setTimeSlot(false);