diff --git a/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx b/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx
index c7e258c2..ae28e8e8 100644
--- a/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx
+++ b/apps/web/src/app/create/worksheets/addition/components/ConfigPanel.tsx
@@ -36,9 +36,9 @@ interface ConfigPanelProps {
/**
* Generate a human-readable summary of enabled scaffolding aids
- * Groups by frequency: "Always: x, y • When needed: z"
+ * Returns JSX with each frequency group on its own line
*/
-function getScaffoldingSummary(displayRules: any): string {
+function getScaffoldingSummary(displayRules: any): React.ReactNode {
console.log('[getScaffoldingSummary] displayRules:', displayRules)
const alwaysItems: string[] = []
@@ -68,20 +68,19 @@ function getScaffoldingSummary(displayRules: any): string {
conditionalItems.push('ten-frames')
}
- const parts: string[] = []
-
- if (alwaysItems.length > 0) {
- parts.push(`Always: ${alwaysItems.join(', ')}`)
+ if (alwaysItems.length === 0 && conditionalItems.length === 0) {
+ console.log('[getScaffoldingSummary] Final summary: no scaffolding')
+ return no scaffolding
}
- if (conditionalItems.length > 0) {
- parts.push(`When needed: ${conditionalItems.join(', ')}`)
- }
+ console.log('[getScaffoldingSummary] Final summary:', { alwaysItems, conditionalItems })
- const summary = parts.length > 0 ? parts.join(' • ') : 'no scaffolding'
- console.log('[getScaffoldingSummary] Final summary:', summary)
-
- return summary
+ return (
+
+ {alwaysItems.length > 0 &&
Always: {alwaysItems.join(', ')}
}
+ {conditionalItems.length > 0 &&
When needed: {conditionalItems.join(', ')}
}
+
+ )
}
interface ToggleOptionProps {
@@ -422,7 +421,7 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) {
// Find nearest presets for custom configurations
let nearestEasier: DifficultyLevel | null = null
let nearestHarder: DifficultyLevel | null = null
- let customDescription = ''
+ let customDescription: React.ReactNode = ''
if (isCustom) {
const currentRegrouping = calculateRegroupingIntensity(pAnyStart, pAllStart)
@@ -477,7 +476,12 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) {
// Generate custom description
const regroupingPercent = Math.round(currentRegrouping * 10)
const scaffoldingSummary = getScaffoldingSummary(displayRules)
- customDescription = `${regroupingPercent}% regrouping • ${scaffoldingSummary}`
+ customDescription = (
+ <>
+ {regroupingPercent}% regrouping
+ {scaffoldingSummary}
+ >
+ )
}
// Calculate current difficulty position
@@ -580,6 +584,7 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) {
data-action="open-preset-dropdown"
className={css({
w: 'full',
+ minH: '20',
px: '3',
py: '2.5',
border: '2px solid',
@@ -636,23 +641,36 @@ export function ConfigPanel({ formState, onChange }: ConfigPanelProps) {
lineHeight: '1.3',
})}
>
- {isCustom
- ? customDescription
- : currentProfile
- ? (() => {
- const preset = DIFFICULTY_PROFILES[currentProfile]
- const regroupingPercent = Math.round(
- calculateRegroupingIntensity(
- preset.regrouping.pAnyStart,
- preset.regrouping.pAllStart
- ) * 10
- )
- const scaffoldingSummary = getScaffoldingSummary(
- preset.displayRules
- )
- return `${regroupingPercent}% regrouping • ${scaffoldingSummary}`
- })()
- : '25% regrouping • Always: carry boxes, answer boxes, place value colors, ten-frames'}
+ {isCustom ? (
+ customDescription
+ ) : currentProfile ? (
+ (() => {
+ const preset = DIFFICULTY_PROFILES[currentProfile]
+ const regroupingPercent = Math.round(
+ calculateRegroupingIntensity(
+ preset.regrouping.pAnyStart,
+ preset.regrouping.pAllStart
+ ) * 10
+ )
+ const scaffoldingSummary = getScaffoldingSummary(
+ preset.displayRules
+ )
+ return (
+ <>
+ {regroupingPercent}% regrouping
+ {scaffoldingSummary}
+ >
+ )
+ })()
+ ) : (
+ <>
+ 25% regrouping
+
+ Always: carry boxes, answer boxes, place value colors,
+ ten-frames
+
+ >
+ )}
+ {regroupingPercent}% regrouping
+ {scaffoldingSummary}
+ >
+ )
return (