/* eslint-disable @next/next/no-img-element */ import {useState} from "react"; import {Module} from "@/interfaces"; import clsx from "clsx"; import {User} from "@/interfaces/user"; import ProgressBar from "@/components/Low/ProgressBar"; import {BsBook, BsCheckCircle, BsHeadphones, BsMegaphone, BsPen} from "react-icons/bs"; import {totalExamsByModule} from "@/utils/stats"; import useStats from "@/hooks/useStats"; import Button from "@/components/Low/Button"; import {calculateAverageLevel} from "@/utils/score"; import {sortByModuleName} from "@/utils/moduleUtils"; interface Props { user: User; onStart: (modules: Module[]) => void; disableSelection?: boolean; } export default function Selection({user, onStart, disableSelection = false}: Props) { const [selectedModules, setSelectedModules] = useState([]); const {stats} = useStats(user?.id); const toggleModule = (module: Module) => { const modules = selectedModules.filter((x) => x !== module); setSelectedModules((prev) => (prev.includes(module) ? modules : [...modules, module])); }; return ( <>
{user.name}

{user.name}

{user.type}
{totalExamsByModule(stats, "reading")} Reading
{totalExamsByModule(stats, "listening")} Listening
{totalExamsByModule(stats, "writing")} Writing
{totalExamsByModule(stats, "speaking")} Speaking
About Exams This comprehensive test will assess your proficiency in reading, listening, writing, and speaking English. Be prepared to dive into a variety of interesting and challenging topics while showcasing your ability to communicate effectively in English. Master the vocabulary, grammar, and interpretation skills required to succeed in this high-level exam. Are you ready to demonstrate your mastery of the English language to the world?
toggleModule("reading") : undefined} className={clsx( "relative w-fit max-w-xs flex flex-col items-center bg-mti-white-alt transition duration-300 ease-in-out border p-5 rounded-xl gap-2 pt-12 cursor-pointer", selectedModules.includes("reading") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", )}>
Reading:

Expand your vocabulary, improve your reading comprehension and improve your ability to interpret texts in English.

{!selectedModules.includes("reading") && !disableSelection && (
)} {(selectedModules.includes("reading") || disableSelection) && ( )}
toggleModule("listening") : undefined} className={clsx( "relative w-fit max-w-xs flex flex-col items-center bg-mti-white-alt transition duration-300 ease-in-out border p-5 rounded-xl gap-2 pt-12 cursor-pointer", selectedModules.includes("listening") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", )}>
Listening:

Improve your ability to follow conversations in English and your ability to understand different accents and intonations.

{!selectedModules.includes("listening") && !disableSelection && (
)} {(selectedModules.includes("listening") || disableSelection) && ( )}
toggleModule("writing") : undefined} className={clsx( "relative w-fit max-w-xs flex flex-col items-center bg-mti-white-alt transition duration-300 ease-in-out border p-5 rounded-xl gap-2 pt-12 cursor-pointer", selectedModules.includes("writing") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", )}>
Writing:

Allow you to practice writing in a variety of formats, from simple paragraphs to complex essays.

{!selectedModules.includes("writing") && !disableSelection && (
)} {(selectedModules.includes("writing") || disableSelection) && ( )}
toggleModule("speaking") : undefined} className={clsx( "relative w-fit max-w-xs flex flex-col items-center bg-mti-white-alt transition duration-300 ease-in-out border p-5 rounded-xl gap-2 pt-12 cursor-pointer", selectedModules.includes("speaking") || disableSelection ? "border-mti-purple-light" : "border-mti-gray-platinum", )}>
Speaking:

You'll have access to interactive dialogs, pronunciation exercises and speech recordings.

{!selectedModules.includes("speaking") && !disableSelection && (
)} {(selectedModules.includes("speaking") || disableSelection) && ( )}
); }