Skip to content

Commit

Permalink
adjusted buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahugunajii committed Nov 21, 2024
1 parent 36550d5 commit f2249bb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -178,11 +178,6 @@ export default function Home() {
<div className="text-sm md:text-base">
<span>{data.session.meta_data.test_format}</span>
</div>
{quizCompletionStatus.hasOwnProperty(data.session.platform_id) && !quizCompletionStatus[data.session.platform_id] && (
<div className="text-yellow-600 text-xs mt-1">
Resume test
</div>
)}
</div>
{renderButton(data.session)}
</div>
Expand Down Expand Up @@ -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 (
<Link href={`${portalBaseUrl}/?sessionId=${data.session_id}`} target="_blank">
<PrimaryButton className="bg-primary text-white text-sm rounded-lg w-16 h-8 mr-4 shadow-md shadow-slate-400">
<PrimaryButton className={`${buttonClass} text-sm rounded-lg w-20 h-8 mr-4 shadow-md shadow-slate-400`}>
{buttonText}
</PrimaryButton>
</Link>
Expand Down

0 comments on commit f2249bb

Please sign in to comment.