import { Fragment, useState } from 'react' import { Dialog, Transition } from '@headlessui/react' import { XMarkIcon, MapPinIcon } from '@heroicons/react/24/outline' interface RegistrationModalProps { isOpen: boolean onClose: () => void onComplete: (data: LocationData) => void initialData?: { state?: string county?: string city?: string school_board?: string } } interface LocationData { state: string county: string city: string school_board: string } export default function RegistrationModal({ isOpen, onClose, onComplete, initialData }: RegistrationModalProps) { const [formData, setFormData] = useState({ state: initialData?.state || '', county: initialData?.county || '', city: initialData?.city || '', school_board: initialData?.school_board || '', }) const [errors, setErrors] = useState>({}) const handleSubmit = (e: React.FormEvent) => { e.preventDefault() // Validate required fields const newErrors: Record = {} if (!formData.state.trim()) newErrors.state = 'State is required' if (!formData.county.trim()) newErrors.county = 'County is required' if (!formData.city.trim()) newErrors.city = 'City is required' if (Object.keys(newErrors).length > 0) { setErrors(newErrors) return } onComplete(formData) } const handleChange = (field: keyof LocationData, value: string) => { setFormData(prev => ({ ...prev, [field]: value })) // Clear error for this field if (errors[field]) { setErrors(prev => { const newErrors = { ...prev } delete newErrors[field] return newErrors }) } } return (
Complete Your Profile

Help us personalize your experience by telling us where you're located. You can update this information anytime in Settings.

{/* State */}
handleChange('state', e.target.value)} placeholder="e.g., California, Texas, New York" className={`w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 ${ errors.state ? 'border-red-500' : 'border-gray-300' }`} /> {errors.state && (

{errors.state}

)}
{/* County */}
handleChange('county', e.target.value)} placeholder="e.g., Los Angeles County, Harris County" className={`w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 ${ errors.county ? 'border-red-500' : 'border-gray-300' }`} /> {errors.county && (

{errors.county}

)}
{/* City */}
handleChange('city', e.target.value)} placeholder="e.g., Los Angeles, Houston, New York" className={`w-full px-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 ${ errors.city ? 'border-red-500' : 'border-gray-300' }`} /> {errors.city && (

{errors.city}

)}
{/* School Board */}
handleChange('school_board', e.target.value)} placeholder="e.g., LAUSD, Houston ISD" className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500" />
{/* Submit Button */}
) }