From 4174b6d2e7ad00cfd3cdc887345551047fb7f114 Mon Sep 17 00:00:00 2001 From: Thomas Hallock Date: Tue, 18 Nov 2025 11:18:30 -0600 Subject: [PATCH] fix: update operator-specific display rules in mastery+mixed mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When in mastery mode with mixed operator, the system uses separate display rules for addition and subtraction (additionDisplayRules and subtractionDisplayRules). The Layout tab was only updating the general displayRules, which meant problemNumbers and cellBorders toggles had no effect on the actual worksheet. Now when toggling these settings, we update: - displayRules (general) - additionDisplayRules (if in mastery+mixed mode) - subtractionDisplayRules (if in mastery+mixed mode) This ensures the settings are respected across all problem types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../components/config-sidebar/LayoutTab.tsx | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/create/worksheets/components/config-sidebar/LayoutTab.tsx b/apps/web/src/app/create/worksheets/components/config-sidebar/LayoutTab.tsx index 76b3c36a..88ab67a3 100644 --- a/apps/web/src/app/create/worksheets/components/config-sidebar/LayoutTab.tsx +++ b/apps/web/src/app/create/worksheets/components/config-sidebar/LayoutTab.tsx @@ -88,14 +88,38 @@ export function LayoutTab() { console.log('[LayoutTab] Changing problemNumbers:', { from: displayRules.problemNumbers, to: value, + mode: formState.mode, + operator: formState.operator, fullDisplayRules: displayRules, }) - onChange({ + + // Update general displayRules + const updates: any = { displayRules: { ...displayRules, problemNumbers: value, }, - }) + } + + // CRITICAL: In mastery+mixed mode, also update operator-specific display rules + if (formState.mode === 'mastery' && formState.operator === 'mixed') { + // Update additionDisplayRules if they exist + if (formState.additionDisplayRules) { + updates.additionDisplayRules = { + ...formState.additionDisplayRules, + problemNumbers: value, + } + } + // Update subtractionDisplayRules if they exist + if (formState.subtractionDisplayRules) { + updates.subtractionDisplayRules = { + ...formState.subtractionDisplayRules, + problemNumbers: value, + } + } + } + + onChange(updates) }} onCellBordersChange={(value) => { const displayRules: DisplayRules = @@ -103,14 +127,38 @@ export function LayoutTab() { console.log('[LayoutTab] Changing cellBorders:', { from: displayRules.cellBorders, to: value, + mode: formState.mode, + operator: formState.operator, fullDisplayRules: displayRules, }) - onChange({ + + // Update general displayRules + const updates: any = { displayRules: { ...displayRules, cellBorders: value, }, - }) + } + + // CRITICAL: In mastery+mixed mode, also update operator-specific display rules + if (formState.mode === 'mastery' && formState.operator === 'mixed') { + // Update additionDisplayRules if they exist + if (formState.additionDisplayRules) { + updates.additionDisplayRules = { + ...formState.additionDisplayRules, + cellBorders: value, + } + } + // Update subtractionDisplayRules if they exist + if (formState.subtractionDisplayRules) { + updates.subtractionDisplayRules = { + ...formState.subtractionDisplayRules, + cellBorders: value, + } + } + } + + onChange(updates) }} /> )