generated from muhtadeetaron/nextjs-template
fix(ui): fix exam and result screen ui
This commit is contained in:
54
types/exam.d.ts
vendored
Normal file
54
types/exam.d.ts
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
export interface Question {
|
||||
id: string;
|
||||
text: string;
|
||||
options?: string[];
|
||||
type: "multiple-choice" | "text" | "boolean";
|
||||
}
|
||||
|
||||
export interface Exam {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
questions: Question[];
|
||||
timeLimit?: number;
|
||||
passingScore?: number;
|
||||
}
|
||||
|
||||
export interface ExamAnswer {
|
||||
questionId: string;
|
||||
answer: any;
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
export interface ExamAttempt {
|
||||
examId: string;
|
||||
exam: Exam;
|
||||
answers: ExamAnswer[];
|
||||
startTime: Date;
|
||||
endTime?: Date;
|
||||
score?: number;
|
||||
passed?: boolean;
|
||||
apiResponse?: any;
|
||||
}
|
||||
|
||||
export interface ExamContextType {
|
||||
currentExam: Exam | null;
|
||||
currentAttempt: ExamAttempt | null;
|
||||
isHydrated: boolean;
|
||||
isInitialized: boolean;
|
||||
|
||||
// Actions
|
||||
setCurrentExam: (exam: Exam) => void;
|
||||
startExam: () => void;
|
||||
setAnswer: (questionId: string, answer: any) => void;
|
||||
submitExam: () => ExamAttempt;
|
||||
clearExam: () => void;
|
||||
setApiResponse: (response: any) => void;
|
||||
|
||||
// Getters
|
||||
getAnswer: (questionId: string) => any;
|
||||
getProgress: () => number;
|
||||
isExamStarted: () => boolean;
|
||||
isExamCompleted: () => boolean;
|
||||
getApiResponse: () => any;
|
||||
}
|
||||
Reference in New Issue
Block a user