Navigation rework, added prompt edit to components that were missing
This commit is contained in:
@@ -3,12 +3,11 @@ import ModuleTitle from "@/components/Medium/ModuleTitle";
|
||||
import { moduleResultText } from "@/constants/ielts";
|
||||
import { Module } from "@/interfaces";
|
||||
import { User } from "@/interfaces/user";
|
||||
import useExamStore from "@/stores/examStore";
|
||||
import useExamStore from "@/stores/exam";
|
||||
import { calculateBandScore, getGradingLabel } from "@/utils/score";
|
||||
import clsx from "clsx";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { Fragment, useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
BsArrowCounterclockwise,
|
||||
BsBan,
|
||||
@@ -56,9 +55,9 @@ export default function Finish({ user, scores, modules, information, solutions,
|
||||
const [selectedModule, setSelectedModule] = useState(modules[0]);
|
||||
const [selectedScore, setSelectedScore] = useState<Score>(scores.find((x) => x.module === modules[0])!);
|
||||
const [isExtraInformationOpen, setIsExtraInformationOpen] = useState(false);
|
||||
const {selectedModules, exams, dispatch} = useExamStore((s) => s);
|
||||
|
||||
const aiUsage = Math.round(ai_usage(solutions) * 100);
|
||||
const exams = useExamStore((state) => state.exams);
|
||||
const { gradingSystem } = useGradingSystem();
|
||||
|
||||
const router = useRouter()
|
||||
@@ -112,6 +111,11 @@ export default function Finish({ user, scores, modules, information, solutions,
|
||||
return <span className="text-3xl font-bold">{level}</span>;
|
||||
};
|
||||
|
||||
const handlePlayAgain = () => {
|
||||
dispatch({type: "INIT_EXAM", payload: {exams, modules: selectedModules}})
|
||||
router.push(destination || "/exam")
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal title="Extra Information" isOpen={isExtraInformationOpen} onClose={() => setIsExtraInformationOpen(false)}>
|
||||
@@ -135,6 +139,7 @@ export default function Finish({ user, scores, modules, information, solutions,
|
||||
totalExercises={getTotalExercises()}
|
||||
exerciseIndex={getTotalExercises()}
|
||||
minTimer={exams.find((x) => x.module === selectedModule)!.minTimer}
|
||||
preview={false}
|
||||
disableTimer
|
||||
/>
|
||||
<div className="flex gap-4 self-start w-full">
|
||||
@@ -289,7 +294,7 @@ export default function Finish({ user, scores, modules, information, solutions,
|
||||
<div className="flex gap-8">
|
||||
<div className="flex w-fit cursor-pointer flex-col items-center gap-1">
|
||||
<button
|
||||
onClick={() => router.push(destination || "/exam")}
|
||||
onClick={handlePlayAgain}
|
||||
disabled={!!assignment}
|
||||
className="bg-mti-purple-light hover:bg-mti-purple flex h-11 w-11 items-center justify-center rounded-full transition duration-300 ease-in-out">
|
||||
<BsArrowCounterclockwise className="h-7 w-7 text-white" />
|
||||
|
||||
Reference in New Issue
Block a user