66 * LICENSE file in the root directory of this source tree.
77 */
88
9- import React from 'react' ;
9+ import React , { useState } from 'react' ;
1010import { connect , createPlugin } from '../utils/PluginsUtils' ;
1111import { Glyphicon } from 'react-bootstrap' ;
1212import Message from '../components/I18N/Message' ;
@@ -22,7 +22,6 @@ import { mapIdSelector, mapSelector } from '../selectors/map';
2222import { currentContextSelector } from '../selectors/context' ;
2323import { get } from 'lodash' ;
2424import controls from '../reducers/controls' ;
25- import { changeFormat } from '../actions/mapInfo' ;
2625import { addMarker , hideMarker } from '../actions/search' ;
2726import { updateMapView } from '../actions/map' ;
2827import { resourceSelector as geostoryResourceSelector , updateUrlOnScrollSelector } from '../selectors/geostory' ;
@@ -69,7 +68,6 @@ const Share = connect(createSelector([
6968 mapTypeSelector ,
7069 currentContextSelector ,
7170 state => get ( state , 'controls.share.settings' , { } ) ,
72- ( state ) => state . mapInfo && state . mapInfo . formatCoord || ConfigUtils . getConfigProp ( "defaultCoordinateFormat" ) ,
7371 state => state . search && state . search . markerPosition || { } ,
7472 updateUrlOnScrollSelector ,
7573 state => get ( state , 'map.present.viewerOptions' ) ,
@@ -84,7 +82,7 @@ const Share = connect(createSelector([
8482 } ,
8583 state => get ( state , 'controls.share.resource.shareUrl' ) || location . href ,
8684 state => get ( state , 'controls.share.resource.categoryName' )
87- ] , ( isVisible , version , map , mapType , context , settings , formatCoords , point , isScrollPosition , viewerOptions , center , shareUrl , categoryName ) => ( {
85+ ] , ( isVisible , version , map , mapType , context , settings , point , isScrollPosition , viewerOptions , center , shareUrl , categoryName ) => ( {
8886 isVisible,
8987 shareUrl,
9088 shareApiUrl : getApiUrl ( shareUrl ) ,
@@ -104,20 +102,19 @@ const Share = connect(createSelector([
104102 bbox : true ,
105103 centerAndZoom : true
106104 } ,
107- formatCoords : formatCoords ,
108105 point,
109106 isScrollPosition,
110107 categoryName} ) ) , {
111108 onClose : toggleControl . bind ( null , 'share' , null ) ,
112109 hideMarker,
113110 updateMapView,
114111 onUpdateSettings : setControlProperty . bind ( null , 'share' , 'settings' ) ,
115- onChangeFormat : changeFormat ,
116112 addMarker : addMarker ,
117113 onClearShareResource : setControlProperty . bind ( null , 'share' , 'resource' , undefined )
118114} ) ( ( { categoryName, ...props } ) => {
115+ const [ formatCoord , setFormatCoords ] = useState ( ConfigUtils . getConfigProp ( "defaultCoordinateFormat" ) || 'decimal' ) ;
119116 const categoryCfg = props [ categoryName ] ;
120- return < SharePanel { ...props } { ...categoryCfg } /> ;
117+ return < SharePanel { ...props } { ...categoryCfg } onChangeFormat = { setFormatCoords } formatCoords = { formatCoord } /> ;
121118} ) ;
122119
123120const ActionCardShareButton = connect (
0 commit comments