fix(ts): refactor codebase for capacitor setup

This commit is contained in:
shafin-r
2025-07-28 20:22:04 +06:00
parent e091a78bdb
commit 0bca09f8ef
31 changed files with 458 additions and 384 deletions

View File

@ -1,13 +1,14 @@
"use client";
import { useRouter } from "next/navigation";
import { useExam, useExamResults } from "@/context/ExamContext";
import { useExam } from "@/context/ExamContext";
import { useEffect, useState } from "react";
import React from "react";
import { ArrowLeft } from "lucide-react";
import SlidingGallery from "@/components/SlidingGallery";
import QuestionItem from "@/components/QuestionItem";
import { getResultViews } from "@/lib/gallery-views";
import { Question } from "@/types/exam";
export default function ResultsPage() {
const router = useRouter();
@ -58,15 +59,15 @@ export default function ResultsPage() {
const apiResponse = getApiResponse();
const timeTaken =
currentAttempt.endTime && currentAttempt.startTime
? Math.round(
(currentAttempt.endTime.getTime() -
currentAttempt.startTime.getTime()) /
1000 /
60
)
: 0;
// const timeTaken =
// currentAttempt.endTime && currentAttempt.startTime
// ? Math.round(
// (currentAttempt.endTime.getTime() -
// currentAttempt.startTime.getTime()) /
// 1000 /
// 60
// )
// : 0;
const views = getResultViews(currentAttempt);
@ -98,11 +99,13 @@ export default function ResultsPage() {
Solutions
</h3>
<div className="flex flex-col gap-7">
{apiResponse.questions.map((question) => (
{apiResponse.questions.map((question: Question) => (
<QuestionItem
key={question.id}
question={question}
selectedAnswer={currentAttempt.answers[question.id - 1]}
selectedAnswer={
currentAttempt.answers[parseInt(question.id) - 1]
}
mode="result"
/>
))}