diff --git a/src/components/Exercises/Writing.tsx b/src/components/Exercises/Writing.tsx
index b03811cb..6bd267f4 100644
--- a/src/components/Exercises/Writing.tsx
+++ b/src/components/Exercises/Writing.tsx
@@ -25,19 +25,19 @@ export default function Writing({
const hasExamEnded = useExamStore((state) => state.hasExamEnded);
- useEffect(() => {
- const listener = (e: KeyboardEvent) => {
- if ((e.ctrlKey || e.metaKey) && e.key === "v") {
- e.preventDefault();
- }
- };
+ // useEffect(() => {
+ // const listener = (e: KeyboardEvent) => {
+ // if ((e.ctrlKey || e.metaKey) && e.key === "v") {
+ // e.preventDefault();
+ // }
+ // };
- document.addEventListener("keydown", listener);
+ // document.addEventListener("keydown", listener);
- return () => {
- document.removeEventListener("keydown", listener);
- };
- }, []);
+ // return () => {
+ // document.removeEventListener("keydown", listener);
+ // };
+ // }, []);
useEffect(() => {
if (hasExamEnded) onNext({exercise: id, solutions: [{id, solution: inputText}], score: {correct: 1, total: 1, missing: 0}, type});
@@ -93,22 +93,8 @@ export default function Writing({
)}
-
- {prefix.split("\\n").map((line, index) => (
-
- {line}
-
-
- ))}
-
-
- {prompt.split("\\n").map((line, index) => (
-
- {line}
-
-
- ))}
-
+
{prefix}
+
{prompt}
{attachment && (
![]()
setIsModalOpen(true)}
@@ -120,14 +106,7 @@ export default function Writing({
-
- {suffix.split("\\n").map((line, index) => (
-
- {line}
-
-
- ))}
-
+ {suffix}
You should talk about the following things:
-
+
{prompts.map((x, index) => (
-
+
{solutionsURL.map((x, index) => (
+ className="w-full p-4 px-8 bg-transparent border-2 border-mti-gray-platinum rounded-2xl flex-col gap-8 items-center">
@@ -73,7 +75,7 @@ export default function InteractiveSpeaking({
))}
- {userSolutions && userSolutions.length > 0 && (
+ {userSolutions && userSolutions.length > 0 && userSolutions[0].evaluation && typeof userSolutions[0].evaluation !== "string" && (
{Object.keys(userSolutions[0].evaluation!.task_response).map((key) => (
@@ -82,9 +84,81 @@ export default function InteractiveSpeaking({
))}
-
- {userSolutions[0].evaluation!.comment}
-
+ {userSolutions[0].evaluation &&
+ Object.keys(userSolutions[0].evaluation).filter((x) => x.startsWith("perfect_answer")).length === 3 ? (
+
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-speaking/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-speaking focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-speaking",
+ )
+ }>
+ Evaluation
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-speaking/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-speaking focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-speaking",
+ )
+ }>
+ Recommended Answer (Prompt 1)
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-speaking/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-speaking focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-speaking",
+ )
+ }>
+ Recommended Answer (Prompt 2)
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-speaking/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-speaking focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-speaking",
+ )
+ }>
+ Recommended Answer (Prompt 3)
+
+
+
+
+ {userSolutions[0].evaluation!.comment}
+
+
+
+ {userSolutions[0].evaluation!.perfect_answer_1!.replaceAll(/\s{2,}/g, "\n\n")}
+
+
+
+
+ {userSolutions[0].evaluation!.perfect_answer_2!.replaceAll(/\s{2,}/g, "\n\n")}
+
+
+
+
+ {userSolutions[0].evaluation!.perfect_answer_3!.replaceAll(/\s{2,}/g, "\n\n")}
+
+
+
+
+ ) : (
+
+ {userSolutions[0].evaluation!.comment}
+
+ )}
)}
diff --git a/src/components/Solutions/Speaking.tsx b/src/components/Solutions/Speaking.tsx
index 2a8ebae4..ae5febaa 100644
--- a/src/components/Solutions/Speaking.tsx
+++ b/src/components/Solutions/Speaking.tsx
@@ -6,6 +6,8 @@ import Button from "../Low/Button";
import dynamic from "next/dynamic";
import axios from "axios";
import {speakingReverseMarking} from "@/utils/score";
+import {Tab} from "@headlessui/react";
+import clsx from "clsx";
const Waveform = dynamic(() => import("../Waveform"), {ssr: false});
@@ -69,7 +71,7 @@ export default function Speaking({id, type, title, video_url, text, prompts, use
{solutionURL &&
}
- {userSolutions && userSolutions.length > 0 && (
+ {userSolutions && userSolutions.length > 0 && userSolutions[0].evaluation && typeof userSolutions[0].evaluation !== "string" && (
{Object.keys(userSolutions[0].evaluation!.task_response).map((key) => (
@@ -78,9 +80,48 @@ export default function Speaking({id, type, title, video_url, text, prompts, use
))}
-
- {userSolutions[0].evaluation!.comment}
-
+ {userSolutions[0].evaluation && userSolutions[0].evaluation.perfect_answer ? (
+
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-speaking/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-speaking focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-speaking",
+ )
+ }>
+ Evaluation
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-speaking/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-speaking focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-speaking",
+ )
+ }>
+ Recommended Answer
+
+
+
+
+ {userSolutions[0].evaluation!.comment}
+
+
+
+ {userSolutions[0].evaluation!.perfect_answer.replaceAll(/\s{2,}/g, "\n\n")}
+
+
+
+
+ ) : (
+
+ {userSolutions[0].evaluation!.comment}
+
+ )}
)}
diff --git a/src/components/Solutions/Writing.tsx b/src/components/Solutions/Writing.tsx
index b64316da..c6557825 100644
--- a/src/components/Solutions/Writing.tsx
+++ b/src/components/Solutions/Writing.tsx
@@ -1,15 +1,11 @@
/* eslint-disable @next/next/no-img-element */
-import {errorButtonStyle, infoButtonStyle} from "@/constants/buttonStyles";
import {WritingExercise} from "@/interfaces/exam";
-import {mdiArrowLeft, mdiArrowRight} from "@mdi/js";
-import Icon from "@mdi/react";
-import clsx from "clsx";
import {CommonProps} from ".";
-import {Fragment, useEffect, useState} from "react";
-import {toast} from "react-toastify";
+import {Fragment, useState} from "react";
import Button from "../Low/Button";
-import {Dialog, Transition} from "@headlessui/react";
+import {Dialog, Tab, Transition} from "@headlessui/react";
import {writingReverseMarking} from "@/utils/score";
+import clsx from "clsx";
export default function Writing({id, type, prompt, attachment, userSolutions, onNext, onBack}: WritingExercise & CommonProps) {
const [isModalOpen, setIsModalOpen] = useState(false);
@@ -79,7 +75,7 @@ export default function Writing({id, type, prompt, attachment, userSolutions, on
/>
)}
- {userSolutions && userSolutions.length > 0 && (
+ {userSolutions && userSolutions.length > 0 && userSolutions[0].evaluation && typeof userSolutions[0].evaluation !== "string" && (
{Object.keys(userSolutions[0].evaluation!.task_response).map((key) => (
@@ -88,9 +84,48 @@ export default function Writing({id, type, prompt, attachment, userSolutions, on
))}
-
- {userSolutions[0].evaluation!.comment}
-
+ {userSolutions[0].evaluation && userSolutions[0].evaluation.perfect_answer ? (
+
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-writing/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-writing focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-writing",
+ )
+ }>
+ Evaluation
+
+
+ clsx(
+ "w-full rounded-lg py-2.5 text-sm font-medium leading-5 text-ielts-writing/80",
+ "ring-white ring-opacity-60 ring-offset-2 ring-offset-ielts-writing focus:outline-none focus:ring-2",
+ "transition duration-300 ease-in-out",
+ selected ? "bg-white shadow" : "text-blue-100 hover:bg-white/[0.12] hover:text-ielts-writing",
+ )
+ }>
+ Recommended Answer
+
+
+
+
+ {userSolutions[0].evaluation!.comment}
+
+
+
+ {userSolutions[0].evaluation!.perfect_answer.replaceAll(/\s{2,}/g, "\n\n")}
+
+
+
+
+ ) : (
+
+ {userSolutions[0].evaluation!.comment}
+
+ )}
)}
diff --git a/src/interfaces/exam.ts b/src/interfaces/exam.ts
index b4197e3a..f25cdfbb 100644
--- a/src/interfaces/exam.ts
+++ b/src/interfaces/exam.ts
@@ -92,6 +92,17 @@ export interface Evaluation {
overall: number;
task_response: {[key: string]: number};
}
+
+interface InteractiveSpeakingEvaluation extends Evaluation {
+ perfect_answer_1?: string;
+ perfect_answer_2?: string;
+ perfect_answer_3?: string;
+}
+
+interface CommonEvaluation extends Evaluation {
+ perfect_answer?: string;
+}
+
export interface WritingExercise {
id: string;
type: "writing";
@@ -106,7 +117,7 @@ export interface WritingExercise {
userSolutions: {
id: string;
solution: string;
- evaluation?: Evaluation;
+ evaluation?: CommonEvaluation;
}[];
}
@@ -120,7 +131,7 @@ export interface SpeakingExercise {
userSolutions: {
id: string;
solution: string;
- evaluation?: Evaluation;
+ evaluation?: CommonEvaluation;
}[];
}
@@ -133,7 +144,7 @@ export interface InteractiveSpeakingExercise {
userSolutions: {
id: string;
solution: {question: string; answer: string}[];
- evaluation?: Evaluation;
+ evaluation?: InteractiveSpeakingEvaluation;
}[];
}