From f2249bbe1fb154c19cc9c350c4f08c8af025e4f7 Mon Sep 17 00:00:00 2001 From: Aman Bahuguna Date: Thu, 21 Nov 2024 11:47:26 +0530 Subject: [PATCH] adjusted buttons --- app/page.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 54b5e10..c6f77c8 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -25,7 +25,7 @@ export default function Home() { const fetchQuizCompletionStatus = async () => { try { - const response = await fetch(`${process.env.NEXT_PUBLIC_PROD_QUIZ_BACKEND_URL}sessions/user/${userId}/quiz-attempts`); + const response = await fetch(`${process.env.NEXT_PUBLIC_QUIZ_BACKEND_URL}sessions/user/${userId}/quiz-attempts`); const data = await response.json(); setQuizCompletionStatus(data); } catch (error) { @@ -178,11 +178,6 @@ export default function Home() {
{data.session.meta_data.test_format}
- {quizCompletionStatus.hasOwnProperty(data.session.platform_id) && !quizCompletionStatus[data.session.platform_id] && ( -
- Resume test -
- )} {renderButton(data.session)} @@ -224,13 +219,13 @@ export default function Home() { } } else if (data.platform === 'quiz') { if (minutesUntilSessionStart <= 5 && hasSessionNotEnded) { - const buttonText = quizCompletionStatus.hasOwnProperty(data.session_id) && !quizCompletionStatus[data.session_id] - ? "RESUME" - : "START"; - + const isResumeable = quizCompletionStatus.hasOwnProperty(data.platform_id) && !quizCompletionStatus[data.platform_id]; + const buttonText = isResumeable ? "RESUME" : "START"; + const buttonClass = isResumeable ? "bg-yellow-400 text-white" : "bg-primary text-white"; + return ( - + {buttonText}