diff --git a/src/components/Diagnostic.tsx b/src/components/Diagnostic.tsx
index d2ec222a..434f1159 100644
--- a/src/components/Diagnostic.tsx
+++ b/src/components/Diagnostic.tsx
@@ -4,12 +4,16 @@ import {Module} from "@/interfaces";
import {User} from "@/interfaces/user";
import useExamStore from "@/stores/examStore";
import {getExamById} from "@/utils/exams";
+import {writingMarking} from "@/utils/score";
+import {Menu} from "@headlessui/react";
import axios from "axios";
import clsx from "clsx";
import {capitalize} from "lodash";
import {useRouter} from "next/router";
import {useState} from "react";
+import {BsBook, BsChevronDown, BsHeadphones, BsMegaphone, BsPen, BsQuestionSquare} from "react-icons/bs";
import {toast} from "react-toastify";
+import Button from "./Low/Button";
interface Props {
user: User;
@@ -25,8 +29,7 @@ const DIAGNOSTIC_EXAMS = [
export default function Diagnostic({onFinish}: Props) {
const [focus, setFocus] = useState<"academic" | "general">();
- const [isInsert, setIsInsert] = useState(false);
- const [levels, setLevels] = useState({reading: 0, listening: 0, writing: 0, speaking: 0});
+ const [levels, setLevels] = useState({reading: -1, listening: -1, writing: -1, speaking: -1});
const [desiredLevels, setDesiredLevels] = useState({reading: 9, listening: 9, writing: 9, speaking: 9});
const router = useRouter();
@@ -34,6 +37,16 @@ export default function Diagnostic({onFinish}: Props) {
const setExams = useExamStore((state) => state.setExams);
const setSelectedModules = useExamStore((state) => state.setSelectedModules);
+ const isNextDisabled = () => {
+ if (!focus) return true;
+ if (levels.reading === -1) return true;
+ if (levels.listening === -1) return true;
+ if (levels.writing === -1) return true;
+ if (levels.speaking === -1) return true;
+
+ return false;
+ };
+
const selectExam = () => {
const examPromises = DIAGNOSTIC_EXAMS.map((exam) => getExamById(exam[0] as Module, exam[1]));
@@ -55,65 +68,143 @@ export default function Diagnostic({onFinish}: Props) {
});
};
- if (!focus) {
- return (
-
-
What is your focus?
-
-
-
-
-
- );
- }
-
- if (isInsert) {
- return (
-
-
What is your level?
-
- {Object.keys(levels).map((module) => (
-
- {capitalize(module)}
- setLevels((prev) => ({...prev, [module]: parseFloat(e.target.value)}))}
- />
-
- ))}
-
-
-
- );
- }
-
return (
-
-
What is your current IELTS level?
-
-
-
+
+
+
What is your current focus?
+
+
+
+
+
+
+
+
+
What is your current IELTS level?
+
+
+
+
+ Reading level
+
+
+
+
+
+ Listening level
+
+
+
+
+
+ Writing level
+
+
+
+
+
+ Speaking level
+
+
+
+
+
+
+
+
+
+
);
diff --git a/src/components/High/Layout.tsx b/src/components/High/Layout.tsx
index 847b7b96..1f495990 100644
--- a/src/components/High/Layout.tsx
+++ b/src/components/High/Layout.tsx
@@ -8,16 +8,17 @@ interface Props {
user: User;
children: React.ReactNode;
className?: string;
+ navDisabled?: boolean;
}
-export default function Layout({user, children, className}: Props) {
+export default function Layout({user, children, className, navDisabled = false}: Props) {
const router = useRouter();
return (
-
+
-
+
EnCoach
-
+
{user.name}
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index a076e496..4e5ccf43 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -11,6 +11,7 @@ import axios from "axios";
interface Props {
path: string;
+ navDisabled?: boolean;
}
interface NavProps {
@@ -18,11 +19,12 @@ interface NavProps {
label: string;
path: string;
keyPath: string;
+ disabled?: boolean;
}
-const Nav = ({Icon, label, path, keyPath}: NavProps) => (
+const Nav = ({Icon, label, path, keyPath, disabled = false}: NavProps) => (
(
);
-export default function Sidebar({path}: Props) {
+export default function Sidebar({path, navDisabled = false}: Props) {
const router = useRouter();
const logout = async () => {
@@ -44,11 +46,11 @@ export default function Sidebar({path}: Props) {
return (
-
-
-
-
-
+
+
+
+
+
-
+
setShowDiagnostics(false)} />
-
+
>
);
}
diff --git a/src/utils/score.ts b/src/utils/score.ts
index 52230acf..53fb3a29 100644
--- a/src/utils/score.ts
+++ b/src/utils/score.ts
@@ -46,7 +46,7 @@ export const speakingReverseMarking: {[key: number]: number} = {
0: 0,
};
-const writingMarking: {[key: number]: number} = {
+export const writingMarking: {[key: number]: number} = {
90: 9,
80: 8,
70: 7,