From 21c7d1de7543b0b9e82c7a65dc5aa7428e0dde22 Mon Sep 17 00:00:00 2001 From: Nishit Suwal <81785002+NSUWAL123@users.noreply.github.com> Date: Fri, 28 Feb 2025 04:18:45 +0545 Subject: [PATCH] feat(frontend): create new feature entities via API prior to ODK collect usage (#2156) * feat(projectDetailsV2): layer add to display new geometries * fix(collect): pass newly created entityId to intent URL instead of passing whole geom * feat(entities): create entity & geometry record function * feat(+page): update newFeature creation workflow passing entity uuid to intent URL * fix(+page): pass entity id as property of new geom record * fix(ITask): update TaskFeatureSelectionProperties type * feat(projectDetailsV2): style new geom feature acc to entity status * refactor(featureSelectionPopup): display feature popup for new entity as well * fix(main): show new entity on map * fix(entities): use entity id instead of osm id to make entity actions available for new features as well * refactor(reviewStateModal): remove featureId from SetUpdateReviewStatusModal action dispatch * fix(+page): after odk redirection close confirmation popup * fix(dialog-entities-actions): update condition --- .../FeatureSelectionPopup.tsx | 50 +-- .../ProjectSubmissions/SubmissionsTable.tsx | 1 - .../UpdateReviewStatusModal.tsx | 6 +- src/frontend/src/store/types/ISubmissions.ts | 1 - src/frontend/src/store/types/ITask.ts | 11 +- src/frontend/src/views/ProjectDetailsV2.tsx | 27 ++ src/frontend/src/views/SubmissionDetails.tsx | 1 - .../components/dialog-entities-actions.svelte | 6 +- src/mapper/src/lib/components/map/main.svelte | 295 ++++++++++++------ src/mapper/src/lib/odk/collect.ts | 12 +- .../src/routes/[projectId]/+page.svelte | 30 +- src/mapper/src/store/entities.svelte.ts | 59 +++- 12 files changed, 359 insertions(+), 140 deletions(-) diff --git a/src/frontend/src/components/ProjectDetailsV2/FeatureSelectionPopup.tsx b/src/frontend/src/components/ProjectDetailsV2/FeatureSelectionPopup.tsx index c5fd496c45..72e89eab55 100644 --- a/src/frontend/src/components/ProjectDetailsV2/FeatureSelectionPopup.tsx +++ b/src/frontend/src/components/ProjectDetailsV2/FeatureSelectionPopup.tsx @@ -20,7 +20,9 @@ const FeatureSelectionPopup = ({ featureProperties, taskId }: FeatureSelectionPo const taskModalStatus = useAppSelector((state) => state.project.taskModalStatus); const entityOsmMap = useAppSelector((state) => state.project.entityOsmMap); const projectId = params.id || ''; - const entity = entityOsmMap.find((x) => x.osm_id === featureProperties?.osm_id); + const entity = entityOsmMap.find( + (x) => x.osm_id === featureProperties?.osm_id || x.id === featureProperties?.entity_id, + ); const submissionIds = entity?.submission_ids ? entity?.submission_ids?.split(',') : []; return ( @@ -37,7 +39,11 @@ const FeatureSelectionPopup = ({ featureProperties, taskId }: FeatureSelectionPo } fmtm-rounded-t-2xl md:fmtm-rounded-tr-none md:fmtm-rounded-l-2xl`} >
- Tags: - {featureProperties?.tags} -
-- Timestamp: - {featureProperties?.timestamp} -
-- Changeset: - {featureProperties?.changeset} -
-- Version: - {featureProperties?.version} -
+ {featureProperties?.changeset && ( ++ Tags: + {featureProperties?.tags} +
++ Timestamp: + {featureProperties?.timestamp} +
++ Changeset: + {featureProperties?.changeset} +
++ Version: + {featureProperties?.version} +
+