import Grid from '@mui/material/Grid'; import Button from '@mui/material/Button'; import Typography from '@mui/material/Typography'; import Box from '@mui/material/Box'; import { SpeakButton } from '../common/SpeakButton'; import type { MultipleChoiceExercise } from '../../types/lesson'; interface MultipleChoiceProps { exercise: MultipleChoiceExercise; selectedAnswer: number | null; isChecked: boolean; isCorrect: boolean | null; onSelect: (index: number) => void; } export function MultipleChoice({ exercise, selectedAnswer, isChecked, isCorrect, onSelect, }: MultipleChoiceProps) { function getButtonVariant(index: number) { if (!isChecked) { return index === selectedAnswer ? 'contained' : 'outlined'; } if (index === exercise.correctIndex) return 'contained'; if (index === selectedAnswer && !isCorrect) return 'contained'; return 'outlined'; } function getButtonColor(index: number) { if (!isChecked) { return index === selectedAnswer ? 'secondary' : 'inherit'; } if (index === exercise.correctIndex) return 'primary'; if (index === selectedAnswer && !isCorrect) return 'error'; return 'inherit'; } return ( {exercise.promptAudio && } {exercise.prompt} {exercise.choices.map((choice, index) => ( ))} ); }