From bcc24d0f4010465577e2662a4d857b36e69cecdc Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 6 Apr 2026 14:38:43 -0400 Subject: [PATCH] refactor: remove ModeToggle from configurator, make it typed-form-only Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/configurator/ModeToggle.tsx | 69 ------------------- .../configurator/WizardContainer.tsx | 38 +--------- 2 files changed, 3 insertions(+), 104 deletions(-) delete mode 100644 src/components/configurator/ModeToggle.tsx diff --git a/src/components/configurator/ModeToggle.tsx b/src/components/configurator/ModeToggle.tsx deleted file mode 100644 index bbc45ba..0000000 --- a/src/components/configurator/ModeToggle.tsx +++ /dev/null @@ -1,69 +0,0 @@ -'use client'; - -import { useState, useEffect } from 'react'; -import { useTranslations } from 'next-intl'; -import { Keyboard, Mic } from 'lucide-react'; -import { cn } from '@/lib/utils'; - -// ─── Types ─────────────────────────────────────────────────────────────────── - -interface ModeToggleProps { - mode: 'type' | 'talk'; - onChange: (mode: 'type' | 'talk') => void; -} - -// ─── Component ─────────────────────────────────────────────────────────────── - -export default function ModeToggle({ mode, onChange }: ModeToggleProps) { - const t = useTranslations('configurator'); - const [voiceSupported, setVoiceSupported] = useState(false); - - useEffect(() => { - async function check() { - if (typeof WebSocket === 'undefined') return; - if (!navigator.mediaDevices?.getUserMedia) return; - - try { - const res = await fetch('/api/gemini-token'); - const data = (await res.json()) as { success: boolean }; - if (data.success) setVoiceSupported(true); - } catch { - // silent — toggle stays hidden - } - } - void check(); - }, []); - - if (!voiceSupported) return null; - - return ( -
- - -
- ); -} diff --git a/src/components/configurator/WizardContainer.tsx b/src/components/configurator/WizardContainer.tsx index 9ed6b21..d4c574c 100644 --- a/src/components/configurator/WizardContainer.tsx +++ b/src/components/configurator/WizardContainer.tsx @@ -8,9 +8,6 @@ import StepDetails from './StepDetails'; import StepContact from './StepContact'; import StepGenerating from './StepGenerating'; import StepComplete from './StepComplete'; -import ModeToggle from './ModeToggle'; -import VoiceAgent from './VoiceAgent'; -import VoiceAgentProvider from './VoiceAgentProvider'; // ─── Types ──────────────────────────────────────────────────────────────────── @@ -90,7 +87,6 @@ export default function WizardContainer() { const [isSubmitting, setIsSubmitting] = useState(false); const [isGenerating, setIsGenerating] = useState(false); const [submitError, setSubmitError] = useState(null); - const [mode, setMode] = useState<'type' | 'talk'>('type'); const goNext = () => { setDirection(1); @@ -108,7 +104,6 @@ export default function WizardContainer() { setBrief(''); setSubmitError(null); setIsGenerating(false); - setMode('type'); setCurrentStep(1); }; @@ -144,13 +139,6 @@ export default function WizardContainer() { } }; - const handleVoiceComplete = (voiceBrief: string, voiceFormData: WizardFormData) => { - setFormData(voiceFormData); - setBrief(voiceBrief); - setDirection(1); - setCurrentStep(4); - }; - const stepVariants = makeVariants(direction); const sharedProps: StepProps = { @@ -162,28 +150,8 @@ export default function WizardContainer() { return (
- {!isGenerating && currentStep !== 4 && ( -
- -
- )} - - {mode === 'talk' && !isGenerating && currentStep !== 4 && ( - - - - - - )} - - {mode === 'type' && !isGenerating && currentStep === 1 && ( + {!isGenerating && currentStep === 1 && ( )} - {mode === 'type' && !isGenerating && currentStep === 2 && ( + {!isGenerating && currentStep === 2 && ( )} - {mode === 'type' && !isGenerating && currentStep === 3 && ( + {!isGenerating && currentStep === 3 && (