diff --git a/app/components/editable_champ/carte_component.rb b/app/components/editable_champ/carte_component.rb index 189fcb76a..b7ecb9a8c 100644 --- a/app/components/editable_champ/carte_component.rb +++ b/app/components/editable_champ/carte_component.rb @@ -4,10 +4,14 @@ class EditableChamp::CarteComponent < EditableChamp::EditableChampBaseComponent :fieldset end - def initialize(**args) - super(**args) - - @autocomplete_component = EditableChamp::ComboSearchComponent.new(**args) + def react_props + { + feature_collection: @champ.to_feature_collection, + champ_id: @champ.input_id, + url: update_path, + adresse_source: data_sources_data_source_adresse_path, + options: @champ.render_options + } end def update_path diff --git a/app/components/editable_champ/carte_component/carte_component.html.haml b/app/components/editable_champ/carte_component/carte_component.html.haml index db14600f9..052e979a9 100644 --- a/app/components/editable_champ/carte_component/carte_component.html.haml +++ b/app/components/editable_champ/carte_component/carte_component.html.haml @@ -1,14 +1,6 @@ .fr-fieldset__element - = render @autocomplete_component - - = react_component("MapEditor", - { featureCollection: @champ.to_feature_collection, - champId: @champ.input_id, - url: update_path, - options: @champ.render_options, - autocompleteAnnounceTemplateId: @autocomplete_component.announce_template_id, - autocompleteScreenReaderInstructions: t("combo_search_component.screen_reader_instructions") }, - {class: 'width-100'}) + %react-fragment.width-100 + = render ReactComponent.new "MapEditor", **react_props .geo-areas{ id: dom_id(@champ, :geo_areas) } = render Dossiers::GeoAreasComponent.new(champ: @champ, editing: true) diff --git a/app/javascript/components/MapEditor/components/AddressInput.tsx b/app/javascript/components/MapEditor/components/AddressInput.tsx index 0e2d2d2a5..0e7c22a22 100644 --- a/app/javascript/components/MapEditor/components/AddressInput.tsx +++ b/app/javascript/components/MapEditor/components/AddressInput.tsx @@ -1,33 +1,33 @@ -import React from 'react'; import { fire } from '@utils'; import type { FeatureCollection } from 'geojson'; -import ComboAdresseSearch from '../../ComboAdresseSearch'; -import { ComboSearchProps } from '~/components/ComboSearch'; +import { RemoteComboBox } from '../../ComboBox'; -export function AddressInput( - comboProps: Pick< - ComboSearchProps, - 'screenReaderInstructions' | 'announceTemplateId' - > & { featureCollection: FeatureCollection; champId: string } -) { +export function AddressInput({ + source, + featureCollection, + champId +}: { + source: string; + featureCollection: FeatureCollection; + champId: string; +}) { return ( -