'use client'; import { useState } from 'react'; import type { ReactNode } from 'react'; import * as Accordion from '../Accordion'; import * as Dialog from '../Dialog'; import * as RadioGroup from '../RadioGroup'; import { Button } from '../Button'; import { scenarioSettings } from 'styled-system/recipes'; import type { ScenarioSettingsProps, AdjustableSectionId, DurationValue, QuestionCountValue, } from './types'; // ── Static section data ──────────────────────────────────────────────────────── const INFO_SECTIONS = [ { id: 'conversation-flow' as AdjustableSectionId, label: 'Conversation Flow', explanation: { beginner: 'Topic transitions are explicit and signposted', intermediate: 'Conversation flows organically with realistic tangents', advanced: 'Topic shifts are sudden and unpredictable', }, }, { id: 'question-complexity' as AdjustableSectionId, label: 'Question Complexity', explanation: { beginner: 'Questions focus on single, clear topics', intermediate: 'Questions are layered with multiple components', advanced: 'Questions are complex and multi-dimensional', }, }, { id: 'discourse-tone' as AdjustableSectionId, label: 'Discourse Tone', explanation: { beginner: 'AI is warm, encouraging, and supportive', intermediate: 'AI is professional, neutral, and balanced', advanced: 'AI is direct, skeptical, and challenging', }, }, { id: 'response-pacing' as AdjustableSectionId, label: 'Response Pacing', explanation: { beginner: 'Long pauses welcomed, relaxed timing', intermediate: 'Natural conversational rhythm and pacing', advanced: 'Quick responses expected, minimal pauses', }, }, ] as const; const DURATION_OPTIONS = [ { value: 'quick', label: 'Quick (10 - 15 min)', badgeLabel: '~ (10-15 min)' }, { value: 'standard', label: 'Standard (15 - 25 min)', badgeLabel: '~ (15-25 min)', }, { value: 'extended', label: 'Extended (25 - 35 min)', badgeLabel: '~ (25-35 min)', }, ] as const; const QUESTION_OPTIONS = [ { value: 'brief', label: 'Brief (2-4)', badgeLabel: '2-4 questions' }, { value: 'standard', label: 'Standard (5-8)', badgeLabel: '5-8 questions' }, { value: 'extended', label: 'Extended (9-12)', badgeLabel: '9-12 questions' }, ] as const; const ALL_SECTION_IDS = [ 'conversation-flow', 'question-complexity', 'discourse-tone', 'response-pacing', 'duration', 'number-of-questions', ]; // ── Component ───────────────────────────────────────────────────────────────── export function ScenarioSettings({ defaultValue, singleOpen = false, adjustmentDialogContent, renderAdjustmentDialog, defaultDuration = 'quick', defaultQuestionCount = 'brief', onSelectionChange, }: ScenarioSettingsProps) { const styles = scenarioSettings(); const resolvedDefaultValue = defaultValue ?? (singleOpen ? ['conversation-flow'] : ALL_SECTION_IDS); const [duration, setDuration] = useState(defaultDuration); const [questionCount, setQuestionCount] = useState(defaultQuestionCount); const durationBadge = DURATION_OPTIONS.find((o) => o.value === duration)?.badgeLabel ?? '~ (10-15 min)'; const questionBadge = QUESTION_OPTIONS.find((o) => o.value === questionCount)?.badgeLabel ?? '2-4 questions'; function resolveDialogContent(sectionId: AdjustableSectionId): ReactNode { if (renderAdjustmentDialog) return renderAdjustmentDialog(sectionId); if (adjustmentDialogContent?.[sectionId]) return adjustmentDialogContent[sectionId]; return null; } return (
{/* ── Sections 1-4: Info + Adjustments ───────────────────────────────── */} {INFO_SECTIONS.map((section) => { const dialogContent = resolveDialogContent(section.id); return ( {section.label}

What this means:

  • Beginner:{' '} {section.explanation.beginner}
  • Intermediate:{' '} {section.explanation.intermediate}
  • Advanced:{' '} {section.explanation.advanced}
Adjust {section.label} {dialogContent ?? (

Adjustment controls for {section.label} will appear here.

)}
); })} {/* ── Section 5: Duration ─────────────────────────────────────────────── */} Duration

Expected time to complete

Currently: {durationBadge}
{ if (!value) return; setDuration(value as DurationValue); onSelectionChange?.('duration', value); }} css={{ gap: '3' }} > {DURATION_OPTIONS.map((option) => ( {option.label} ))}
{/* ── Section 6: Number of Questions ──────────────────────────────────── */} Number of Questions

Follow up Questions in this session

Currently: {questionBadge}
{ if (!value) return; setQuestionCount(value as QuestionCountValue); onSelectionChange?.('number-of-questions', value); }} css={{ gap: '3' }} > {QUESTION_OPTIONS.map((option) => ( {option.label} ))}
); }