import { Suspense } from 'react' import lazyPage from '../utils/lazyPage' import { Link } from 'react-router-dom' import RichText from './RichText' import QuestionReadingLinks from './QuestionReadingLinks' import { uploadUrl } from '../utils/uploads' const TeachChat = lazyPage(() => import('./TeachChat')) /** * One question, shown whole, without leaving the page you found it on. * * It is a preview, not practice: the correct option, the per-option reasoning, * the explanation and the key points are all shown at once. Making someone * answer first is the right shape for a quiz and the wrong one for a list of * questions being inspected. * * Favourites and personal folders are optional and off by default — those * belong to studying a question, not to looking through the bank. */ /* No "Add to library" here any more. It was three faults in one twelve-line block: it said library and meant collection; its dropdown was always empty, because the only page that renders this preview passes no collections; and the "New library…" input called setCollections, which does not exist in this component — so typing a name and pressing Enter created the collection, added the question, and then threw a ReferenceError. Putting a question aside belongs to the reading and session flows, where the collections are actually loaded; this is a moderator's editing preview. */ export default function QuestionPreview({ question, onClose, isFavorited, onToggleFavorite }) { return ( <>
e.target === e.currentTarget && onClose()}>
{question.quiz_title}{question.question_category_name ? ` · ${question.question_category_name}` : ''}
{onToggleFavorite && ( )}
{/* Markdown, not injected HTML: a stem is educator prose, and the same renderer the quiz player uses keeps a lab table a table. */}
{question.image_path && (
Question illustration e.target.style.display = 'none'} />
)} {question.options && (
{question.options.map((opt, i) => { const isCorrectOpt = opt === question.correct_answer return (
{String.fromCharCode(65 + i)} {opt} {isCorrectOpt && ✓ Correct} {question.option_explanations?.[opt] && ( )}
) })}
)} {(question.explanation || question.explanation_image_path) && (
Explanation: {question.explanation &&
} {question.explanation_image_path && (
Explanation illustration e.currentTarget.style.display = 'none'} />
)}
)} {(question.key_points || []).length > 0 && (
Key points
    {question.key_points.map((point, i) => (
  • {point.text} {point.article_id && ( 📖 Read more )}
  • ))}
)}
{/* AI Tutor — z-index above the modal */} ) }