115 lines
4.4 KiB
TypeScript
115 lines
4.4 KiB
TypeScript
/* eslint-disable @next/next/no-img-element */
|
|
import Head from "next/head";
|
|
import Navbar from "@/components/Navbar";
|
|
import Icon from "@mdi/react";
|
|
import {mdiAccountVoice, mdiArrowLeft, mdiArrowRight, mdiBookOpen, mdiHeadphones, mdiPen} from "@mdi/js";
|
|
import {useState} from "react";
|
|
import {Module} from "@/interfaces";
|
|
import clsx from "clsx";
|
|
import {useRouter} from "next/router";
|
|
import {errorButtonStyle, infoButtonStyle} from "@/constants/buttonStyles";
|
|
import ProfileLevel from "@/components/ProfileLevel";
|
|
|
|
// TODO: Remove this import
|
|
import JSON_USER from "@/demo/user.json";
|
|
|
|
export default function Home() {
|
|
const [selectedModules, setSelectedModules] = useState<Module[]>([]);
|
|
const router = useRouter();
|
|
|
|
const toggleModule = (module: Module) => {
|
|
const modules = selectedModules.filter((x) => x !== module);
|
|
setSelectedModules((prev) => (prev.includes(module) ? modules : [...modules, module]));
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>Create Next App</title>
|
|
<meta name="description" content="Generated by create next app" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<link rel="icon" href="/favicon.ico" />
|
|
</Head>
|
|
<main className="w-full h-screen flex flex-col items-center bg-white text-black">
|
|
<Navbar profilePicture={JSON_USER.profilePicture} />
|
|
<div className="w-full h-full relative">
|
|
<section className="h-full w-full flex flex-col items-center justify-center">
|
|
{/* //TODO: Change this section to work with the user account */}
|
|
<ProfileLevel user={JSON_USER} className="h-1/2" />
|
|
<div className="h-1/2 flex flex-col">
|
|
<div className="h-1/2 flex gap-8">
|
|
<div
|
|
role="button"
|
|
tabIndex={0}
|
|
onClick={() => toggleModule("reading")}
|
|
className={clsx(
|
|
"flex flex-col gap-2 items-center justify-center",
|
|
"border-ielts-reading hover:bg-ielts-reading text-white",
|
|
"border-2 rounded-xl p-4 h-fit w-48 cursor-pointer",
|
|
selectedModules.includes("reading") ? "bg-ielts-reading " : "bg-ielts-reading-transparent ",
|
|
)}>
|
|
<Icon path={mdiBookOpen} color="white" size={3} />
|
|
<span>Reading</span>
|
|
</div>
|
|
<div
|
|
role="button"
|
|
tabIndex={0}
|
|
onClick={() => toggleModule("listening")}
|
|
className={clsx(
|
|
"flex flex-col gap-2 items-center justify-center",
|
|
"border-ielts-listening hover:bg-ielts-listening text-white",
|
|
"border-2 rounded-xl p-4 h-fit w-48 cursor-pointer",
|
|
selectedModules.includes("listening") ? "bg-ielts-listening " : "bg-ielts-listening-transparent ",
|
|
)}>
|
|
<Icon path={mdiHeadphones} color="white" size={3} />
|
|
<span>Listening</span>
|
|
</div>
|
|
<div
|
|
role="button"
|
|
tabIndex={0}
|
|
onClick={() => toggleModule("speaking")}
|
|
className={clsx(
|
|
"flex flex-col gap-2 items-center justify-center",
|
|
"border-ielts-speaking hover:bg-ielts-speaking text-white",
|
|
"border-2 rounded-xl p-4 h-fit w-48 cursor-pointer",
|
|
selectedModules.includes("speaking") ? "bg-ielts-speaking " : "bg-ielts-speaking-transparent ",
|
|
)}>
|
|
<Icon path={mdiAccountVoice} color="white" size={3} />
|
|
<span>Speaking</span>
|
|
</div>
|
|
<div
|
|
role="button"
|
|
tabIndex={0}
|
|
onClick={() => toggleModule("writing")}
|
|
className={clsx(
|
|
"flex flex-col gap-2 items-center justify-center",
|
|
"border-ielts-writing hover:bg-ielts-writing text-white",
|
|
"border-2 rounded-xl p-4 h-fit w-48 cursor-pointer",
|
|
selectedModules.includes("writing") ? "bg-ielts-writing " : "bg-ielts-writing-transparent ",
|
|
)}>
|
|
<Icon path={mdiPen} color="white" size={3} />
|
|
<span>Writing</span>
|
|
</div>
|
|
</div>
|
|
<div className="w-full flex justify-between">
|
|
<button onClick={() => router.push("/")} className={clsx("btn btn-wide gap-4 relative text-white", errorButtonStyle)}>
|
|
<div className="absolute left-4">
|
|
<Icon path={mdiArrowLeft} color="white" size={1} />
|
|
</div>
|
|
Back
|
|
</button>
|
|
<button className={clsx("btn btn-wide gap-4 relative text-white", infoButtonStyle)}>
|
|
Start
|
|
<div className="absolute right-4">
|
|
<Icon path={mdiArrowRight} color="white" size={1} />
|
|
</div>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</main>
|
|
</>
|
|
);
|
|
}
|