All files / web/src/app/create/worksheets/components ModeSelector.tsx

0% Statements 0/132
0% Branches 0/1
0% Functions 0/1
0% Lines 0/132

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                                                                                                                                                                                                                                                                         
'use client'

import { css } from '@styled/css'

interface ModeSelectorProps {
  currentMode: 'custom' | 'manual' | 'mastery'
  onChange: (mode: 'custom' | 'manual' | 'mastery') => void
  isDark?: boolean
}

/**
 * Mode selector tabs for worksheet generation
 * Large, prominent tabs that switch between Custom Difficulty, Manual Control, and Mastery Progression modes
 */
export function ModeSelector({ currentMode, onChange, isDark = false }: ModeSelectorProps) {
  const modes = [
    {
      id: 'custom' as const,
      emoji: '🎯',
      label: 'Custom Difficulty',
      description: 'Research-backed progressive difficulty with adaptive scaffolding per problem',
    },
    {
      id: 'manual' as const,
      emoji: '🎛️',
      label: 'Manual Control',
      description: 'Full control over display options with uniform scaffolding across all problems',
    },
    {
      id: 'mastery' as const,
      emoji: '🎓',
      label: 'Mastery Progression',
      description: 'Skill-based progression with automatic review mixing for pedagogical practice',
    },
  ]

  const currentModeData = modes.find((m) => m.id === currentMode)

  return (
    <div data-component="mode-selector-tabs">
      {/* Tab buttons */}
      <div
        className={css({
          display: 'flex',
          gap: '0.5rem',
          borderBottom: '2px solid',
          borderColor: isDark ? 'gray.600' : 'gray.200',
        })}
      >
        {modes.map((mode) => {
          const isActive = currentMode === mode.id
          return (
            <button
              key={mode.id}
              type="button"
              data-action={`select-${mode.id}-mode`}
              data-selected={isActive}
              onClick={() => onChange(mode.id)}
              className={css({
                flex: 1,
                padding: '1rem 1.5rem',
                border: 'none',
                borderBottom: '3px solid',
                borderBottomColor: isActive ? 'blue.500' : 'transparent',
                backgroundColor: isActive
                  ? isDark
                    ? 'gray.700'
                    : 'white'
                  : isDark
                    ? 'gray.800'
                    : 'gray.50',
                color: isActive
                  ? isDark
                    ? 'blue.300'
                    : 'blue.600'
                  : isDark
                    ? 'gray.400'
                    : 'gray.600',
                cursor: 'pointer',
                transition: 'all 0.2s',
                fontSize: '0.95rem',
                fontWeight: isActive ? '700' : '500',
                display: 'flex',
                alignItems: 'center',
                justifyContent: 'center',
                gap: '0.5rem',
                borderTopLeftRadius: '8px',
                borderTopRightRadius: '8px',
                _hover: {
                  backgroundColor: isActive
                    ? isDark
                      ? 'gray.700'
                      : 'white'
                    : isDark
                      ? 'gray.700'
                      : 'gray.100',
                  borderBottomColor: isActive ? 'blue.500' : isDark ? 'gray.500' : 'gray.400',
                  color: isActive
                    ? isDark
                      ? 'blue.300'
                      : 'blue.600'
                    : isDark
                      ? 'gray.300'
                      : 'gray.700',
                },
              })}
            >
              <span className={css({ fontSize: '1.25rem' })}>{mode.emoji}</span>
              <span>{mode.label}</span>
            </button>
          )
        })}
      </div>

      {/* Description of active mode */}
      {currentModeData && (
        <p
          className={css({
            fontSize: 'sm',
            color: isDark ? 'gray.400' : 'gray.600',
            mt: '3',
            mb: '3',
            px: '2',
            lineHeight: '1.5',
          })}
        >
          {currentModeData.description}
        </p>
      )}
    </div>
  )
}