Skip to content

Commit

Permalink
Merge pull request #1041 from Eastern-Research-Group/feature/856_upda…
Browse files Browse the repository at this point in the history
…te-padus-service

Feature/856 update padus service
  • Loading branch information
coobr01 authored Nov 26, 2024
2 parents 50cdb96 + b398e2b commit 7b83398
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
20 changes: 4 additions & 16 deletions app/client/src/components/pages/Community.Tabs.Protect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ListContent } from 'components/shared/BoxContent';
import { tabsStyles } from 'components/shared/ContentTabs';
import LoadingSpinner from 'components/shared/LoadingSpinner';
import { AccordionList, AccordionItem } from 'components/shared/Accordion';
import { AccordionItem as AccordionItemHighlight } from 'components/shared/AccordionMapHighlight';
import { errorBoxStyles, infoBoxStyles } from 'components/shared/MessageBoxes';
import TabErrorBoundary from 'components/shared/ErrorBoundary.TabErrorBoundary';
import Switch from 'components/shared/Switch';
Expand Down Expand Up @@ -390,20 +391,6 @@ function Protect() {
updateVisibleLayers({ waterbodyLayer: !waterbodyLayerDisplayed });
}

const [selectedFeature, setSelectedFeature] = useState(null);
useEffect(() => {
if (!mapView || !selectedFeature) return;

// set the highlight
// update context with the new selected graphic
selectedFeature.attributes['zoom'] = true;
selectedFeature.attributes['fieldName'] = protectedAreasIdKey;
setSelectedGraphic(selectedFeature);

// reset the selectedFeature
setSelectedFeature(null);
}, [mapView, selectedFeature, setSelectedGraphic]);

// Initialize the visibility of several layers. This will be used
// to reset their visibility when the user leaves this tab.
const [initialAllWaterbodiesVisibility, setInitialAllWaterbodiesVisibility] =
Expand Down Expand Up @@ -1003,8 +990,9 @@ function Protect() {
const attributes = item.attributes;
const fields = protectedAreasData.fields;
return (
<AccordionItem
<AccordionItemHighlight
key={`protected-area-${attributes.OBJECTID}`}
idKey={protectedAreasIdKey}
feature={item}
title={
<strong>
Expand Down Expand Up @@ -1064,7 +1052,7 @@ function Protect() {
}}
/>
</div>
</AccordionItem>
</AccordionItemHighlight>
);
})}
</AccordionList>
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/components/shared/BoxContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { SerializedStyles } from '@emotion/react';
## Styles
*/
const contentStyles = css`
background-color: inherit;
background-color: none;
`;

const flexRowStyles = css`
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/utils/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ function useWaterbodyHighlight(findOthers: boolean = true) {

// check if the graphic is the same as the currently highlighted graphic
// remove the highlight if the graphic is different
let equal = graphicComparison(graphic, currentHighlight);
let selectionEqual = graphicComparison(selectedGraphic, currentSelection);
const equal = graphicComparison(graphic, currentHighlight);
const selectionEqual = graphicComparison(selectedGraphic, currentSelection);
if (equal && selectionEqual) return;

// set the currentSelection if it changed
Expand Down

0 comments on commit 7b83398

Please sign in to comment.