Quiz: draw the question figure under the prompt (Question.figure)

This commit is contained in:
2026-10-12 11:58:42 +03:30
parent 18eeb54327
commit cf2a3251dd
2 changed files with 4 additions and 0 deletions

View File

@@ -149,6 +149,8 @@ export interface Question {
type: string;
prompt: string;
options: QuestionOption[];
/** شکلِ سوال (همان قالبِ شکلِ درس‌ها)؛ null یعنی شکل ندارد. */
figure?: DiagramSpec | null;
}
export interface NodeQuizQuestion extends Question {

View File

@@ -16,6 +16,7 @@ import { ErrorState, InlineError, LoadingState, PrimaryButton, SecondaryButton,
import { friendlyError } from '@/lib/errors';
import { toFa } from '@/lib/format';
import { MathText } from '@/lib/MathText';
import { Diagram } from '@/diagram';
import { sounds } from '@/lib/sound';
import { useGateHold } from '@/lib/useAsync';
import { StreakCelebration, StreakFlame } from '@/components/StreakFlame';
@@ -348,6 +349,7 @@ export function QuizScreen({ lessonId, nodeId }: { lessonId?: number; nodeId?: s
</button>
</div>
<h2 className="whitespace-pre-line text-base font-bold leading-8 text-ink"><MathText text={question.prompt} /></h2>
{question.figure ? <div className="mt-3"><Diagram spec={question.figure} /></div> : null}
</div>
<div className={shortOptions ? 'grid grid-cols-2 gap-2.5' : 'flex flex-col gap-2.5'}>