From cb1a67de234933574ee8baf46afe9042b519f96b Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 12 Apr 2023 11:03:43 +0100 Subject: [PATCH] Removed unused pages --- src/pages/exam/listening/[id].tsx | 90 ----------------- src/pages/exam/reading/[id].tsx | 162 ------------------------------ 2 files changed, 252 deletions(-) delete mode 100644 src/pages/exam/listening/[id].tsx delete mode 100644 src/pages/exam/reading/[id].tsx diff --git a/src/pages/exam/listening/[id].tsx b/src/pages/exam/listening/[id].tsx deleted file mode 100644 index 060a49ea..00000000 --- a/src/pages/exam/listening/[id].tsx +++ /dev/null @@ -1,90 +0,0 @@ -import Navbar from "@/components/Navbar"; -import {ListeningExam} from "@/interfaces/exam"; -import Head from "next/head"; - -// TODO: Remove this import -import JSON_LISTENING from "@/demo/listening.json"; -import JSON_USER from "@/demo/user.json"; -import {useState} from "react"; -import Icon from "@mdi/react"; -import {mdiArrowRight} from "@mdi/js"; -import clsx from "clsx"; -import {infoButtonStyle} from "@/constants/buttonStyles"; -import {renderExercise} from "@/components/Exercises"; - -interface Props { - exam: ListeningExam; -} - -export const getServerSideProps = () => { - return { - props: { - exam: JSON_LISTENING, - }, - }; -}; - -export default function Listening({exam}: Props) { - const [exerciseIndex, setExerciseIndex] = useState(-1); - const [timesListened, setTimesListened] = useState(0); - - const nextExercise = () => { - setExerciseIndex((prev) => prev + 1); - }; - - const previousExercise = () => { - setExerciseIndex((prev) => prev - 1); - }; - - const renderAudioPlayer = () => ( - <> - {exerciseIndex === -1 && ( -
- Please listen to the following audio attentively. - {exam.audio.repeatableTimes > 0 ? ( - - You will only be allowed to listen to the audio {exam.audio.repeatableTimes} time(s). - - ) : ( - You may listen to the audio as many times as you would like. - )} -
- )} -
- {exam.audio.title} - {exam.audio.repeatableTimes > 0 && ( - <>{exam.audio.repeatableTimes <= timesListened && You are no longer allowed to listen to the audio again.} - )} - AUDIO WILL GO HERE -
- - ); - - return ( - <> - - Create Next App - - - - -
- -
- {renderAudioPlayer()} - {exerciseIndex > -1 && - exerciseIndex < exam.exercises.length && - renderExercise(exam.exercises[exerciseIndex], nextExercise, previousExercise)} - {exerciseIndex === -1 && ( - - )} -
-
- - ); -} diff --git a/src/pages/exam/reading/[id].tsx b/src/pages/exam/reading/[id].tsx deleted file mode 100644 index 1539d199..00000000 --- a/src/pages/exam/reading/[id].tsx +++ /dev/null @@ -1,162 +0,0 @@ -import Navbar from "@/components/Navbar"; -import {ReadingExam} from "@/interfaces/exam"; -import Head from "next/head"; - -// TODO: Remove this import -import JSON_READING from "@/demo/reading.json"; -import JSON_USER from "@/demo/user.json"; -import {Fragment, useState} from "react"; -import Icon from "@mdi/react"; -import {mdiArrowLeft, mdiArrowRight, mdiNotebook} from "@mdi/js"; -import clsx from "clsx"; -import {errorButtonStyle, infoButtonStyle} from "@/constants/buttonStyles"; -import {Dialog, Transition} from "@headlessui/react"; -import {renderExercise} from "@/components/Exercises"; - -interface Props { - exam: ReadingExam; -} - -export const getServerSideProps = () => { - return { - props: { - exam: JSON_READING, - }, - }; -}; - -function TextModal({isOpen, title, content, onClose}: {isOpen: boolean; title: string; content: string; onClose: () => void}) { - return ( - - - -
- - -
-
- - - - {title} - -
-

- {content.split("\n").map((line, index) => ( - - {line} -
-
- ))} -

-
- -
- -
-
-
-
-
-
-
- ); -} - -export default function Reading({exam}: Props) { - const [exerciseIndex, setExerciseIndex] = useState(-1); - const [showTextModal, setShowTextModal] = useState(false); - - const nextExercise = () => { - setExerciseIndex((prev) => prev + 1); - }; - - const previousExercise = () => { - setExerciseIndex((prev) => prev - 1); - }; - - const renderText = () => ( - <> -
- - Please read the following excerpt attentively, you will then be asked questions about the text you've read. - - You will be allowed to read the text while doing the exercises -
-
- {exam.text.title} - - {exam.text.content.split("\n").map((line, index) => ( - - {line} -
-
- ))} -
-
- - ); - - return ( - <> - - Create Next App - - - - -
- - setShowTextModal(false)} /> -
- {exerciseIndex === -1 && renderText()} - {exerciseIndex > -1 && - exerciseIndex < exam.exercises.length && - renderExercise(exam.exercises[exerciseIndex], nextExercise, previousExercise)} -
-1 ? "w-full justify-between" : "self-end")}> - {exerciseIndex > -1 && ( - - )} - {exerciseIndex === -1 && ( - - )} -
-
-
- - ); -}