Add hint and partial scoring

This commit is contained in:
2026-06-27 10:58:34 +03:00
parent bacc371055
commit b14e0c8176
4 changed files with 103 additions and 15 deletions
+16
View File
@@ -25,6 +25,13 @@
return findQuestion(set, ref) ?? null;
});
/** Раскрывал ли ведущий подсказку для текущего открытого вопроса. */
const hintUsedForCurrent = $derived.by(() => {
const ref = $game.current;
if (!ref) return false;
return $game.hintUsed.includes(ref);
});
// ---- Действия ведущего ----
function selectSet(id: string) {
@@ -54,6 +61,13 @@
game.rejectQuestion(ref);
}
/** Ведущий раскрыл подсказку по текущему вопросу — сохраняем в состоянии. */
function markCurrentHintUsed() {
const ref = $game.current;
if (!ref) return;
game.markHintUsed(ref);
}
function randomQuestion() {
const set = $currentSet;
if (!set) return;
@@ -176,6 +190,8 @@
<QuestionModal
category={currentQuestionData.category}
question={currentQuestionData.question}
hintUsed={hintUsedForCurrent}
onMarkHintUsed={markCurrentHintUsed}
onAward={awardQuestion}
onReject={rejectQuestion}
onClose={closeQuestion}