forked from Tadrisino/MathApp_frontend
Quiz: phone Back asks before leaving; unknown hearts are not shown as five full
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import { api, ApiError, type AnswerResult, type Hearts, type Question } from '@/
|
||||
import { useAppData } from '@/state/AppData';
|
||||
import { fetchHome } from '@/state/subject';
|
||||
import { findNode, findNodeOfLesson, nextLessonOf, unitColor } from '@/state/curriculum';
|
||||
import { useNav } from '@/nav/Navigator';
|
||||
import { useBackStep, useNav } from '@/nav/Navigator';
|
||||
import { newIdempotencyKey } from '@/api/http';
|
||||
import { SeyarMascot } from '@/mascots/SeyarMascot';
|
||||
import type { SeyarMood } from '@/mascots/seyar';
|
||||
@@ -74,6 +74,9 @@ export function QuizScreen({ lessonId, nodeId }: { lessonId?: number; nodeId?: s
|
||||
// پشتِ هم درست؛ برای «سه تا پشتِ هم!» (حسِ پیشرفت وسطِ آزمون، نه فقط آخرش).
|
||||
const [combo, setCombo] = useState(0);
|
||||
useGateHold(phase.kind === 'loading');
|
||||
// دکمهی برگشتِ گوشی وسطِ تمرین همان «X» است: اول میپرسد، بیصدا بیرون نمیاندازد. برگهی باز خودش قدمِ
|
||||
// برگشتِ جداگانه دارد، پس برگشتِ دوم فقط برگه را میبندد.
|
||||
useBackStep(phase.kind === 'playing' && !confirmExit, () => setConfirmExit(true));
|
||||
|
||||
// یک کلید برای هر سوال و یکی برای پایانِ درس؛ تکرارِ درخواست دوبار ثبت نمیشود.
|
||||
const answerKeys = useRef(new Map<string, string>());
|
||||
@@ -440,8 +443,10 @@ function HeartsRow({ hearts }: { hearts: Hearts | null }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const max = hearts?.maxHearts ?? 5;
|
||||
const current = hearts?.currentHearts ?? max;
|
||||
// وضعیتِ قلب نرسید: پنج قلبِ پُرِ ساختگی نشان نمیدهیم؛ سرور با هر جواب عددِ واقعی را برمیگرداند.
|
||||
if (!hearts) return null;
|
||||
const max = hearts.maxHearts;
|
||||
const current = hearts.currentHearts;
|
||||
return (
|
||||
<div className="mt-3 flex items-center justify-center gap-2" aria-label={`${toFa(current)} قلب از ${toFa(max)}`}>
|
||||
{Array.from({ length: max }, (_, i) => (
|
||||
|
||||
Reference in New Issue
Block a user