55 */
66
77import React from 'react' ;
8- import { Button , Icon , Spinner , AutocompleteInput } from '../ui' ;
9- import { searchLocations } from '../../utils/geocoding ' ;
8+ import { Button , Icon , Spinner } from '../ui' ;
9+ import LocationField from './LocationField ' ;
1010
1111/**
1212 * Route form component for NavigationPage
@@ -43,27 +43,18 @@ const RouteForm = ({
4343 { /* Route form with autocomplete inputs */ }
4444 < form onSubmit = { onSubmit } >
4545 { /* Start location section */ }
46- < div className = "location-section" >
47- < div className = "section-header" >
48- < span className = "section-icon" > 📍</ span >
49- < h4 > { t ( 'startPoint' ) } </ h4 >
50- </ div >
51- < div className = "form-group" >
52- < label className = "form-label" > { t ( 'enterLocation' ) } </ label >
53- < AutocompleteInput
54- name = "fromLocation"
55- value = { formData . fromLocation }
56- onChange = { handleInputChange }
57- onSelect = { ( suggestion ) => {
58- setFormData ( prev => ( { ...prev , fromLocation : suggestion . displayName } ) ) ;
59- } }
60- searchFn = { searchLocations }
61- placeholder = { t ( 'searchLocationPlaceholder' ) || 'e.g., Athens, Greece' }
62- icon = { null }
63- required
64- />
65- </ div >
66- </ div >
46+ < LocationField
47+ name = "fromLocation"
48+ label = { t ( 'startPoint' ) }
49+ icon = "📍"
50+ value = { formData . fromLocation }
51+ onChange = { handleInputChange }
52+ onSelect = { ( suggestion ) => {
53+ setFormData ( prev => ( { ...prev , fromLocation : suggestion . displayName } ) ) ;
54+ } }
55+ placeholder = { t ( 'searchLocationPlaceholder' ) || 'e.g., Athens, Greece' }
56+ t = { t }
57+ />
6758
6859 < div className = "location-connector" >
6960 < div className = "connector-line" > </ div >
@@ -72,27 +63,18 @@ const RouteForm = ({
7263 </ div >
7364
7465 { /* Destination location section */ }
75- < div className = "location-section" >
76- < div className = "section-header" >
77- < span className = "section-icon" > 🎯</ span >
78- < h4 > { t ( 'destination' ) } </ h4 >
79- </ div >
80- < div className = "form-group" >
81- < label className = "form-label" > { t ( 'enterLocation' ) } </ label >
82- < AutocompleteInput
83- name = "toLocation"
84- value = { formData . toLocation }
85- onChange = { handleInputChange }
86- onSelect = { ( suggestion ) => {
87- setFormData ( prev => ( { ...prev , toLocation : suggestion . displayName } ) ) ;
88- } }
89- searchFn = { searchLocations }
90- placeholder = { t ( 'searchLocationPlaceholder' ) || 'e.g., Thessaloniki, Greece' }
91- icon = { null }
92- required
93- />
94- </ div >
95- </ div >
66+ < LocationField
67+ name = "toLocation"
68+ label = { t ( 'destination' ) }
69+ icon = "🎯"
70+ value = { formData . toLocation }
71+ onChange = { handleInputChange }
72+ onSelect = { ( suggestion ) => {
73+ setFormData ( prev => ( { ...prev , toLocation : suggestion . displayName } ) ) ;
74+ } }
75+ placeholder = { t ( 'searchLocationPlaceholder' ) || 'e.g., Thessaloniki, Greece' }
76+ t = { t }
77+ />
9678
9779 { /* Transport mode selection */ }
9880 < div className = "transport-section" >
0 commit comments