diff --git a/js/extension/cadastrapp.css b/js/extension/cadastrapp.css index bf0be3c..b14cfc9 100644 --- a/js/extension/cadastrapp.css +++ b/js/extension/cadastrapp.css @@ -335,3 +335,9 @@ input.request-obj-double.form-control{ .cadastrapp-modal .react-grid-Cell, .cadastrapp .react-grid-Grid .react-grid-Cell { user-select: text; } + +.cadstrap_selectionToolsButton { + display: flex; + justify-content: center; + margin: 10px 0 10px 0; +} \ No newline at end of file diff --git a/js/extension/components/search/PlotSearch.jsx b/js/extension/components/search/PlotSearch.jsx index 37d7c5d..58f677e 100644 --- a/js/extension/components/search/PlotSearch.jsx +++ b/js/extension/components/search/PlotSearch.jsx @@ -12,6 +12,7 @@ import Identifier from '../forms/Identifier'; import Lot from '../forms/Lot'; import useFormState from '../../hooks/useFormState'; import SearchButtons from './SearchButtons'; +import SelectionTools from '@js/extension/plugins/cadastrapp/toolbar/SelectionTools'; export default function PlotsSearch({onSearch = () => {}, loading}) { const [currentTab, setCurrentTab] = useState('reference'); @@ -20,6 +21,9 @@ export default function PlotsSearch({onSearch = () => {}, loading}) { return (

+
+ +
setCurrentTab(k)} diff --git a/js/extension/plugins/cadastrapp/MainToolbar.jsx b/js/extension/plugins/cadastrapp/MainToolbar.jsx index 9750a04..76491a6 100644 --- a/js/extension/plugins/cadastrapp/MainToolbar.jsx +++ b/js/extension/plugins/cadastrapp/MainToolbar.jsx @@ -11,8 +11,8 @@ import HelpButton from './toolbar/Help'; export default function MainToolbar(props) { return (
- + diff --git a/js/extension/plugins/cadastrapp/toolbar/SelectionTools.jsx b/js/extension/plugins/cadastrapp/toolbar/SelectionTools.jsx index de40720..16aa7f3 100644 --- a/js/extension/plugins/cadastrapp/toolbar/SelectionTools.jsx +++ b/js/extension/plugins/cadastrapp/toolbar/SelectionTools.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { SELECTION_TYPES } from '../../../constants'; import { toggleSelectionTool } from '../../../actions/cadastrapp'; import { currentSelectionToolSelector } from '../../../selectors/cadastrapp'; @@ -43,11 +43,11 @@ const BUTTONS_SETTINGS = { * They are mutually exclusive and allow to start a selection on map. */ function SelectionTools({ foncier = true, currentTool, onClick = () => {} }) { - + useEffect(() => onClick("POINT"), []); return <> { Object.keys(SELECTION_TYPES) - .filter(k => foncier ? true : k !== SELECTION_TYPES.LANDED_PROPERTY) // if foncier: false, do not show landed property button + .filter(k => foncier ? k === SELECTION_TYPES.LANDED_PROPERTY : k !== SELECTION_TYPES.LANDED_PROPERTY) // if foncier: false, do not show landed property button, if true show only landed prop button .map(k => SELECTION_TYPES[k]) .map(toolName => { const isActive = toolName === currentTool; @@ -55,7 +55,9 @@ function SelectionTools({ foncier = true, currentTool, onClick = () => {} }) { bsStyle={isActive && "success"} {...BUTTONS_SETTINGS[toolName]} // if the current selection button is clicked, it turns off selection - onClick={() => isActive ? onClick() : onClick(toolName)} + onClick={() => { + isActive ? onClick() : onClick(toolName); + }} />); }) }