From 5168e70edcdc4718bcd75f4753e73859207d8805 Mon Sep 17 00:00:00 2001 From: Carlos Mesquita Date: Wed, 4 Sep 2024 02:26:22 +0100 Subject: [PATCH] ENCOA-149, ENCOA-150, ENCOA-152, ENCOA-153, ENCOA-155, ENCOA-156, ENCOA-157, ENCOA-158, ENCOA-161 -> Updated the mc buttons, no longer shows a context only div on parts that have context, removed line numbers on lines between paragraphs, applied bold and underline to 'not correct' in underline prompts, added another pop up to confirm submission. --- src/components/Exercises/FillBlanks/index.tsx | 14 +-- src/components/Exercises/MultipleChoice.tsx | 2 +- src/components/Medium/ModuleTitle.tsx | 8 +- src/components/Modal.tsx | 5 +- src/exams/Level/PartDivider.tsx | 2 +- src/exams/Level/TextComponent.tsx | 65 +++++++---- src/exams/Level/index.tsx | 103 ++++++++++-------- src/interfaces/exam.ts | 1 + 8 files changed, 106 insertions(+), 94 deletions(-) diff --git a/src/components/Exercises/FillBlanks/index.tsx b/src/components/Exercises/FillBlanks/index.tsx index 9bca1c9d..aed260b0 100644 --- a/src/components/Exercises/FillBlanks/index.tsx +++ b/src/components/Exercises/FillBlanks/index.tsx @@ -173,23 +173,11 @@ const FillBlanks: React.FC = ({ className={clsx( "flex border p-4 rounded-xl gap-2 cursor-pointer bg-white text-base", !!answers.find((x) => x.solution.toLocaleLowerCase() === value.toLocaleLowerCase() && x.id === currentMCSelection.id) && - "border-mti-purple-light", + "!bg-mti-purple-light !text-white", )}> {key}. {value} - - /*;*/ })} diff --git a/src/components/Exercises/MultipleChoice.tsx b/src/components/Exercises/MultipleChoice.tsx index 55816e07..0de7dd17 100644 --- a/src/components/Exercises/MultipleChoice.tsx +++ b/src/components/Exercises/MultipleChoice.tsx @@ -60,7 +60,7 @@ function Question({ onClick={() => (onSelectOption ? onSelectOption(option.id.toString()) : null)} className={clsx( "flex border p-4 rounded-xl gap-2 cursor-pointer bg-white text-base select-none", - userSolution === option.id.toString() && "border-mti-purple-light", + userSolution === option.id.toString() && "!bg-mti-purple-light !text-white", )}> {option.id.toString()}. {option.text} diff --git a/src/components/Medium/ModuleTitle.tsx b/src/components/Medium/ModuleTitle.tsx index 4b7b24b2..bd849f72 100644 --- a/src/components/Medium/ModuleTitle.tsx +++ b/src/components/Medium/ModuleTitle.tsx @@ -1,15 +1,13 @@ import { Module } from "@/interfaces"; import { moduleLabels } from "@/utils/moduleUtils"; import clsx from "clsx"; -import { Fragment, ReactNode, useCallback, useState } from "react"; +import { ReactNode, useState } from "react"; import { BsBook, BsClipboard, BsHeadphones, BsMegaphone, BsPen, BsStopwatch } from "react-icons/bs"; import ProgressBar from "../Low/ProgressBar"; import Timer from "./Timer"; -import { Exam, Exercise, LevelExam, MultipleChoiceExercise, ShuffleMap, UserSolution } from "@/interfaces/exam"; +import { Exercise, LevelExam, MultipleChoiceExercise, ShuffleMap, UserSolution } from "@/interfaces/exam"; import { BsFillGrid3X3GapFill } from "react-icons/bs"; -import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import Button from "../Low/Button"; -import { Dialog, Transition } from "@headlessui/react"; import useExamStore from "@/stores/examStore"; import Modal from "../Modal"; import React from "react"; @@ -145,7 +143,7 @@ export default function ModuleTitle({ return (
{partInstructions.split("\\n").map((line, lineIndex) => ( - {line} + not correct')}}> ))}
); diff --git a/src/components/Modal.tsx b/src/components/Modal.tsx index 0bd0e46e..a7f3c7fb 100644 --- a/src/components/Modal.tsx +++ b/src/components/Modal.tsx @@ -7,10 +7,11 @@ interface Props { onClose: () => void; title?: string; className?: string; + titleClassName?: string; children?: ReactElement; } -export default function Modal({isOpen, title, className, onClose, children}: Props) { +export default function Modal({isOpen, title, className, titleClassName, onClose, children}: Props) { return ( @@ -41,7 +42,7 @@ export default function Modal({isOpen, title, className, onClose, children}: Pro className, )}> {title && ( - + {title} )} diff --git a/src/exams/Level/PartDivider.tsx b/src/exams/Level/PartDivider.tsx index f075f8c5..4f7cdd96 100644 --- a/src/exams/Level/PartDivider.tsx +++ b/src/exams/Level/PartDivider.tsx @@ -25,7 +25,7 @@ const PartDivider: React.FC = ({ partIndex, part, onNext }) => {
{/** only level for now */}
{moduleIcon["level"]}

{part.intro ? `Part ${partIndex + 1}` : "Placement Test"}

- {part.intro && part.intro.split('\\n\\n').map((x, index) =>

{x}

)} + {part.intro && part.intro.split('\\n\\n').map((x, index) =>

not correct')}}>

)}
+ +
+ + { !(partIndex === 0 && questionIndex === 0 && (showPartDivider || startNow)) && @@ -438,20 +438,27 @@ export default function Level({ exam, showSolutions = false, onFinish, editing = {exam.parts.map((_, index) => { - if (!seenParts.includes(index)) { - e.preventDefault(); - } else { - setExerciseIndex(0); - setQuestionIndex(0); + /* + // If client wants to revert uncomment and remove the added if statement + if (!seenParts.has(index)) { + e.preventDefault(); + } else { + */ + setExerciseIndex(0); + setQuestionIndex(0); + if (!seenParts.has(index)) { + setShowPartDivider(true); + setBgColor(levelBgColor); + setSeenParts(prev => new Set(prev).add(index)); } }} className={({ selected }) => clsx( "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-level/80", "ring-white ring-opacity-60 focus:outline-none", - "transition duration-300 ease-in-out", + "transition duration-300 ease-in-out hover:bg-white/70", selected && "bg-white shadow", - seenParts.includes(index) ? "hover:bg-white/70" : "cursor-not-allowed" + // seenParts.includes(index) ? "hover:bg-white/70" : "cursor-not-allowed" ) } >{`Part ${index + 1}`} diff --git a/src/interfaces/exam.ts b/src/interfaces/exam.ts index fa2a7384..4e65ec22 100644 --- a/src/interfaces/exam.ts +++ b/src/interfaces/exam.ts @@ -39,6 +39,7 @@ export interface LevelExam extends ExamBase { export interface LevelPart { context?: string; intro?: string; + category?: string; exercises: Exercise[]; }