diff --git a/app/(tabs)/leaderboard/page.tsx b/app/(tabs)/leaderboard/page.tsx
index 18fa5d0..ed7d7d3 100644
--- a/app/(tabs)/leaderboard/page.tsx
+++ b/app/(tabs)/leaderboard/page.tsx
@@ -130,17 +130,19 @@ const page = () => {
className="flex bg-[#113768] rounded-[8] py-2 px-4 justify-between items-center"
>
-
+
{user.rank}
-
+
{user.name.charAt(0).toUpperCase()}
You
- {user.points}pt
+
+ {user.points}pt
+
))}
@@ -154,9 +156,9 @@ const page = () => {
className="flex border-2 border-[#c5dbf8] rounded-[8] py-2 px-4 justify-between items-center"
>
-
{idx + 1}
+
{idx + 1}
-
+
{user.name.charAt(0).toUpperCase()}
@@ -164,7 +166,7 @@ const page = () => {
{user.name.split(" ").slice(0, 2).join(" ")}
-
+
{user.points}pt
diff --git a/app/exam/pretest/page.tsx b/app/exam/pretest/page.tsx
index 04f7a01..0754219 100644
--- a/app/exam/pretest/page.tsx
+++ b/app/exam/pretest/page.tsx
@@ -82,10 +82,9 @@ export default function PretestPage() {
function handleStartExam() {
setCurrentExam(examData);
- startExam();
+ startExam(examData); // Pass examData directly
router.push(`/exam/${id}?time=${metadata?.metadata.duration}`);
}
-
return (
diff --git a/components/Header.tsx b/components/Header.tsx
index 887a762..6b30fed 100644
--- a/components/Header.tsx
+++ b/components/Header.tsx
@@ -110,7 +110,7 @@ const Header = ({
- Hello {userData?.name ? userData.name.split(" ")[0] : ""}
+ Hello, {userData?.name ? userData.name.split(" ")[0] : ""}
)}
diff --git a/components/QuestionItem.tsx b/components/QuestionItem.tsx
index ba18648..5fdaec1 100644
--- a/components/QuestionItem.tsx
+++ b/components/QuestionItem.tsx
@@ -30,16 +30,18 @@ const QuestionItem = (props: QuestionItemProps) => {
{question.id}. {question.question}
-
-
-
-
+ {isExam && (
+
+
+
+
+ )}
{isExam ? (
@@ -70,7 +72,7 @@ const QuestionItem = (props: QuestionItemProps) => {
})}
) : (
- <>
+
@@ -121,7 +123,7 @@ const QuestionItem = (props: QuestionItemProps) => {
Solution:
{question.solution}
- >
+
)}
);
diff --git a/context/ExamContext.tsx b/context/ExamContext.tsx
index c9af9e6..f219fbf 100644
--- a/context/ExamContext.tsx
+++ b/context/ExamContext.tsx
@@ -86,18 +86,21 @@ export const ExamProvider: React.FC<{ children: ReactNode }> = ({
setCurrentAttemptState(null);
};
- const startExam = () => {
- if (!currentExam) {
+ const startExam = (exam?: Exam) => {
+ const examToUse = exam || currentExam;
+
+ if (!examToUse) {
console.warn("No exam selected, redirecting to /unit");
router.push("/unit");
return;
}
const attempt: ExamAttempt = {
- examId: currentExam.id,
- exam: currentExam,
+ examId: examToUse.id,
+ exam: examToUse,
answers: [],
startTime: new Date(),
+ totalQuestions: 0,
};
setCurrentAttemptState(attempt);