From 98471f9c518b8cdc42505faa6385ad2e1841e4ee Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 13 Jan 2025 16:53:32 +0545 Subject: [PATCH 01/14] feat(package): turf/distance package add for distance calculation between two points --- src/mapper/package.json | 1 + src/mapper/pnpm-lock.yaml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/mapper/package.json b/src/mapper/package.json index 96d7fdd40..c420953e2 100644 --- a/src/mapper/package.json +++ b/src/mapper/package.json @@ -52,6 +52,7 @@ "@turf/bbox": "^7.1.0", "@turf/buffer": "^7.1.0", "@turf/centroid": "^7.1.0", + "@turf/distance": "^7.2.0", "@turf/helpers": "^7.1.0", "@watergis/maplibre-gl-terradraw": "^0.5.1", "drizzle-orm": "^0.35.3", diff --git a/src/mapper/pnpm-lock.yaml b/src/mapper/pnpm-lock.yaml index e937886cd..ea1299321 100644 --- a/src/mapper/pnpm-lock.yaml +++ b/src/mapper/pnpm-lock.yaml @@ -41,6 +41,9 @@ importers: '@turf/centroid': specifier: ^7.1.0 version: 7.1.0 + '@turf/distance': + specifier: ^7.2.0 + version: 7.2.0 '@turf/helpers': specifier: ^7.1.0 version: 7.1.0 @@ -1447,9 +1450,18 @@ packages: '@turf/clone@7.1.0': resolution: {integrity: sha512-5R9qeWvL7FDdBIbEemd0eCzOStr09oburDvJ1hRiPCFX6rPgzcZBQ0gDmZzoF4AFcNLb5IwknbLZjVLaUGWtFA==} + '@turf/distance@7.2.0': + resolution: {integrity: sha512-HBjjXIgEcD/wJYjv7/6OZj5yoky2oUvTtVeIAqO3lL80XRvoYmVg6vkOIu6NswkerwLDDNT9kl7+BFLJoHbh6Q==} + '@turf/helpers@7.1.0': resolution: {integrity: sha512-dTeILEUVeNbaEeoZUOhxH5auv7WWlOShbx7QSd4s0T4Z0/iz90z9yaVCtZOLbU89umKotwKaJQltBNO9CzVgaQ==} + '@turf/helpers@7.2.0': + resolution: {integrity: sha512-cXo7bKNZoa7aC7ydLmUR02oB3IgDe7MxiPuRz3cCtYQHn+BJ6h1tihmamYDWWUlPHgSNF0i3ATc4WmDECZafKw==} + + '@turf/invariant@7.2.0': + resolution: {integrity: sha512-kV4u8e7Gkpq+kPbAKNC21CmyrXzlbBgFjO1PhrHPgEdNqXqDawoZ3i6ivE3ULJj2rSesCjduUaC/wyvH/sNr2Q==} + '@turf/jsts@2.7.1': resolution: {integrity: sha512-+nwOKme/aUprsxnLSfr2LylV6eL6T1Tuln+4Hl92uwZ8FrmjDRCH5Bi1LJNVfWCiYgk8+5K+t2zDphWNTsIFDA==} @@ -5140,11 +5152,29 @@ snapshots: '@types/geojson': 7946.0.14 tslib: 2.8.1 + '@turf/distance@7.2.0': + dependencies: + '@turf/helpers': 7.2.0 + '@turf/invariant': 7.2.0 + '@types/geojson': 7946.0.14 + tslib: 2.8.1 + '@turf/helpers@7.1.0': dependencies: '@types/geojson': 7946.0.14 tslib: 2.8.1 + '@turf/helpers@7.2.0': + dependencies: + '@types/geojson': 7946.0.14 + tslib: 2.8.1 + + '@turf/invariant@7.2.0': + dependencies: + '@turf/helpers': 7.2.0 + '@types/geojson': 7946.0.14 + tslib: 2.8.1 + '@turf/jsts@2.7.1': dependencies: jsts: 2.7.1 From ecb67799815c96a6587ead54897cd62b85d913df Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 13 Jan 2025 16:53:58 +0545 Subject: [PATCH 02/14] fix(types): ProjectData type update --- src/mapper/src/lib/types.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mapper/src/lib/types.ts b/src/mapper/src/lib/types.ts index 22165ffc4..2bc0c82e1 100644 --- a/src/mapper/src/lib/types.ts +++ b/src/mapper/src/lib/types.ts @@ -40,6 +40,8 @@ export interface ProjectData { status: number; hashtags: string[]; tasks: ProjectTask[]; + geo_restrict_distance_meters: number; + geo_restrict_force_error: boolean; } export interface ZoomToTaskEventDetail { From d2cfabd12d3ca622026d94300aa9090f97b6287e Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 13 Jan 2025 16:54:43 +0545 Subject: [PATCH 03/14] fix(geolocation): reset userLocation coordinate if location disabled --- src/mapper/src/lib/components/map/geolocation.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mapper/src/lib/components/map/geolocation.svelte b/src/mapper/src/lib/components/map/geolocation.svelte index bf81aed13..50e5aee18 100644 --- a/src/mapper/src/lib/components/map/geolocation.svelte +++ b/src/mapper/src/lib/components/map/geolocation.svelte @@ -244,6 +244,7 @@ on:click={() => { entitiesStore.setToggleGeolocation(!entitiesStore.toggleGeolocation); if (!entitiesStore.toggleGeolocation) { + entitiesStore.setUserLocationCoordinate(undefined); exitNavigationMode(); } }} From c053890f8f461d9a83e40a413f86f7044f9d34f5 Mon Sep 17 00:00:00 2001 From: NSUWAL123 Date: Mon, 13 Jan 2025 16:58:06 +0545 Subject: [PATCH 04/14] feat(dialog-entities-actions): function add to check validity of distance between user and entity --- .../components/dialog-entities-actions.svelte | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/mapper/src/lib/components/dialog-entities-actions.svelte b/src/mapper/src/lib/components/dialog-entities-actions.svelte index 991af3721..59f862786 100644 --- a/src/mapper/src/lib/components/dialog-entities-actions.svelte +++ b/src/mapper/src/lib/components/dialog-entities-actions.svelte @@ -1,4 +1,6 @@