'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Label } from '@/components/ui/label'; import { validateSectorInput } from '@/lib/utils/validation'; interface SectorInputFormProps { loading?: boolean; } export function SectorInputForm({ loading }: SectorInputFormProps) { const router = useRouter(); const [sector, setSector] = useState(''); const [error, setError] = useState(''); const [isSubmitting, setIsSubmitting] = useState(false); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); setError(''); const validation = validateSectorInput(sector); if (!validation.valid) { setError(validation.error || 'Invalid input'); return; } setIsSubmitting(true); router.push(`/analyze?sector=${encodeURIComponent(validation.value!)}`); }; return (
Competitive Intelligence Analyze any market sector to get instant competitive insights
{ setSector(e.target.value); setError(''); }} disabled={isSubmitting || loading} /> {error &&

{error}

}
); }