'use client'; import type { ComponentProps } from 'react'; import type { FieldErrors, UseFormRegister, UseFormReturn } from 'react-hook-form'; import { Layers, Loader2, MapPin, Route } from 'lucide-react'; import { FormField } from '@/components/form'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import type { ProjectFormValues } from '../hooks/useProjectForm'; interface ProjectDialogProps { open: boolean; onOpenChange: (open: boolean) => void; projectId?: string; register: UseFormRegister; errors: FieldErrors; touchedFields: UseFormReturn['formState']['touchedFields']; onSubmit: ComponentProps<'form'>['onSubmit']; canSubmit: boolean; isSaving: boolean; } export function ProjectDialog({ open, onOpenChange, projectId, register, errors, touchedFields, onSubmit, canSubmit, isSaving, }: ProjectDialogProps) { const nameErrorMessage = touchedFields.name ? errors.name?.message : undefined; const startLatErrorMessage = touchedFields.start_lat ? errors.start_lat?.message : undefined; const startLngErrorMessage = touchedFields.start_lng ? errors.start_lng?.message : undefined; const endLatErrorMessage = touchedFields.end_lat ? errors.end_lat?.message : undefined; const endLngErrorMessage = touchedFields.end_lng ? errors.end_lng?.message : undefined; return ( event.preventDefault()}>
{projectId ? 'Edit Project Details' : 'Create New Project'}
{projectId ? 'Update the technical specifications for your road infrastructure project.' : 'Provide the essential road data to establish a new analysis project.'}
Corridor Name } >

START POINT

END POINT

); }