import { useForm } from 'react-hook-form' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Textarea } from '@/components/ui/textarea' import type { Instructor } from '@/types/lesson' interface Props { defaultValues?: Partial onSubmit: (data: Record) => void loading?: boolean } export function InstructorForm({ defaultValues, onSubmit, loading }: Props) { const { register, handleSubmit } = useForm({ defaultValues: { displayName: defaultValues?.displayName ?? '', bio: defaultValues?.bio ?? '', instruments: defaultValues?.instruments?.join(', ') ?? '', }, }) function handleFormSubmit(data: { displayName: string; bio: string; instruments: string }) { onSubmit({ displayName: data.displayName, bio: data.bio || undefined, instruments: data.instruments ? data.instruments.split(',').map((s) => s.trim()).filter(Boolean) : undefined, }) } return (