Made some of the code a bit more responsive
This commit is contained in:
@@ -57,7 +57,7 @@ export default function Page({user}: {user: User}) {
|
||||
useEffect(() => {
|
||||
if (exam) {
|
||||
setTimer(exam.minTimer * 60);
|
||||
const timerInterval = setInterval(() => setTimer((prev) => prev && prev - 1), 1000);
|
||||
const timerInterval = setInterval(() => setTimer((prev) => (prev && prev > 0 ? prev - 1 : 0)), 1000);
|
||||
|
||||
return () => {
|
||||
clearInterval(timerInterval);
|
||||
@@ -158,9 +158,9 @@ export default function Page({user}: {user: User}) {
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
</Head>
|
||||
<main className="w-full h-full md:h-screen flex flex-col items-center bg-neutral-100 text-black">
|
||||
<ToastContainer />
|
||||
<Navbar profilePicture={user.profilePicture} timer={exam && timer} />
|
||||
<ToastContainer />
|
||||
<main className="w-full h-full min-h-[100vh] flex flex-col items-center bg-neutral-100 text-black pb-4 gap-4">
|
||||
<Navbar profilePicture={user.profilePicture} timer={exam ? timer : undefined} />
|
||||
{renderScreen()}
|
||||
</main>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user