Skip to content

Commit

Permalink
Autosave ownership layer display
Browse files Browse the repository at this point in the history
  • Loading branch information
rogup committed Dec 12, 2023
1 parent 2f58aaf commit 8c9cf49
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/actions/MapActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const saveCurrentMap = (
mapLayers: {
landDataLayers: getState().mapLayers.landDataLayers,
myDataLayers: getState().dataGroups.activeGroups,
ownershipDisplay: getState().landOwnership.displayActive,
},
version: VERSION,
name: saveName,
Expand Down
3 changes: 2 additions & 1 deletion src/components/left-pane/LeftPaneLandData.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import LeftPaneToggle from "./LeftPaneToggle";
import Draggable from "./Draggable";
import LandDataLayerToggle from "./LandDataLayerToggle";
import { toggleDataGroup } from "../../actions/DataGroupActions";
import { togglePropertyDisplay } from "../../actions/LandOwnershipActions";

const DataLayersContainer = ({ children, title }) => {
const [expanded, setExpanded] = useState(true);
Expand Down Expand Up @@ -120,7 +121,7 @@ const LeftPaneLandData = ({ open, active, onClose }) => {
<LeftPaneToggle
title={"Property Boundaries"}
on={landOwnershipActive}
onToggle={() => dispatch({ type: "TOGGLE_PROPERTY_DISPLAY" })}
onToggle={() => dispatch(togglePropertyDisplay())}
/>
</DataLayersContainer>
<DataLayersContainer title={"Administrative Boundaries"}>
Expand Down
7 changes: 7 additions & 0 deletions src/reducers/LandOwnershipReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export default (state = INITIAL_STATE, action) => {
...state,
activePropertyId: null
};
case 'LOAD_MAP':
// this could be undefined for old maps
const displayActive = action.payload.data.mapLayers.ownershipDisplay || false;
return {
...state,
displayActive
}
default:
return state;
}
Expand Down

0 comments on commit 8c9cf49

Please sign in to comment.