Fix UI issues, timer logic, theme switcher, view solutions, and markdown rendering
This commit is contained in:
@@ -18,10 +18,11 @@ interface ExamAttemptPayload {
|
||||
|
||||
interface ExamResultProps {
|
||||
payload: ExamAttemptPayload;
|
||||
attemptId: string | null;
|
||||
onRetake: () => void;
|
||||
}
|
||||
|
||||
export function ExamResult({ payload, onRetake }: ExamResultProps) {
|
||||
export function ExamResult({ payload, attemptId, onRetake }: ExamResultProps) {
|
||||
const router = useRouter();
|
||||
const answered = payload.answers.filter(a => a.selected_answer !== null).length;
|
||||
const unanswered = payload.total_questions - answered;
|
||||
@@ -115,6 +116,25 @@ export function ExamResult({ payload, onRetake }: ExamResultProps) {
|
||||
<Button variant="outline" size="lg" className="rounded-xl h-14 px-8 font-bold text-lg gap-2" onClick={onRetake}>
|
||||
<RotateCcw className="size-5" /> Retake Mock Test
|
||||
</Button>
|
||||
{attemptId && (
|
||||
<Button
|
||||
variant="default"
|
||||
size="lg"
|
||||
className="rounded-xl h-14 px-8 font-bold text-lg bg-indigo-600 hover:bg-indigo-700 text-white gap-2 w-full sm:w-auto"
|
||||
onClick={async () => {
|
||||
try {
|
||||
if (document.fullscreenElement) {
|
||||
await document.exitFullscreen();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Error exiting fullscreen", err);
|
||||
}
|
||||
router.push(`/dashboard/cbt/history/${attemptId}`);
|
||||
}}
|
||||
>
|
||||
View Solutions
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
size="lg"
|
||||
className="rounded-xl h-14 px-8 font-bold text-lg shadow-[0_0_20px_-5px_var(--color-primary)] gap-2 w-full sm:w-auto"
|
||||
|
||||
Reference in New Issue
Block a user