/* eslint-disable @next/next/no-img-element */ import Head from "next/head"; import { withIronSessionSsr } from "iron-session/next"; import { sessionOptions } from "@/lib/session"; import useUser from "@/hooks/useUser"; import { toast, ToastContainer } from "react-toastify"; import Layout from "@/components/High/Layout"; import { shouldRedirectHome } from "@/utils/navigation.disabled"; import { useState } from "react"; import { Module } from "@/interfaces"; import { RadioGroup, Tab } from "@headlessui/react"; import clsx from "clsx"; import { MODULE_ARRAY } from "@/utils/moduleUtils"; import { capitalize } from "lodash"; import Button from "@/components/Low/Button"; import { Exercise, ReadingPart } from "@/interfaces/exam"; import Input from "@/components/Low/Input"; import axios from "axios"; import ReadingGeneration from "./(generation)/ReadingGeneration"; import ListeningGeneration from "./(generation)/ListeningGeneration"; import WritingGeneration from "./(generation)/WritingGeneration"; import LevelGeneration from "./(generation)/LevelGeneration"; import SpeakingGeneration from "./(generation)/SpeakingGeneration"; import { checkAccess, getTypesOfUser } from "@/utils/permissions"; export const getServerSideProps = withIronSessionSsr(({ req, res }) => { const user = req.session.user; if (!user || !user.isVerified) { return { redirect: { destination: "/login", permanent: false, }, }; } if ( shouldRedirectHome(user) || checkAccess(user, getTypesOfUser(["developer"])) ) { return { redirect: { destination: "/", permanent: false, }, }; } return { props: { user: req.session.user }, }; }, sessionOptions); export default function Generation() { const [module, setModule] = useState("reading"); const { user } = useUser({ redirectTo: "/login" }); return ( <> Exam Generation | EnCoach {user && (

Exam Generation

{[...MODULE_ARRAY].map((x) => ( {({ checked }) => ( {capitalize(x)} )} ))}
{module === "reading" && } {module === "listening" && } {module === "writing" && } {module === "speaking" && } {module === "level" && }
)} ); }