fix(worksheets): prevent wrong preset showing as active at custom positions

Fix preset button highlighting to not default to 'earlyLearner' when at
a custom difficulty position between presets.

Before: When between Intermediate and Advanced, Early Learner button
would incorrectly show as selected.

After: No preset button is highlighted when at a custom position.

The profile variable still defaults to earlyLearner for fallback values,
but currentProfile remains undefined so isSelected checks work correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-11-07 13:55:42 -06:00
parent 3e56e1d6b6
commit 88e929ed63
1 changed files with 4 additions and 3 deletions

View File

@ -639,9 +639,10 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) {
{/* Get current profile and state */}
{(() => {
const currentProfile = (formState.difficultyProfile ||
'earlyLearner') as DifficultyLevel
const profile = DIFFICULTY_PROFILES[currentProfile]
const currentProfile = formState.difficultyProfile as DifficultyLevel | undefined
const profile = currentProfile
? DIFFICULTY_PROFILES[currentProfile]
: DIFFICULTY_PROFILES.earlyLearner
// Use defaults from profile if form state values are undefined
const pAnyStart = formState.pAnyStart ?? profile.regrouping.pAnyStart