Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | 'use client' import { css } from '@styled/css' import { stack } from '@styled/patterns' import { useTheme } from '@/contexts/ThemeContext' import type { WorksheetFormState } from '@/app/create/worksheets/types' import { SETTING_ICONS } from '@/app/create/worksheets/utils/settingsSummary' interface SharedWorksheetSummaryProps { config: WorksheetFormState } /** * Executive summary of worksheet configuration * Human-readable, visually appealing, shows only enabled features */ export function SharedWorksheetSummary({ config }: SharedWorksheetSummaryProps) { const { resolvedTheme } = useTheme() const isDark = resolvedTheme === 'dark' // Build human-readable descriptions const operatorLabels: Record<string, string> = { addition: 'Addition', subtraction: 'Subtraction', multiplication: 'Multiplication', division: 'Division', mixed: 'Mixed Operations', } const operatorLabel = config.operator ? operatorLabels[config.operator] : 'Addition' const digitRangeMin = config.digitRange?.min const digitRangeMax = config.digitRange?.max const digitRangeText = digitRangeMin === digitRangeMax ? `${digitRangeMin ?? 2}-digit numbers` : `${digitRangeMin ?? 1} to ${digitRangeMax ?? 2} digit numbers` const difficultyDescription = (() => { if (config.mode === 'custom') { const parts = ['Custom difficulty'] if (config.interpolate) { parts.push('progresses from easy to hard') } if (config.pAnyStart != null) { const pct = Math.round(config.pAnyStart * 100) parts.push(`starting at ${pct}% challenge level`) } return parts.join(' • ') } if (config.mode === 'mastery') { return 'Mastery mode • Focused practice on specific skills' } return 'Manual difficulty • Custom settings' })() // Collect enabled visual aids const visualAids: string[] = [] if (config.displayRules?.tenFrames === 'always') { visualAids.push('🎨 Ten-frame diagrams') } if (config.displayRules?.carryBoxes === 'always') { visualAids.push('📦 Carry notation boxes') } if (config.displayRules?.placeValueColors === 'always') { visualAids.push('🌈 Color-coded place values') } if (config.displayRules?.answerBoxes === 'always') { visualAids.push('✏️ Answer entry boxes') } // Layout summary const layoutText = [ `${config.problemsPerPage || 20} problems per page`, config.cols ? `${config.cols} columns` : null, config.orientation ? config.orientation : null, ] .filter(Boolean) .join(' • ') return ( <div data-component="shared-worksheet-summary" className={css({ h: 'full', bg: isDark ? 'gray.800' : 'white', p: '5', overflow: 'auto', display: 'flex', flexDirection: 'column', gap: '5', })} > {/* Header */} <div className={css({ display: 'flex', justifyContent: 'space-between', alignItems: 'center', pb: '4', borderBottom: '2px solid', borderColor: isDark ? 'blue.700' : 'blue.200', })} > <div> <h2 className={css({ fontSize: 'xl', fontWeight: 'bold', color: isDark ? 'gray.100' : 'gray.900', mb: '1', })} > 📋 Worksheet Summary </h2> <p className={css({ fontSize: 'sm', color: isDark ? 'gray.400' : 'gray.600', })} > Read-only view of this shared worksheet </p> </div> <div className={css({ px: '3', py: '1.5', rounded: 'lg', bg: isDark ? 'blue.700' : 'blue.100', fontSize: 'xs', fontWeight: 'bold', color: isDark ? 'blue.100' : 'blue.800', textTransform: 'uppercase', letterSpacing: 'wider', })} > 👁️ View Only </div> </div> {/* Student Name (if provided) */} {config.name && ( <InfoCard icon="👤" title="Student" description={config.name} isDark={isDark} highlight /> )} {/* Main Content */} <InfoCard icon={SETTING_ICONS.operator[config.operator ?? 'addition']} title="What's Being Practiced" description={`${operatorLabel} with ${digitRangeText}`} isDark={isDark} /> {/* Difficulty */} <InfoCard icon="🎯" title="Difficulty Level" description={difficultyDescription} isDark={isDark} /> {/* Visual Aids (only if any enabled) */} {visualAids.length > 0 && ( <div className={css({ p: '4', bg: isDark ? 'gray.750' : 'gray.50', rounded: 'xl', border: '1px solid', borderColor: isDark ? 'gray.700' : 'gray.200', })} > <h3 className={css({ fontSize: 'sm', fontWeight: 'bold', color: isDark ? 'gray.300' : 'gray.700', mb: '3', textTransform: 'uppercase', letterSpacing: 'wider', })} > 🎨 Visual Learning Aids </h3> <div className={stack({ gap: '2' })}> {visualAids.map((aid, i) => ( <div key={i} className={css({ fontSize: 'sm', color: isDark ? 'gray.200' : 'gray.800', display: 'flex', alignItems: 'center', gap: '2', })} > <span className={css({ w: '6', h: '6', rounded: 'full', bg: isDark ? 'gray.700' : 'white', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 'xs', border: '1px solid', borderColor: isDark ? 'gray.600' : 'gray.300', })} > ✓ </span> {aid} </div> ))} </div> </div> )} {/* Layout Details */} <InfoCard icon="📐" title="Page Layout" description={layoutText} isDark={isDark} /> {/* Additional Features (only if enabled) */} {config.includeAnswerKey && ( <div className={css({ p: '4', bg: isDark ? 'gray.750' : 'gray.50', rounded: 'xl', border: '1px solid', borderColor: isDark ? 'gray.700' : 'gray.200', })} > <h3 className={css({ fontSize: 'sm', fontWeight: 'bold', color: isDark ? 'gray.300' : 'gray.700', mb: '3', textTransform: 'uppercase', letterSpacing: 'wider', })} > ✨ Extras </h3> <div className={stack({ gap: '1.5' })}> {config.includeAnswerKey && ( <FeatureBadge icon="🔑" label="Answer key provided" isDark={isDark} /> )} </div> </div> )} </div> ) } /** * Large info card for primary information */ function InfoCard({ icon, title, description, isDark, highlight = false, }: { icon: string title: string description: string isDark: boolean highlight?: boolean }) { return ( <div data-element="info-card" className={css({ p: '4', bg: highlight ? (isDark ? 'blue.900/20' : 'blue.50') : isDark ? 'gray.750' : 'gray.50', rounded: 'xl', border: '2px solid', borderColor: highlight ? isDark ? 'blue.700' : 'blue.200' : isDark ? 'gray.700' : 'gray.200', })} > <div className={css({ display: 'flex', alignItems: 'flex-start', gap: '3' })}> <div className={css({ fontSize: '2xl', flexShrink: 0, w: '12', h: '12', display: 'flex', alignItems: 'center', justifyContent: 'center', bg: isDark ? 'gray.700' : 'white', rounded: 'lg', border: '1px solid', borderColor: isDark ? 'gray.600' : 'gray.300', })} > {icon} </div> <div className={css({ flex: 1, minW: 0 })}> <div className={css({ fontSize: 'xs', fontWeight: 'bold', color: isDark ? 'gray.400' : 'gray.600', mb: '1', textTransform: 'uppercase', letterSpacing: 'wider', })} > {title} </div> <div className={css({ fontSize: 'md', fontWeight: 'medium', color: isDark ? 'gray.100' : 'gray.900', lineHeight: '1.6', })} > {description} </div> </div> </div> </div> ) } /** * Small feature badge for extras section */ function FeatureBadge({ icon, label, isDark }: { icon: string; label: string; isDark: boolean }) { return ( <div className={css({ display: 'flex', alignItems: 'center', gap: '2', fontSize: 'sm', color: isDark ? 'gray.200' : 'gray.800', })} > <span className={css({ fontSize: 'lg' })}>{icon}</span> <span>{label}</span> </div> ) } |