diff --git a/frontend/src/types.ts b/frontend/src/types.ts new file mode 100644 index 0000000..8c2350d --- /dev/null +++ b/frontend/src/types.ts @@ -0,0 +1,124 @@ +// src/types.ts + +export type QuestionType = + | 'multiple-choice' + | 'multiple-select' + | 'short-answer' + | 'translation' + | 'math-input' + | 'essay' + | 'match' + | 'order' + +export interface Choice { + id: string + text: string +} + +export interface MatchItem { + id: string + text: string +} + +export interface QuestionImage { + src: string + alt?: string + caption?: string +} + +export interface QuestionAudio { + src: string +} + +export interface QuestionCode { + language: string + content: string +} + +export interface QuestionTable { + headers: string[] + rows: string[][] +} + +export interface Question { + id: string + type: QuestionType + category?: string + points?: number + prompt: string + explanation?: string + image?: QuestionImage + audio?: QuestionAudio + code?: QuestionCode + table?: QuestionTable + svg?: string + answer?: string | string[] | Record + acceptedForms?: string[] + caseSensitive?: boolean + ignorePunctuation?: boolean + ignoreAccents?: boolean + sourceLanguage?: string + targetLanguage?: string + choices?: Choice[] + minWords?: number + rubric?: string[] + left?: MatchItem[] + right?: MatchItem[] + items?: MatchItem[] +} + +export interface Exam { + title: string + subtitle?: string + author?: string + timeLimitMinutes?: number | null + feedbackMode?: 'end' | 'immediate' + passingScore?: number + categories?: string[] + questions: Question[] +} + +export type FeedbackMode = 'immediate' | 'end' + +export interface ExamState { + currentIdx: number + answers: Record + flags: Record + revealed: Record + startedAt: number + completedAt?: number + feedbackMode: FeedbackMode +} + +export interface HistoryEntry { + id: string + title: string + completedAt: number + elapsedMs: number + gradedCount: number + correctCount: number + totalPoints: number + scorePoints: number + passingScore: number + exam: Exam + state: ExamState +} + +export type GradeStatus = 'correct' | 'wrong' | 'ungraded' | 'unanswered' + +export interface GradeResult { + status: GradeStatus + correct: boolean + points: number +} + +export type AppScreen = 'landing' | 'exam' | 'results' | 'review' +export type ThemeMode = 'light' | 'dark' +export type FontSize = 'small' | 'medium' | 'large' +export type FeedbackTweak = 'auto' | 'immediate' | 'end' + +export interface Tweaks { + theme: ThemeMode + fontSize: FontSize + feedbackMode: FeedbackTweak +}