'use client'; import { useState } from 'react'; import * as Accordion from '../Accordion'; import * as RadioGroup from '../RadioGroup'; import * as Switch from '../Switch'; import * as Slider from '../Slider'; import { ScenarioIcon } from '../Icons/ScenarioIcon'; import { AudioSpeakerIcon } from '../Icons/AudioSpeakerIcon'; import { MicrophoneIcon } from '../Icons/MicrophoneIcon'; import { RecordIcon } from '../Icons/RecordIcon'; import { TimerIcon } from '../Icons/TimerIcon'; import { AudienceIcon } from '../Icons/AudienceIcon'; import { studioControls } from 'styled-system/recipes'; import { Badge } from '../Badge'; import type { StudioControlsProps, RecordingMode } from './types'; // ── Static section data ──────────────────────────────────────────────────────── const SETTING_BADGES = [ { id: 'conversation-flow', label: 'Conversation Flow' }, { id: 'question-complexity', label: 'Question Complexity' }, { id: 'response-pacing', label: 'Response Pacing' }, { id: 'interview-tone', label: 'Interview Tone' }, ] as const; const RECORDING_OPTIONS = [ { value: 'no-recording', label: 'No Recording' }, { value: 'audio-only', label: 'Record just audio' }, { value: 'video-audio', label: 'Record video & audio' }, ] as const; const LEVEL_COLOR_PALETTE = { beginner: 'primary', intermediate: 'secondary', advanced: 'tertiary', } as const; const ALL_SECTION_IDS = [ 'scenario-settings', 'audio-output', 'mic-input', 'av-recording', 'display-timer', 'hide-interviewers', ]; // ── Component ───────────────────────────────────────────────────────────────── const DEFAULT_TRIGGER_CSS = { fontSize: 'sm', fontWeight: 'semibold', } as const; export function StudioControls({ scenarioName, scenarioFocus, scenarioLevel, defaultAudioLevel = 75, defaultMicLevel = 75, defaultRecordingMode = 'no-recording', defaultShowTimer = true, defaultHideInterviewers = false, triggerCss, onAudioLevelChange, onMicLevelChange, onRecordingModeChange, onTimerChange, onInterviewersChange, }: StudioControlsProps) { const resolvedTriggerCss = { ...DEFAULT_TRIGGER_CSS, ...triggerCss }; const styles = studioControls(); const [audioLevel, setAudioLevel] = useState(defaultAudioLevel); const [micLevel, setMicLevel] = useState(defaultMicLevel); const levelLabel = scenarioLevel.charAt(0).toUpperCase() + scenarioLevel.slice(1); return (
{/* ── Section 1: Scenario Settings ─────────────────────────────────── */} Scenario Settings

{scenarioName}

Focus: {scenarioFocus}

Scenario Settings

{SETTING_BADGES.map((badge) => (
{badge.label}: {levelLabel}
))}
{/* ── Section 2: Audio Output ──────────────────────────────────────── */} Audio Output
Volume {audioLevel}%
{ const next = value[0] ?? audioLevel; setAudioLevel(next); onAudioLevelChange?.(next); }} >
{/* ── Section 3: Microphone Output ─────────────────────────────────── */} Microphone Input
Mic Gain {micLevel}%
{ const next = value[0] ?? micLevel; setMicLevel(next); onMicLevelChange?.(next); }} >
{/* ── Section 4: A/V Recording ─────────────────────────────────────── */} A/V Recording
{ if (!value) return; onRecordingModeChange?.(value as RecordingMode); }} css={{ gap: '3' }} > {RECORDING_OPTIONS.map((option) => ( {option.label} ))}
{/* ── Section 5: Display Timer ──────────────────────────────────────── */} Display Timer

Hide timer to create more realistic interview

{ onTimerChange?.(checked); }} >
{/* ── Section 6: Hide Interviewers ─────────────────────────────────── */} Hide Interviewers

Switch off to hide video of interviewers if it is too distracting

{ onInterviewersChange?.(checked); }} >
); }