diff --git a/src/components/Low/Button.tsx b/src/components/Low/Button.tsx index 9bd207f0..0adcd018 100644 --- a/src/components/Low/Button.tsx +++ b/src/components/Low/Button.tsx @@ -4,7 +4,7 @@ import {BsArrowRepeat} from "react-icons/bs"; interface Props { children: ReactNode; - color?: "rose" | "purple" | "red" | "green" | "gray"; + color?: "rose" | "purple" | "red" | "green" | "gray" | "pink"; variant?: "outline" | "solid"; className?: string; disabled?: boolean; @@ -49,6 +49,11 @@ export default function Button({ outline: "bg-transparent text-mti-rose-light border border-mti-rose-light hover:bg-mti-rose-light disabled:text-mti-rose disabled:bg-mti-rose-ultralight disabled:border-none selection:bg-mti-rose-dark hover:text-white selection:text-white", }, + pink: { + solid: "bg-ielts-speaking text-white border border-ielts-speaking hover:bg-ielts-speaking disabled:text-ielts-speaking disabled:bg-ielts-speaking-transparent selection:bg-ielts-speaking", + outline: + "bg-transparent text-ielts-speaking border border-ielts-speaking hover:bg-ielts-speaking disabled:text-ielts-speaking disabled:bg-ielts-speaking-transparent disabled:border-none selection:bg-ielts-speaking hover:text-white selection:text-white", + }, }; return ( diff --git a/src/components/Solutions/InteractiveSpeaking.tsx b/src/components/Solutions/InteractiveSpeaking.tsx index 3495b905..4293096b 100644 --- a/src/components/Solutions/InteractiveSpeaking.tsx +++ b/src/components/Solutions/InteractiveSpeaking.tsx @@ -8,6 +8,8 @@ import axios from "axios"; import {speakingReverseMarking} from "@/utils/score"; import {Tab} from "@headlessui/react"; import clsx from "clsx"; +import Modal from "../Modal"; +import ReactDiffViewer, {DiffMethod} from "react-diff-viewer"; const Waveform = dynamic(() => import("../Waveform"), {ssr: false}); @@ -22,6 +24,7 @@ export default function InteractiveSpeaking({ onBack, }: InteractiveSpeakingExercise & CommonProps) { const [solutionsURL, setSolutionsURL] = useState([]); + const [diffNumber, setDiffNumber] = useState<0 | 1 | 2 | 3>(0); useEffect(() => { if (userSolutions && userSolutions.length > 0) { @@ -42,6 +45,44 @@ export default function InteractiveSpeaking({ return ( <> + setDiffNumber(0)}> + <> + {userSolutions && + userSolutions.length > 0 && + diffNumber !== 0 && + userSolutions[0].evaluation && + userSolutions[0].evaluation[`transcript_${diffNumber}`] && + userSolutions[0].evaluation[`fixed_text_${diffNumber}`] && ( +
+
+ Transcript + Recommended Improvements +
+ +
+ )} + +
+
@@ -67,10 +108,23 @@ export default function InteractiveSpeaking({ {solutionsURL.map((x, index) => (
+ className="w-full p-4 px-8 bg-transparent border-2 border-mti-gray-platinum rounded-2xl flex flex-col gap-4">
+ {userSolutions && + userSolutions.length > 0 && + userSolutions[0].evaluation && + userSolutions[0].evaluation[`transcript_${(index + 1) as 1 | 2 | 3}`] && + userSolutions[0].evaluation[`fixed_text_${(index + 1) as 1 | 2 | 3}`] && ( + + )}
))}
diff --git a/src/components/Solutions/Speaking.tsx b/src/components/Solutions/Speaking.tsx index 8447b8e3..128750e8 100644 --- a/src/components/Solutions/Speaking.tsx +++ b/src/components/Solutions/Speaking.tsx @@ -8,11 +8,15 @@ import axios from "axios"; import {speakingReverseMarking} from "@/utils/score"; import {Tab} from "@headlessui/react"; import clsx from "clsx"; +import Modal from "../Modal"; +import {BsQuestionCircleFill} from "react-icons/bs"; +import ReactDiffViewer, {DiffMethod} from "react-diff-viewer"; const Waveform = dynamic(() => import("../Waveform"), {ssr: false}); export default function Speaking({id, type, title, video_url, text, prompts, userSolutions, onNext, onBack}: SpeakingExercise & CommonProps) { const [solutionURL, setSolutionURL] = useState(); + const [showDiff, setShowDiff] = useState(false); useEffect(() => { if (userSolutions && userSolutions.length > 0) { @@ -25,8 +29,48 @@ export default function Speaking({id, type, title, video_url, text, prompts, use } }, [userSolutions]); + useEffect(() => { + console.log(userSolutions); + }, [userSolutions]); + return ( <> + setShowDiff(false)}> + <> + {userSolutions && + userSolutions.length > 0 && + userSolutions[0].evaluation?.transcript_1 && + userSolutions[0].evaluation?.fixed_text_1 && ( +
+
+ Transcript + Recommended Improvements +
+ +
+ )} + +
+
@@ -65,10 +109,19 @@ export default function Speaking({id, type, title, video_url, text, prompts, use
-
-
+
+
{solutionURL && } + + {userSolutions && + userSolutions.length > 0 && + userSolutions[0].evaluation?.transcript_1 && + userSolutions[0].evaluation?.fixed_text_1 && ( + + )}
{userSolutions && userSolutions.length > 0 && userSolutions[0].evaluation && typeof userSolutions[0].evaluation !== "string" && ( diff --git a/src/interfaces/exam.ts b/src/interfaces/exam.ts index bd4802c7..ee08f0f5 100644 --- a/src/interfaces/exam.ts +++ b/src/interfaces/exam.ts @@ -103,13 +103,24 @@ export interface Evaluation { interface InteractiveSpeakingEvaluation extends Evaluation { perfect_answer_1?: string; + transcript_1?: string; + fixed_text_1?: string; perfect_answer_2?: string; + transcript_2?: string; + fixed_text_2?: string; perfect_answer_3?: string; + transcript_3?: string; + fixed_text_3?: string; +} + +interface SpeakingEvaluation extends CommonEvaluation { + perfect_answer_1?: string; + transcript_1?: string; + fixed_text_1?: string; } interface CommonEvaluation extends Evaluation { perfect_answer?: string; - perfect_answer_1?: string; fixed_text?: string; } @@ -141,7 +152,7 @@ export interface SpeakingExercise { userSolutions: { id: string; solution: string; - evaluation?: CommonEvaluation; + evaluation?: SpeakingEvaluation; }[]; }