fix: disable domain option only when fully complete

This commit is contained in:
ittoview
2026-05-13 19:18:34 +01:00
parent bf81e6d225
commit 0be095d583

View File

@@ -325,11 +325,10 @@ export default function PerformanceDomainPracticePage() {
}
const expectedGoalProgress = getKindProgress('expectedGoal')
const keyPointProgress = getKindProgress('keyPoint')
const currentKindProgress = currentQuestion?.kind === 'expectedGoal'
? expectedGoalProgress
: keyPointProgress
const currentKindDone = currentKindProgress.total > 0 && currentKindProgress.completed >= currentKindProgress.total
const optionDisabled = isAnswerShown || currentKindDone
const expectedGoalDone = expectedGoalProgress.total > 0 && expectedGoalProgress.completed >= expectedGoalProgress.total
const keyPointDone = keyPointProgress.total > 0 && keyPointProgress.completed >= keyPointProgress.total
const domainDone = expectedGoalDone && keyPointDone
const optionDisabled = isAnswerShown || domainDone
return (
<motion.button
@@ -342,7 +341,7 @@ export default function PerformanceDomainPracticePage() {
'relative flex h-[112px] flex-col gap-2 overflow-hidden rounded-xl border bg-white p-3 text-left shadow-sm transition-colors dark:bg-gray-800',
'border-gray-100 hover:border-indigo-200 hover:bg-indigo-50/40 dark:border-gray-700 dark:hover:border-indigo-700 dark:hover:bg-indigo-950/20',
optionDisabled && 'cursor-default hover:bg-white dark:hover:bg-gray-800',
currentKindDone && !isAnswerShown && 'bg-gray-50 opacity-55 dark:bg-gray-800/70',
domainDone && !isAnswerShown && 'bg-gray-50 opacity-55 dark:bg-gray-800/70',
shouldHighlightCorrect &&
'border-emerald-400 bg-emerald-50 shadow-[inset_0_0_0_2px_rgba(52,211,153,0.65)] dark:border-emerald-500 dark:bg-emerald-950/30 dark:shadow-[inset_0_0_0_2px_rgba(16,185,129,0.45)]',
isWrongSelected &&
@@ -353,7 +352,7 @@ export default function PerformanceDomainPracticePage() {
<div
className={clsx(
'flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-white',
currentKindDone && !isAnswerShown && 'grayscale'
domainDone && !isAnswerShown && 'grayscale'
)}
style={{ backgroundColor: domain.color }}
>