diff --git a/appv2/src/UI/Map/Buttons/NewRecord.tsx b/appv2/src/UI/Map/Buttons/NewRecord.tsx index a3ce2ff96..d27591b18 100644 --- a/appv2/src/UI/Map/Buttons/NewRecord.tsx +++ b/appv2/src/UI/Map/Buttons/NewRecord.tsx @@ -43,7 +43,7 @@ export const NewRecord = (props) => { { dispatch({ type: OPEN_NEW_RECORD_MENU }); - history.push('/Records/Activity:') + history.push('/Records/Activity:/form') }} className={ 'leaflet-control-zoom leaflet-bar leaflet-control ' + diff --git a/appv2/src/UI/Overlay/Records/RecordSet.tsx b/appv2/src/UI/Overlay/Records/RecordSet.tsx index f99abf2b2..d846c5c92 100644 --- a/appv2/src/UI/Overlay/Records/RecordSet.tsx +++ b/appv2/src/UI/Overlay/Records/RecordSet.tsx @@ -88,7 +88,7 @@ export const RecordSet = (props) => { }); }} variant="contained"> - {!viewFilters ? ( + {viewFilters ? ( <> diff --git a/appv2/src/state/sagas/activity.ts b/appv2/src/state/sagas/activity.ts index d20828322..77b576b9b 100644 --- a/appv2/src/state/sagas/activity.ts +++ b/appv2/src/state/sagas/activity.ts @@ -194,7 +194,7 @@ function* handle_URL_CHANGE(action) { if (id && id.length === 36 && userSettingsState.activeActivity !== id) yield put({ type: ACTIVITY_GET_REQUEST, payload: { activityID: id } }); - if (userSettingsState.activeActivity) { + else if (userSettingsState.activeActivity) { id = userSettingsState.activeActivity; yield put({ type: ACTIVITY_GET_REQUEST, payload: { activityID: id } }); } diff --git a/appv2/src/state/sagas/activity/dataAccess.ts b/appv2/src/state/sagas/activity/dataAccess.ts index e31585d32..ffd132614 100644 --- a/appv2/src/state/sagas/activity/dataAccess.ts +++ b/appv2/src/state/sagas/activity/dataAccess.ts @@ -59,6 +59,7 @@ import { getFieldsToCopy } from 'rjsf/business-rules/formDataCopyFields'; import { getClosestWells } from 'util/closestWellsHelpers'; import { calc_utm } from 'util/utm'; import { calculateGeometryArea, calculateLatLng } from 'util/geometryHelpers'; +import { kinks } from '@turf/turf'; export function* handle_ACTIVITY_GET_REQUEST(action) { try { @@ -110,6 +111,28 @@ export function* handle_ACTIVITY_UPDATE_GEO_REQUEST(action) { if (latitude && longitude) utm = calc_utm(longitude, latitude); const reported_area = calculateGeometryArea(action.payload.geometry); + + + const isPointGeometry = action.payload.geometry[0].geometry.type === 'Point'; + if (!isPointGeometry) { + const hasSelfIntersections = kinks(action.payload.geometry[0].geometry).features.length > 0; + if (hasSelfIntersections) { + yield put({ + type: ACTIVITY_TOGGLE_NOTIFICATION_SUCCESS, + payload: { + notification: { + visible: true, + message: 'Activity geometry intersects itself', + severity: 'error' + } + } + }); + + return; + } + } + + let wellInformationArr = []; if (reported_area < MAX_AREA) { let nearestWells = null;