Created a Finish screen for when a user finishes an exam

This commit is contained in:
Tiago Ribeiro
2023-04-11 22:08:25 +01:00
parent 49c515b02a
commit 503a265da0
3 changed files with 112 additions and 14 deletions

View File

@@ -17,6 +17,7 @@ import Listening from "@/exams/Listening";
import Writing from "@/exams/Writing";
import {ToastContainer} from "react-toastify";
import Link from "next/link";
import Finish from "@/exams/Finish";
export default function Home() {
const [selectedModules, setSelectedModules] = useState<Module[]>([]);
@@ -67,20 +68,15 @@ export default function Home() {
if (moduleIndex >= selectedModules.length) {
return (
<>
Finished!{" "}
<button
className="btn btn-wide"
onClick={() => {
setShowSolutions(true);
setModuleIndex(0);
}}>
View Solutions
</button>
<Link href="/">
<button className="btn btn-wide">Go Home</button>
</Link>
</>
<Finish
user={JSON_USER}
modules={selectedModules}
onViewResults={() => {
setShowSolutions(true);
setModuleIndex(0);
}}
scores={userSolutions.map((x) => ({...x.score, module: x.module}))}
/>
);
}