Disabled the short length exams

This commit is contained in:
Tiago Ribeiro
2024-04-24 08:53:53 +01:00
parent 0f8f9bc05b
commit 00feee2179

View File

@@ -1,310 +1,442 @@
/* eslint-disable @next/next/no-img-element */ /* eslint-disable @next/next/no-img-element */
import {useState} from "react"; import { useState } from "react";
import {Module} from "@/interfaces"; import { Module } from "@/interfaces";
import clsx from "clsx"; import clsx from "clsx";
import {User} from "@/interfaces/user"; import { User } from "@/interfaces/user";
import ProgressBar from "@/components/Low/ProgressBar"; import ProgressBar from "@/components/Low/ProgressBar";
import {BsArrowRepeat, BsBook, BsCheck, BsCheckCircle, BsClipboard, BsHeadphones, BsMegaphone, BsPen, BsXCircle} from "react-icons/bs"; import {
import {totalExamsByModule} from "@/utils/stats"; BsArrowRepeat,
BsBook,
BsCheck,
BsCheckCircle,
BsClipboard,
BsHeadphones,
BsMegaphone,
BsPen,
BsXCircle,
} from "react-icons/bs";
import { totalExamsByModule } from "@/utils/stats";
import useStats from "@/hooks/useStats"; import useStats from "@/hooks/useStats";
import Button from "@/components/Low/Button"; import Button from "@/components/Low/Button";
import {calculateAverageLevel} from "@/utils/score"; import { calculateAverageLevel } from "@/utils/score";
import {sortByModuleName} from "@/utils/moduleUtils"; import { sortByModuleName } from "@/utils/moduleUtils";
import {capitalize} from "lodash"; import { capitalize } from "lodash";
import ProfileSummary from "@/components/ProfileSummary"; import ProfileSummary from "@/components/ProfileSummary";
import {Variant} from "@/interfaces/exam"; import { Variant } from "@/interfaces/exam";
import useSessions, {Session} from "@/hooks/useSessions"; import useSessions, { Session } from "@/hooks/useSessions";
import SessionCard from "@/components/Medium/SessionCard"; import SessionCard from "@/components/Medium/SessionCard";
import useExamStore from "@/stores/examStore"; import useExamStore from "@/stores/examStore";
import moment from "moment"; import moment from "moment";
interface Props { interface Props {
user: User; user: User;
page: "exercises" | "exams"; page: "exercises" | "exams";
onStart: (modules: Module[], avoidRepeated: boolean, variant: Variant) => void; onStart: (
disableSelection?: boolean; modules: Module[],
avoidRepeated: boolean,
variant: Variant,
) => void;
disableSelection?: boolean;
} }
export default function Selection({user, page, onStart, disableSelection = false}: Props) { export default function Selection({
const [selectedModules, setSelectedModules] = useState<Module[]>([]); user,
const [avoidRepeatedExams, setAvoidRepeatedExams] = useState(true); page,
const [variant, setVariant] = useState<Variant>("full"); onStart,
disableSelection = false,
}: Props) {
const [selectedModules, setSelectedModules] = useState<Module[]>([]);
const [avoidRepeatedExams, setAvoidRepeatedExams] = useState(true);
const [variant, setVariant] = useState<Variant>("full");
const {stats} = useStats(user?.id); const { stats } = useStats(user?.id);
const {sessions, isLoading, reload} = useSessions(user.id); const { sessions, isLoading, reload } = useSessions(user.id);
const state = useExamStore((state) => state); const state = useExamStore((state) => state);
const toggleModule = (module: Module) => { const toggleModule = (module: Module) => {
const modules = selectedModules.filter((x) => x !== module); const modules = selectedModules.filter((x) => x !== module);
setSelectedModules((prev) => (prev.includes(module) ? modules : [...modules, module])); setSelectedModules((prev) =>
}; prev.includes(module) ? modules : [...modules, module],
);
};
const loadSession = async (session: Session) => { const loadSession = async (session: Session) => {
state.setSelectedModules(session.selectedModules); state.setSelectedModules(session.selectedModules);
state.setExam(session.exam); state.setExam(session.exam);
state.setExams(session.exams); state.setExams(session.exams);
state.setSessionId(session.sessionId); state.setSessionId(session.sessionId);
state.setAssignment(session.assignment); state.setAssignment(session.assignment);
state.setExerciseIndex(session.exerciseIndex); state.setExerciseIndex(session.exerciseIndex);
state.setPartIndex(session.partIndex); state.setPartIndex(session.partIndex);
state.setModuleIndex(session.moduleIndex); state.setModuleIndex(session.moduleIndex);
state.setTimeSpent(session.timeSpent); state.setTimeSpent(session.timeSpent);
state.setUserSolutions(session.userSolutions); state.setUserSolutions(session.userSolutions);
state.setShowSolutions(false); state.setShowSolutions(false);
state.setQuestionIndex(session.questionIndex); state.setQuestionIndex(session.questionIndex);
}; };
return ( return (
<> <>
<div className="relative flex h-full w-full flex-col gap-8 md:gap-16"> <div className="relative flex h-full w-full flex-col gap-8 md:gap-16">
{user && ( {user && (
<ProfileSummary <ProfileSummary
user={user} user={user}
items={[ items={[
{ {
icon: <BsBook className="text-ielts-reading h-6 w-6 md:h-8 md:w-8" />, icon: (
label: "Reading", <BsBook className="text-ielts-reading h-6 w-6 md:h-8 md:w-8" />
value: totalExamsByModule(stats, "reading"), ),
tooltip: "The amount of reading exams performed.", label: "Reading",
}, value: totalExamsByModule(stats, "reading"),
{ tooltip: "The amount of reading exams performed.",
icon: <BsHeadphones className="text-ielts-listening h-6 w-6 md:h-8 md:w-8" />, },
label: "Listening", {
value: totalExamsByModule(stats, "listening"), icon: (
tooltip: "The amount of listening exams performed.", <BsHeadphones className="text-ielts-listening h-6 w-6 md:h-8 md:w-8" />
}, ),
{ label: "Listening",
icon: <BsPen className="text-ielts-writing h-6 w-6 md:h-8 md:w-8" />, value: totalExamsByModule(stats, "listening"),
label: "Writing", tooltip: "The amount of listening exams performed.",
value: totalExamsByModule(stats, "writing"), },
tooltip: "The amount of writing exams performed.", {
}, icon: (
{ <BsPen className="text-ielts-writing h-6 w-6 md:h-8 md:w-8" />
icon: <BsMegaphone className="text-ielts-speaking h-6 w-6 md:h-8 md:w-8" />, ),
label: "Speaking", label: "Writing",
value: totalExamsByModule(stats, "speaking"), value: totalExamsByModule(stats, "writing"),
tooltip: "The amount of speaking exams performed.", tooltip: "The amount of writing exams performed.",
}, },
{ {
icon: <BsClipboard className="text-ielts-level h-6 w-6 md:h-8 md:w-8" />, icon: (
label: "Level", <BsMegaphone className="text-ielts-speaking h-6 w-6 md:h-8 md:w-8" />
value: totalExamsByModule(stats, "level"), ),
tooltip: "The amount of level exams performed.", label: "Speaking",
}, value: totalExamsByModule(stats, "speaking"),
]} tooltip: "The amount of speaking exams performed.",
/> },
)} {
icon: (
<BsClipboard className="text-ielts-level h-6 w-6 md:h-8 md:w-8" />
),
label: "Level",
value: totalExamsByModule(stats, "level"),
tooltip: "The amount of level exams performed.",
},
]}
/>
)}
<section className="flex flex-col gap-3"> <section className="flex flex-col gap-3">
<span className="text-lg font-bold">About {capitalize(page)}</span> <span className="text-lg font-bold">About {capitalize(page)}</span>
<span className="text-mti-gray-taupe"> <span className="text-mti-gray-taupe">
{page === "exercises" && ( {page === "exercises" && (
<> <>
In the realm of language acquisition, practice makes perfect, and our exercises are the key to unlocking your full In the realm of language acquisition, practice makes perfect,
potential. Dive into a world of interactive and engaging exercises that cater to diverse learning styles. From grammar and our exercises are the key to unlocking your full potential.
drills that build a strong foundation to vocabulary challenges that broaden your lexicon, our exercises are carefully Dive into a world of interactive and engaging exercises that
designed to make learning English both enjoyable and effective. Whether you&apos;re looking to reinforce specific cater to diverse learning styles. From grammar drills that build
skills or embark on a holistic language journey, our exercises are your companions in the pursuit of excellence. a strong foundation to vocabulary challenges that broaden your
Embrace the joy of learning as you navigate through a variety of activities that cater to every facet of language lexicon, our exercises are carefully designed to make learning
acquisition. Your linguistic adventure starts here! English both enjoyable and effective. Whether you&apos;re
</> looking to reinforce specific skills or embark on a holistic
)} language journey, our exercises are your companions in the
{page === "exams" && ( pursuit of excellence. Embrace the joy of learning as you
<> navigate through a variety of activities that cater to every
Welcome to the heart of success on your English language journey! Our exams are crafted with precision to assess and facet of language acquisition. Your linguistic adventure starts
enhance your language skills. Each test is a passport to your linguistic prowess, designed to challenge and elevate here!
your abilities. Whether you&apos;re a beginner or a seasoned learner, our exams cater to all levels, providing a </>
comprehensive evaluation of your reading, writing, speaking, and listening skills. Prepare to embark on a journey of )}
self-discovery and language mastery as you navigate through our thoughtfully curated exams. Your success is not just a {page === "exams" && (
destination; it&apos;s a testament to your dedication and our commitment to empowering you with the English language. <>
</> Welcome to the heart of success on your English language
)} journey! Our exams are crafted with precision to assess and
</span> enhance your language skills. Each test is a passport to your
</section> linguistic prowess, designed to challenge and elevate your
abilities. Whether you&apos;re a beginner or a seasoned learner,
our exams cater to all levels, providing a comprehensive
evaluation of your reading, writing, speaking, and listening
skills. Prepare to embark on a journey of self-discovery and
language mastery as you navigate through our thoughtfully
curated exams. Your success is not just a destination; it&apos;s
a testament to your dedication and our commitment to empowering
you with the English language.
</>
)}
</span>
</section>
{sessions.length > 0 && ( {sessions.length > 0 && (
<section className="flex flex-col gap-3 md:gap-3"> <section className="flex flex-col gap-3 md:gap-3">
<div className="flex items-center gap-4"> <div className="flex items-center gap-4">
<div <div
onClick={reload} onClick={reload}
className="text-mti-purple-light hover:text-mti-purple-dark flex cursor-pointer items-center gap-2 transition duration-300 ease-in-out"> className="text-mti-purple-light hover:text-mti-purple-dark flex cursor-pointer items-center gap-2 transition duration-300 ease-in-out"
<span className="text-mti-black text-lg font-bold">Unfinished Sessions</span> >
<BsArrowRepeat className={clsx("text-xl", isLoading && "animate-spin")} /> <span className="text-mti-black text-lg font-bold">
</div> Unfinished Sessions
</div> </span>
<span className="text-mti-gray-taupe scrollbar-hide flex gap-8 overflow-x-scroll"> <BsArrowRepeat
{sessions className={clsx("text-xl", isLoading && "animate-spin")}
.sort((a, b) => moment(b.date).diff(moment(a.date))) />
.map((session) => ( </div>
<SessionCard session={session} key={session.sessionId} reload={reload} loadSession={loadSession} /> </div>
))} <span className="text-mti-gray-taupe scrollbar-hide flex gap-8 overflow-x-scroll">
</span> {sessions
</section> .sort((a, b) => moment(b.date).diff(moment(a.date)))
)} .map((session) => (
<SessionCard
session={session}
key={session.sessionId}
reload={reload}
loadSession={loadSession}
/>
))}
</span>
</section>
)}
<section className="-lg:flex-col -lg:items-center -lg:gap-12 mt-4 flex w-full justify-between gap-8"> <section className="-lg:flex-col -lg:items-center -lg:gap-12 mt-4 flex w-full justify-between gap-8">
<div <div
onClick={!disableSelection && !selectedModules.includes("level") ? () => toggleModule("reading") : undefined} onClick={
className={clsx( !disableSelection && !selectedModules.includes("level")
"bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out", ? () => toggleModule("reading")
selectedModules.includes("reading") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", : undefined
)}> }
<div className="bg-ielts-reading absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full"> className={clsx(
<BsBook className="h-7 w-7 text-white" /> "bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out",
</div> selectedModules.includes("reading") || disableSelection
<span className="font-semibold">Reading:</span> ? "border-mti-purple-light"
<p className="text-left text-xs"> : "border-mti-gray-platinum",
Expand your vocabulary, improve your reading comprehension and improve your ability to interpret texts in English. )}
</p> >
{!selectedModules.includes("reading") && !selectedModules.includes("level") && !disableSelection && ( <div className="bg-ielts-reading absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full">
<div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" /> <BsBook className="h-7 w-7 text-white" />
)} </div>
{(selectedModules.includes("reading") || disableSelection) && ( <span className="font-semibold">Reading:</span>
<BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" /> <p className="text-left text-xs">
)} Expand your vocabulary, improve your reading comprehension and
{selectedModules.includes("level") && <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />} improve your ability to interpret texts in English.
</div> </p>
<div {!selectedModules.includes("reading") &&
onClick={!disableSelection && !selectedModules.includes("level") ? () => toggleModule("listening") : undefined} !selectedModules.includes("level") &&
className={clsx( !disableSelection && (
"bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out", <div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" />
selectedModules.includes("listening") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", )}
)}> {(selectedModules.includes("reading") || disableSelection) && (
<div className="bg-ielts-listening absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full"> <BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" />
<BsHeadphones className="h-7 w-7 text-white" /> )}
</div> {selectedModules.includes("level") && (
<span className="font-semibold">Listening:</span> <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />
<p className="text-left text-xs"> )}
Improve your ability to follow conversations in English and your ability to understand different accents and intonations. </div>
</p> <div
{!selectedModules.includes("listening") && !selectedModules.includes("level") && !disableSelection && ( onClick={
<div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" /> !disableSelection && !selectedModules.includes("level")
)} ? () => toggleModule("listening")
{(selectedModules.includes("listening") || disableSelection) && ( : undefined
<BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" /> }
)} className={clsx(
{selectedModules.includes("level") && <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />} "bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out",
</div> selectedModules.includes("listening") || disableSelection
<div ? "border-mti-purple-light"
onClick={!disableSelection && !selectedModules.includes("level") ? () => toggleModule("writing") : undefined} : "border-mti-gray-platinum",
className={clsx( )}
"bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out", >
selectedModules.includes("writing") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", <div className="bg-ielts-listening absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full">
)}> <BsHeadphones className="h-7 w-7 text-white" />
<div className="bg-ielts-writing absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full"> </div>
<BsPen className="h-7 w-7 text-white" /> <span className="font-semibold">Listening:</span>
</div> <p className="text-left text-xs">
<span className="font-semibold">Writing:</span> Improve your ability to follow conversations in English and your
<p className="text-left text-xs"> ability to understand different accents and intonations.
Allow you to practice writing in a variety of formats, from simple paragraphs to complex essays. </p>
</p> {!selectedModules.includes("listening") &&
{!selectedModules.includes("writing") && !selectedModules.includes("level") && !disableSelection && ( !selectedModules.includes("level") &&
<div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" /> !disableSelection && (
)} <div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" />
{(selectedModules.includes("writing") || disableSelection) && ( )}
<BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" /> {(selectedModules.includes("listening") || disableSelection) && (
)} <BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" />
{selectedModules.includes("level") && <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />} )}
</div> {selectedModules.includes("level") && (
<div <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />
onClick={!disableSelection && !selectedModules.includes("level") ? () => toggleModule("speaking") : undefined} )}
className={clsx( </div>
"bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out", <div
selectedModules.includes("speaking") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", onClick={
)}> !disableSelection && !selectedModules.includes("level")
<div className="bg-ielts-speaking absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full"> ? () => toggleModule("writing")
<BsMegaphone className="h-7 w-7 text-white" /> : undefined
</div> }
<span className="font-semibold">Speaking:</span> className={clsx(
<p className="text-left text-xs"> "bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out",
You&apos;ll have access to interactive dialogs, pronunciation exercises and speech recordings. selectedModules.includes("writing") || disableSelection
</p> ? "border-mti-purple-light"
{!selectedModules.includes("speaking") && !selectedModules.includes("level") && !disableSelection && ( : "border-mti-gray-platinum",
<div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" /> )}
)} >
{(selectedModules.includes("speaking") || disableSelection) && ( <div className="bg-ielts-writing absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full">
<BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" /> <BsPen className="h-7 w-7 text-white" />
)} </div>
{selectedModules.includes("level") && <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />} <span className="font-semibold">Writing:</span>
</div> <p className="text-left text-xs">
{!disableSelection && ( Allow you to practice writing in a variety of formats, from simple
<div paragraphs to complex essays.
onClick={selectedModules.length === 0 || selectedModules.includes("level") ? () => toggleModule("level") : undefined} </p>
className={clsx( {!selectedModules.includes("writing") &&
"bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out", !selectedModules.includes("level") &&
selectedModules.includes("level") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", !disableSelection && (
)}> <div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" />
<div className="bg-ielts-level absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full"> )}
<BsClipboard className="h-7 w-7 text-white" /> {(selectedModules.includes("writing") || disableSelection) && (
</div> <BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" />
<span className="font-semibold">Level:</span> )}
<p className="text-left text-xs">You&apos;ll be able to test your english level with multiple choice questions.</p> {selectedModules.includes("level") && (
{!selectedModules.includes("level") && selectedModules.length === 0 && !disableSelection && ( <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />
<div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" /> )}
)} </div>
{(selectedModules.includes("level") || disableSelection) && ( <div
<BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" /> onClick={
)} !disableSelection && !selectedModules.includes("level")
{!selectedModules.includes("level") && selectedModules.length > 0 && ( ? () => toggleModule("speaking")
<BsXCircle className="text-mti-red-light mt-4 h-8 w-8" /> : undefined
)} }
</div> className={clsx(
)} "bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out",
</section> selectedModules.includes("speaking") || disableSelection
<div className="-md:flex-col -md:gap-4 -md:justify-center flex w-full items-center md:justify-between"> ? "border-mti-purple-light"
<div className="flex w-full flex-col items-center gap-3"> : "border-mti-gray-platinum",
<div )}
className="text-mti-gray-dim -md:justify-center flex w-full cursor-pointer items-center gap-3 text-sm" >
onClick={() => setAvoidRepeatedExams((prev) => !prev)}> <div className="bg-ielts-speaking absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full">
<input type="checkbox" className="hidden" /> <BsMegaphone className="h-7 w-7 text-white" />
<div </div>
className={clsx( <span className="font-semibold">Speaking:</span>
"border-mti-purple-light flex h-6 w-6 items-center justify-center rounded-md border bg-white", <p className="text-left text-xs">
"transition duration-300 ease-in-out", You&apos;ll have access to interactive dialogs, pronunciation
avoidRepeatedExams && "!bg-mti-purple-light ", exercises and speech recordings.
)}> </p>
<BsCheck color="white" className="h-full w-full" /> {!selectedModules.includes("speaking") &&
</div> !selectedModules.includes("level") &&
<span className="tooltip" data-tip="If possible, the platform will choose exams not yet done."> !disableSelection && (
Avoid Repeated Questions <div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" />
</span> )}
</div> {(selectedModules.includes("speaking") || disableSelection) && (
<div <BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" />
className="text-mti-gray-dim -md:justify-center flex w-full cursor-pointer items-center gap-3 text-sm" )}
onClick={() => setVariant((prev) => (prev === "full" ? "partial" : "full"))}> {selectedModules.includes("level") && (
<input type="checkbox" className="hidden" /> <BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />
<div )}
className={clsx( </div>
"border-mti-purple-light flex h-6 w-6 items-center justify-center rounded-md border bg-white", {!disableSelection && (
"transition duration-300 ease-in-out", <div
variant === "full" && "!bg-mti-purple-light ", onClick={
)}> selectedModules.length === 0 ||
<BsCheck color="white" className="h-full w-full" /> selectedModules.includes("level")
</div> ? () => toggleModule("level")
<span>Full length exams</span> : undefined
</div> }
</div> className={clsx(
<div className="tooltip w-full" data-tip={`Your screen size is too small to do ${page}`}> "bg-mti-white-alt relative flex w-64 max-w-xs cursor-pointer flex-col items-center gap-2 rounded-xl border p-5 pt-12 transition duration-300 ease-in-out",
<Button color="purple" className="w-full max-w-xs px-12 md:hidden" disabled> selectedModules.includes("level") || disableSelection
Start Exam ? "border-mti-purple-light"
</Button> : "border-mti-gray-platinum",
</div> )}
<Button >
onClick={() => <div className="bg-ielts-level absolute top-0 flex h-16 w-16 -translate-y-1/2 items-center justify-center rounded-full">
onStart( <BsClipboard className="h-7 w-7 text-white" />
!disableSelection ? selectedModules.sort(sortByModuleName) : ["reading", "listening", "writing", "speaking"], </div>
avoidRepeatedExams, <span className="font-semibold">Level:</span>
variant, <p className="text-left text-xs">
) You&apos;ll be able to test your english level with multiple
} choice questions.
color="purple" </p>
className="-md:hidden w-full max-w-xs px-12 md:self-end" {!selectedModules.includes("level") &&
disabled={selectedModules.length === 0 && !disableSelection}> selectedModules.length === 0 &&
Start Exam !disableSelection && (
</Button> <div className="border-mti-gray-platinum mt-4 h-8 w-8 rounded-full border" />
</div> )}
</div> {(selectedModules.includes("level") || disableSelection) && (
</> <BsCheckCircle className="text-mti-purple-light mt-4 h-8 w-8" />
); )}
{!selectedModules.includes("level") &&
selectedModules.length > 0 && (
<BsXCircle className="text-mti-red-light mt-4 h-8 w-8" />
)}
</div>
)}
</section>
<div className="-md:flex-col -md:gap-4 -md:justify-center flex w-full items-center md:justify-between">
<div className="flex w-full flex-col items-center gap-3">
<div
className="text-mti-gray-dim -md:justify-center flex w-full cursor-pointer items-center gap-3 text-sm"
onClick={() => setAvoidRepeatedExams((prev) => !prev)}
>
<input type="checkbox" className="hidden" />
<div
className={clsx(
"border-mti-purple-light flex h-6 w-6 items-center justify-center rounded-md border bg-white",
"transition duration-300 ease-in-out",
avoidRepeatedExams && "!bg-mti-purple-light ",
)}
>
<BsCheck color="white" className="h-full w-full" />
</div>
<span
className="tooltip"
data-tip="If possible, the platform will choose exams not yet done."
>
Avoid Repeated Questions
</span>
</div>
<div
className="text-mti-gray-dim -md:justify-center flex w-full cursor-pointer items-center gap-3 text-sm"
// onClick={() => setVariant((prev) => (prev === "full" ? "partial" : "full"))}>
>
<input type="checkbox" className="hidden" disabled />
<div
className={clsx(
"border-mti-purple-light flex h-6 w-6 items-center justify-center rounded-md border bg-white",
"transition duration-300 ease-in-out",
variant === "full" && "!bg-mti-purple-light ",
)}
>
<BsCheck color="white" className="h-full w-full" />
</div>
<span>Full length exams</span>
</div>
</div>
<div
className="tooltip w-full"
data-tip={`Your screen size is too small to do ${page}`}
>
<Button
color="purple"
className="w-full max-w-xs px-12 md:hidden"
disabled
>
Start Exam
</Button>
</div>
<Button
onClick={() =>
onStart(
!disableSelection
? selectedModules.sort(sortByModuleName)
: ["reading", "listening", "writing", "speaking"],
avoidRepeatedExams,
variant,
)
}
color="purple"
className="-md:hidden w-full max-w-xs px-12 md:self-end"
disabled={selectedModules.length === 0 && !disableSelection}
>
Start Exam
</Button>
</div>
</div>
</>
);
} }