From 6ec6f015d587311f97b061d204c78502e25e1d6b Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 11:18:44 +0545
Subject: [PATCH 01/24] feat(project-description): round off area to 3 decimal
place and use task index insted of task id while displaying on task list
---
.../DescriptionSection/DescriptionBox/index.tsx | 2 +-
.../IndividualProject/Contributions/TableSection/index.tsx | 2 +-
.../IndividualProject/Tasks/TableSection/index.tsx | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx
index 596fd294..bb39b42d 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx
@@ -29,7 +29,7 @@ const DescriptionBox = () => {
{
name: 'Total task area',
value: taskData?.task_area
- ? `${taskData?.task_area} km²`
+ ? `${Number(taskData?.task_area)?.toFixed(3)} km²`
: null,
},
{
diff --git a/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx b/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx
index 3a26db52..7279bbeb 100644
--- a/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/Contributions/TableSection/index.tsx
@@ -28,7 +28,7 @@ export default function TableSection() {
...acc,
{
user: curr?.name || '-',
- task_mapped: curr?.id,
+ task_mapped: `Task# ${curr?.project_task_index}`,
task_state: curr?.state,
},
];
diff --git a/src/frontend/src/components/IndividualProject/Tasks/TableSection/index.tsx b/src/frontend/src/components/IndividualProject/Tasks/TableSection/index.tsx
index 29a17fe5..f190e8ec 100644
--- a/src/frontend/src/components/IndividualProject/Tasks/TableSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/Tasks/TableSection/index.tsx
@@ -12,7 +12,7 @@ const tasksDataColumns = [
accessorKey: 'flight_time',
},
{
- header: 'Task Area',
+ header: 'Task Area in km²',
accessorKey: 'task_area',
},
// {
@@ -32,9 +32,9 @@ export default function TableSection() {
return [
...acc,
{
- id: curr?.id,
+ id: `Task# ${curr?.project_task_index}`,
flight_time: curr?.flight_time || '-',
- task_area: curr?.task_area,
+ task_area: Number(curr?.task_area)?.toFixed(3),
// status: curr?.state,
},
];
From 0970fa5ab6caacf9032a4211913f0a0bdd598a94 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 14:45:01 +0545
Subject: [PATCH 02/24] feat(individual-project): show project boundary on map
---
.../IndividualProject/MapSection/index.tsx | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/frontend/src/components/IndividualProject/MapSection/index.tsx b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
index 357abb2e..1b3a233c 100644
--- a/src/frontend/src/components/IndividualProject/MapSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
@@ -54,6 +54,7 @@ const MapSection = () => {
state => state.project.selectedTaskId,
);
const tasksData = useTypedSelector(state => state.project.tasksData);
+ const projectArea = useTypedSelector(state => state.project.projectArea);
const { data: taskStates } = useGetTaskStatesQuery(id as string, {
enabled: !!tasksData,
@@ -152,6 +153,27 @@ const MapSection = () => {
height: '100%',
}}
>
+ {projectArea && (
+
+ )}
+
{taskStatusObj &&
tasksData &&
tasksData?.map((task: Record) => {
From c65079a81acb546a072401ed1c8f79cf17aef058 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 16:04:07 +0545
Subject: [PATCH 03/24] feat: create Legend component
---
src/frontend/src/assets/images/area-icon.png | Bin 0 -> 952 bytes
.../IndividualProject/MapSection/Legend.tsx | 55 ++++++++++++++++++
2 files changed, 55 insertions(+)
create mode 100644 src/frontend/src/assets/images/area-icon.png
create mode 100644 src/frontend/src/components/IndividualProject/MapSection/Legend.tsx
diff --git a/src/frontend/src/assets/images/area-icon.png b/src/frontend/src/assets/images/area-icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..4ed9019b4e24dc54463aa938d977192b25823fd1
GIT binary patch
literal 952
zcmV;p14sOcP)b0WNOL;!!QkmLLigCg3ojv^k{N2nTW?t&RAMt#L8g9jmC8pG%SVKoor@oVr&eq
z&(6GdTS1#iVVL40Bk*W^93Gn{B=Aa*d~guH&dhkv#2}&?rBKuu#|H*nm_GdUBNzb^
zXd^WRS}%p70T@LmQHGMyilR`^suT)A?YcmuS}AOYV%<(*WYE4u;xk^8-AZ9p#SkpZ
z0wtr9DU7NZIL-lZK2ME->1lYjveMBMMipmr&sBk{Ta$nL`;c2)bg!LQsE}cQZ*NzA
z8(@zd9``SIyHDs0xf13*Q9qA>_D_B1_P%M)~LZy3ai5
z@Kn$|ErEg`+QKL=F~%}s-_x1ElZ6HMB&D9n;i`Ga;bG>93!sI{ukwLcE04v`9mZ
zDBq!hWQn6~PeFM-b`4ZjqbNfY4i8hu{@HM1StfU!Rn>g7j=+?sT7@i+?X1)iS9bUw
aM9@9iIf*B {
+ const [showLegendItems, setShowLegendItems] = useState(false);
+ return (
+
+
+
Legend
+
setShowLegendItems(!showLegendItems)}
+ >
+ {showLegendItems ? 'expand_less' : 'expand_more'}
+
+
+ {showLegendItems && (
+
+
+
+
+
+
+
+
Locked Tasks
+
+
+
+
+
+
+
Project Area
+
+
+
+ )}
+
+ );
+};
+
+export default Legend;
From d6c665f734fcdbeac3bfcbfbe605fe5d38b65d51 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 16:04:39 +0545
Subject: [PATCH 04/24] feat(individual-project): add legend on map
---
.../src/components/IndividualProject/MapSection/index.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/frontend/src/components/IndividualProject/MapSection/index.tsx b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
index 1b3a233c..d2a04950 100644
--- a/src/frontend/src/components/IndividualProject/MapSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
@@ -23,6 +23,7 @@ import { postTaskStatus } from '@Services/project';
import { useMutation } from '@tanstack/react-query';
import { toast } from 'react-toastify';
import hasErrorBoundary from '@Utils/hasErrorBoundary';
+import Legend from './Legend';
const MapSection = () => {
const { id } = useParams();
@@ -259,6 +260,7 @@ const MapSection = () => {
: navigate(`/projects/${id}/tasks/${selectedTaskId}`)
}
/>
+
);
From d319c8db1a473855579429547b95c7fd5502035c Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 16:25:22 +0545
Subject: [PATCH 05/24] style(individual-project): increase project area line
width and locked task opacity for better visualization
---
.../src/components/IndividualProject/MapSection/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/frontend/src/components/IndividualProject/MapSection/index.tsx b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
index d2a04950..c8a4bef1 100644
--- a/src/frontend/src/components/IndividualProject/MapSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
@@ -169,7 +169,7 @@ const MapSection = () => {
type: 'line',
paint: {
'line-color': '#D73F3F',
- 'line-width': 1,
+ 'line-width': 2,
},
}}
/>
@@ -193,7 +193,7 @@ const MapSection = () => {
paint: {
'fill-color': '#98BBC8',
'fill-outline-color': '#484848',
- 'fill-opacity': 0.6,
+ 'fill-opacity': 0.8,
},
}
: taskStatusObj?.[`${task?.id}`] === 'REQUEST_FOR_MAPPING'
From 464237bef83915bd14d47d75e26c901617daa896 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 16:28:20 +0545
Subject: [PATCH 06/24] feat(individual-project): show no-fly-zone on map
---
.../IndividualProject/MapSection/Legend.tsx | 2 +-
.../IndividualProject/MapSection/index.tsx | 22 +++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/frontend/src/components/IndividualProject/MapSection/Legend.tsx b/src/frontend/src/components/IndividualProject/MapSection/Legend.tsx
index 64b5dd01..3d875178 100644
--- a/src/frontend/src/components/IndividualProject/MapSection/Legend.tsx
+++ b/src/frontend/src/components/IndividualProject/MapSection/Legend.tsx
@@ -43,7 +43,7 @@ const Legend = () => {
Project Area
diff --git a/src/frontend/src/components/IndividualProject/MapSection/index.tsx b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
index c8a4bef1..0962aa4a 100644
--- a/src/frontend/src/components/IndividualProject/MapSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
@@ -175,6 +175,28 @@ const MapSection = () => {
/>
)}
+ {projectData?.no_fly_zones_geojson && (
+
+ )}
+
{taskStatusObj &&
tasksData &&
tasksData?.map((task: Record) => {
From cfb19879506debdca53ed63725f43d43e35b53de Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 17:58:15 +0545
Subject: [PATCH 07/24] feat(project-creation): add measurementType state on
redux slice
---
src/frontend/src/store/slices/createproject.ts | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/frontend/src/store/slices/createproject.ts b/src/frontend/src/store/slices/createproject.ts
index 63023805..abf0f070 100644
--- a/src/frontend/src/store/slices/createproject.ts
+++ b/src/frontend/src/store/slices/createproject.ts
@@ -7,6 +7,7 @@ export interface CreateProjectState {
projectId: number | null;
activeStep: number;
keyParamOption: 'basic' | 'advanced';
+ measurementType: 'gsd' | 'altitude';
contributionsOption: 'public' | 'invite_with_email';
generateTaskOption: 'divide_hexagon' | 'divide_rectangle';
isNoflyzonePresent: 'yes' | 'no';
@@ -25,6 +26,7 @@ const initialState: CreateProjectState = {
projectId: null,
activeStep: 1,
keyParamOption: 'basic',
+ measurementType: 'gsd',
contributionsOption: 'public',
generateTaskOption: 'divide_rectangle',
isNoflyzonePresent: 'no',
From fbed1674ee68451643a3ff6386a80dd5c214e79c Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 18:00:50 +0545
Subject: [PATCH 08/24] feat(project-creation): add option to input `GSD` or
`altitude` on project creation
---
.../CreateprojectLayout/index.tsx | 5 ++
.../FormContents/KeyParameters/index.tsx | 71 +++++++++++++++----
2 files changed, 64 insertions(+), 12 deletions(-)
diff --git a/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx b/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx
index 18f563a5..941950b0 100644
--- a/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx
+++ b/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx
@@ -77,6 +77,9 @@ const CreateprojectLayout = () => {
const requireApprovalFromManagerForLocking = useTypedSelector(
state => state.createproject.requireApprovalFromManagerForLocking,
);
+ const measurementType = useTypedSelector(
+ state => state.createproject.measurementType,
+ );
const initialState: FieldValues = {
name: '',
@@ -213,6 +216,8 @@ const CreateprojectLayout = () => {
if (isNoflyzonePresent === 'no')
delete refactoredData?.outline_no_fly_zones;
delete refactoredData?.dem;
+ if (measurementType === 'gsd') delete refactoredData?.altitude_from_ground;
+ else delete refactoredData?.gsd_cm_px;
// make form data with value JSON stringify to combine value on single json / form data with only 2 keys (backend didn't found project_info on non-stringified data)
const formData = new FormData();
diff --git a/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx b/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
index 167f2332..7acf9b15 100644
--- a/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
+++ b/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
@@ -1,7 +1,7 @@
/* eslint-disable camelcase */
import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
import { FormControl, Label, Input } from '@Components/common/FormUI';
-// import RadioButton from '@Components/common/RadioButton';
+import RadioButton from '@Components/common/RadioButton';
import ErrorMessage from '@Components/common/FormUI/ErrorMessage';
import { UseFormPropsType } from '@Components/common/FormUI/types';
import { setCreateProjectState } from '@Store/actions/createproject';
@@ -32,15 +32,31 @@ const FinalOutputOptions = [
},
];
+const measurementTypeOptions = [
+ {
+ name: 'GSD',
+ value: 'gsd',
+ label: 'GSD',
+ },
+ {
+ name: 'Altitude',
+ value: 'altitude',
+ label: 'Altitude',
+ },
+];
+
const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
const dispatch = useTypedDispatch();
- const { register, errors, watch, control } = formProps;
+ const { register, errors, watch, control, setValue } = formProps;
const final_output = watch('final_output');
const keyParamOption = useTypedSelector(
state => state.createproject.keyParamOption,
);
+ const measurementType = useTypedSelector(
+ state => state.createproject.measurementType,
+ );
const isTerrainFollow = useTypedSelector(
state => state.createproject.isTerrainFollow,
);
@@ -60,18 +76,49 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
/> */}
{keyParamOption === 'basic' ? (
<>
-
-
-
+
+ {
+ dispatch(setCreateProjectState({ measurementType: val }));
+ setValue('gsd_cm_px', '');
+ setValue('altitude_from_ground', '');
+ }}
+ value={measurementType}
/>
-
+
+ {measurementType === 'gsd' ? (
+
+
+
+
+
+ ) : (
+
+
+
+
+
+ )}
From aa82a1bd9b9cb44b803b93e23b63d6a6d5cc41a8 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Wed, 21 Aug 2024 18:04:47 +0545
Subject: [PATCH 09/24] refactor(project-creartion): move constant data to
separate file
---
.../FormContents/KeyParameters/index.tsx | 36 +++----------------
src/frontend/src/constants/createProject.tsx | 32 +++++++++++++++++
2 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx b/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
index 7acf9b15..ed1258b2 100644
--- a/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
+++ b/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
@@ -7,44 +7,16 @@ import { UseFormPropsType } from '@Components/common/FormUI/types';
import { setCreateProjectState } from '@Store/actions/createproject';
import hasErrorBoundary from '@Utils/hasErrorBoundary';
// import { terrainOptions } from '@Constants/createProject';
-import orthoPhotoIcon from '@Assets/images/ortho-photo-icon.svg';
-import _3DModal from '@Assets/images/3d-model-icon.svg';
-import DTMIcon from '@Assets/images/DTM-Icon.svg';
-import DSMIcon from '@Assets/images/DSM-icon.svg';
import { FlexRow } from '@Components/common/Layouts';
import Switch from '@Components/RadixComponents/Switch';
import FileUpload from '@Components/common/UploadArea';
+import {
+ FinalOutputOptions,
+ measurementTypeOptions,
+} from '@Constants/createProject';
import { Controller } from 'react-hook-form';
import OutputOptions from './OutputOptions';
-const FinalOutputOptions = [
- { label: '2D Orthophoto', value: 'ORTHOPHOTO_2D', icon: orthoPhotoIcon },
- { label: '3D Model', value: 'ORTHOPHOTO_3D', icon: _3DModal },
- {
- label: 'Digital Terrain Model (DTM)',
- value: 'DIGITAL_TERRAIN_MODEL',
- icon: DTMIcon,
- },
- {
- label: 'Digital Surface Model (DSM)',
- value: 'DIGITAL_SURFACE_MODEL',
- icon: DSMIcon,
- },
-];
-
-const measurementTypeOptions = [
- {
- name: 'GSD',
- value: 'gsd',
- label: 'GSD',
- },
- {
- name: 'Altitude',
- value: 'altitude',
- label: 'Altitude',
- },
-];
-
const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
const dispatch = useTypedDispatch();
diff --git a/src/frontend/src/constants/createProject.tsx b/src/frontend/src/constants/createProject.tsx
index 62c8c7a2..69d07037 100644
--- a/src/frontend/src/constants/createProject.tsx
+++ b/src/frontend/src/constants/createProject.tsx
@@ -10,6 +10,10 @@ import {
Contributions,
GenerateTask,
} from '@Components/CreateProject/DescriptionContents';
+import orthoPhotoIcon from '@Assets/images/ortho-photo-icon.svg';
+import _3DModal from '@Assets/images/3d-model-icon.svg';
+import DTMIcon from '@Assets/images/DTM-Icon.svg';
+import DSMIcon from '@Assets/images/DSM-icon.svg';
export type StepComponentMap = {
[key: number]: React.FC;
@@ -155,3 +159,31 @@ export const lockApprovalOptions = [
{ name: 'Required', label: 'Required', value: 'required' },
{ name: 'Not Required', label: 'Not Required', value: 'not_required' },
];
+
+export const FinalOutputOptions = [
+ { label: '2D Orthophoto', value: 'ORTHOPHOTO_2D', icon: orthoPhotoIcon },
+ { label: '3D Model', value: 'ORTHOPHOTO_3D', icon: _3DModal },
+ {
+ label: 'Digital Terrain Model (DTM)',
+ value: 'DIGITAL_TERRAIN_MODEL',
+ icon: DTMIcon,
+ },
+ {
+ label: 'Digital Surface Model (DSM)',
+ value: 'DIGITAL_SURFACE_MODEL',
+ icon: DSMIcon,
+ },
+];
+
+export const measurementTypeOptions = [
+ {
+ name: 'GSD',
+ value: 'gsd',
+ label: 'GSD',
+ },
+ {
+ name: 'Altitude',
+ value: 'altitude',
+ label: 'Altitude',
+ },
+];
From 75ed675f73f17f4f0cc9254e3b4ee2b6973f7aea Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 10:01:18 +0545
Subject: [PATCH 10/24] feat: get coordinates on properties on map feature
click
---
.../MapLibreComponents/AsyncPopup/index.tsx | 20 ++++++++++++++-----
.../common/MapLibreComponents/types/index.ts | 1 +
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/frontend/src/components/common/MapLibreComponents/AsyncPopup/index.tsx b/src/frontend/src/components/common/MapLibreComponents/AsyncPopup/index.tsx
index e4e464da..e054dbb8 100644
--- a/src/frontend/src/components/common/MapLibreComponents/AsyncPopup/index.tsx
+++ b/src/frontend/src/components/common/MapLibreComponents/AsyncPopup/index.tsx
@@ -25,6 +25,7 @@ export default function AsyncPopup({
onClose,
buttonText = 'View More',
hideButton = false,
+ getCoordOnProperties = false,
}: IAsyncPopup) {
const [properties, setProperties] = useState | null>(
null,
@@ -39,14 +40,23 @@ export default function AsyncPopup({
const features = map.queryRenderedFeatures(e.point);
const clickedFeature = features?.[0];
if (!clickedFeature) return;
- setProperties({
- ...clickedFeature.properties,
- layer: clickedFeature.source,
- });
+ setProperties(
+ getCoordOnProperties
+ ? {
+ ...clickedFeature.properties,
+ layer: clickedFeature.source,
+ coordinates: e.lngLat,
+ }
+ : {
+ ...clickedFeature.properties,
+ layer: clickedFeature.source,
+ },
+ );
+
popup.setLngLat(e.lngLat);
}
map.on('click', displayPopup);
- }, [map]);
+ }, [map, getCoordOnProperties]);
useEffect(() => {
if (!map || !properties) return;
diff --git a/src/frontend/src/components/common/MapLibreComponents/types/index.ts b/src/frontend/src/components/common/MapLibreComponents/types/index.ts
index 80295ab4..b7bcbef4 100644
--- a/src/frontend/src/components/common/MapLibreComponents/types/index.ts
+++ b/src/frontend/src/components/common/MapLibreComponents/types/index.ts
@@ -80,6 +80,7 @@ export interface IAsyncPopup {
onClose?: () => void;
buttonText?: string;
hideButton?: boolean;
+ getCoordOnProperties?: boolean;
}
export type DrawModeTypes = DrawMode | null | undefined;
From 856b94a597f14288304fcfef570451c5c2a8f61c Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 10:04:53 +0545
Subject: [PATCH 11/24] style(project-creation): replace `-` with `:`
---
.../CreateProject/FormContents/KeyParameters/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx b/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
index ed1258b2..a7203153 100644
--- a/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
+++ b/src/frontend/src/components/CreateProject/FormContents/KeyParameters/index.tsx
@@ -107,7 +107,7 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
- Recommended - 75%
+ Recommended : 75%
@@ -124,7 +124,7 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
- Recommended - 60%
+ Recommended : 60%
From 12aa95953f18fc0d59b5e1b5447d4fa18fd615e5 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 10:06:58 +0545
Subject: [PATCH 12/24] feat(task-description): show description on popup of
waypoints point on click
---
.../DroneOperatorTask/MapSection/index.tsx | 35 ++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx b/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx
index ae60a800..8523f335 100644
--- a/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx
@@ -1,5 +1,5 @@
/* eslint-disable react/no-array-index-key */
-import { useEffect } from 'react';
+import { useCallback, useEffect, useState } from 'react';
import { LngLatBoundsLike, Map } from 'maplibre-gl';
import { useParams } from 'react-router-dom';
import { FeatureCollection } from 'geojson';
@@ -14,9 +14,11 @@ import { GeojsonType } from '@Components/common/MapLibreComponents/types';
import right from '@Assets/images/rightArrow.png';
import marker from '@Assets/images/marker.png';
import hasErrorBoundary from '@Utils/hasErrorBoundary';
+import AsyncPopup from '@Components/common/MapLibreComponents/AsyncPopup';
const MapSection = () => {
const { projectId, taskId } = useParams();
+ const [popupData, setPopupData] = useState>({});
const { map, isMapLoaded } = useMapLibreGLMap({
containerId: 'dashboard-map',
mapOptions: {
@@ -61,6 +63,25 @@ const MapSection = () => {
map?.fitBounds(bbox as LngLatBoundsLike, { padding: 25 });
}, [map, taskWayPoints]);
+ const getPopupUI = useCallback(() => {
+ return (
+
+
+ {popupData?.index}
+
+ {popupData?.coordinates?.lat}, {popupData?.coordinates?.lng}{' '}
+
+
+
+
angle: {popupData?.angle} degree
+
+ gimble angle: {popupData?.gimbal_angle} degree
+
+
+
+ );
+ }, [popupData]);
+
return (
<>
@@ -102,6 +123,7 @@ const MapSection = () => {
id="waypoint-points"
geojson={taskWayPoints?.geojsonListOfPoint as GeojsonType}
visibleOnMap={!!taskWayPoints}
+ interactions={['feature']}
layerOptions={{
type: 'circle',
paint: {
@@ -141,6 +163,17 @@ const MapSection = () => {
/>
>
)}
+
+
) => {
+ setPopupData(properties);
+ }}
+ hideButton
+ getCoordOnProperties
+ />
+
From 3104866205ae46c017e45179f50def82361d2d9b Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 10:23:37 +0545
Subject: [PATCH 13/24] feat(task-descripion): add altitude on waypoints point
click popup
---
.../components/DroneOperatorTask/MapSection/index.tsx | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx b/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx
index 8523f335..47cb6611 100644
--- a/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/MapSection/index.tsx
@@ -73,10 +73,15 @@ const MapSection = () => {
-
angle: {popupData?.angle} degree
+
Angle: {popupData?.angle} degree
- gimble angle: {popupData?.gimbal_angle} degree
+ Gimble angle: {popupData?.gimbal_angle} degree
+ {popupData?.altitude && (
+
+ Altitude: {popupData?.altitude} meter
+
+ )}
);
From 9f2bedae9aedadf321b793245a5e3577e70320a3 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 10:29:48 +0545
Subject: [PATCH 14/24] feat(dashboard): wrap requested task listing component
with hasErrorboundary
---
src/frontend/src/components/Dashboard/RequestLogs/index.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/frontend/src/components/Dashboard/RequestLogs/index.tsx b/src/frontend/src/components/Dashboard/RequestLogs/index.tsx
index a2c98142..9d70e5a0 100644
--- a/src/frontend/src/components/Dashboard/RequestLogs/index.tsx
+++ b/src/frontend/src/components/Dashboard/RequestLogs/index.tsx
@@ -3,6 +3,7 @@ import { FlexColumn } from '@Components/common/Layouts';
import { Button } from '@Components/RadixComponents/Button';
import { postTaskStatus } from '@Services/project';
import { useMutation, useQueryClient } from '@tanstack/react-query';
+import hasErrorBoundary from '@Utils/hasErrorBoundary';
import { toast } from 'react-toastify';
const RequestLogs = () => {
@@ -79,4 +80,4 @@ const RequestLogs = () => {
);
};
-export default RequestLogs;
+export default hasErrorBoundary(RequestLogs);
From cc807fc6d89f8326e699d171b2403492e1898ef3 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 10:47:14 +0545
Subject: [PATCH 15/24] feat(project-creation): make project description input
a text area
---
.../FormContents/BasicInformation/index.tsx | 23 +++++++++++--------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/frontend/src/components/CreateProject/FormContents/BasicInformation/index.tsx b/src/frontend/src/components/CreateProject/FormContents/BasicInformation/index.tsx
index 1b043dcc..84cce562 100644
--- a/src/frontend/src/components/CreateProject/FormContents/BasicInformation/index.tsx
+++ b/src/frontend/src/components/CreateProject/FormContents/BasicInformation/index.tsx
@@ -1,13 +1,14 @@
import { FormControl, Label, Input } from '@Components/common/FormUI';
import ErrorMessage from '@Components/common/FormUI/ErrorMessage';
import { UseFormPropsType } from '@Components/common/FormUI/types';
+import { Controller } from 'react-hook-form';
export default function BasicInformation({
formProps,
}: {
formProps: UseFormPropsType;
}) {
- const { register, errors } = formProps;
+ const { register, errors, control } = formProps;
return (
@@ -23,14 +24,18 @@ export default function BasicInformation({
-
- value.trim(),
- })}
+
+ (
+
+ )}
/>
From d937fdaeddd0ccb815b151f22b51bfdbee327170 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 11:26:35 +0545
Subject: [PATCH 16/24] feat: add converter function `m2ToKm2`
---
src/frontend/src/utils/index.ts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/frontend/src/utils/index.ts b/src/frontend/src/utils/index.ts
index e7730caa..0d131e44 100644
--- a/src/frontend/src/utils/index.ts
+++ b/src/frontend/src/utils/index.ts
@@ -27,3 +27,9 @@ export function removeKeysFromObject(
Object.entries(obj).filter(([key]) => !keysToRemove.includes(key)),
);
}
+
+export const m2ToKm2 = (m2: number) => {
+ if (!m2) return 0;
+ if (m2 >= 1000 * 1000) return `${m2 / (1000 * 1000)} km²`;
+ return `${m2} m²`;
+};
From c32985c5bd0d355ffd471f723541e5ab419d8adf Mon Sep 17 00:00:00 2001
From: Sujit
Date: Thu, 22 Aug 2024 11:28:42 +0545
Subject: [PATCH 17/24] feat: convert project area m2 to km2
---
.../CreateProject/FormContents/DefineAOI/index.tsx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx b/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx
index d2ddce3c..0a3d43b3 100644
--- a/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx
+++ b/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx
@@ -10,6 +10,7 @@ import RadioButton from '@Components/common/RadioButton';
import { FlexColumn, FlexRow } from '@Components/common/Layouts';
import FileUpload from '@Components/common/UploadArea';
import hasErrorBoundary from '@Utils/hasErrorBoundary';
+import { m2ToKm2 } from '@Utils/index';
import {
setCreateProjectState,
resetUploadedAndDrawnAreas,
@@ -268,7 +269,7 @@ const DefineAOI = ({ formProps }: { formProps: UseFormPropsType }) => {
Reset Project Area
- Total Area: {Math.trunc(totalProjectArea as number)} m²
+ Total Area: {m2ToKm2(Math.trunc(totalProjectArea as number))}
{
Reset No Fly Zone
- Total Area: {Math.trunc(noFlyZoneArea as number)} m2
+ Total Area:{' '}
+ {m2ToKm2(Math.trunc(noFlyZoneArea as number))}
>
) : (
From 63ae1a32a7ca3f1969305d78d5bbdeefb0df5dc8 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Fri, 23 Aug 2024 09:38:33 +0545
Subject: [PATCH 18/24] fix(project-description): increase text size of
instruction
---
.../src/components/IndividualProject/Instructions/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/frontend/src/components/IndividualProject/Instructions/index.tsx b/src/frontend/src/components/IndividualProject/Instructions/index.tsx
index 227bbb6f..62377485 100644
--- a/src/frontend/src/components/IndividualProject/Instructions/index.tsx
+++ b/src/frontend/src/components/IndividualProject/Instructions/index.tsx
@@ -12,7 +12,7 @@ export default function Instructions({
{isProjectDataLoading ? (
) : (
-
+
{projectData?.per_task_instructions}
)}
From a254a5ff9eed0613a8f81f5eb119cedf60d2a287 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Fri, 23 Aug 2024 09:43:41 +0545
Subject: [PATCH 19/24] fix(dashboard): card UI
---
src/frontend/src/views/Dashboard/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/frontend/src/views/Dashboard/index.tsx b/src/frontend/src/views/Dashboard/index.tsx
index b3a0e5c1..3058a8ae 100644
--- a/src/frontend/src/views/Dashboard/index.tsx
+++ b/src/frontend/src/views/Dashboard/index.tsx
@@ -55,7 +55,7 @@ const Dashboard = () => {
-
+
{isLoading ? (
<>
{Array.from({ length: 4 }, (_, index) => (
From ec132c4b4d501979b710ea6ae690111d405c24fb Mon Sep 17 00:00:00 2001
From: Sujit
Date: Fri, 23 Aug 2024 10:49:15 +0545
Subject: [PATCH 20/24] feat(project-dashboard): show slug insted of id on
cards
---
src/frontend/src/components/Projects/ProjectCard/index.tsx | 4 +++-
src/frontend/src/views/Projects/index.tsx | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/frontend/src/components/Projects/ProjectCard/index.tsx b/src/frontend/src/components/Projects/ProjectCard/index.tsx
index f35969ea..bbc38409 100644
--- a/src/frontend/src/components/Projects/ProjectCard/index.tsx
+++ b/src/frontend/src/components/Projects/ProjectCard/index.tsx
@@ -8,6 +8,7 @@ interface IProjectCardProps {
title: string;
description: string;
// geojson: GeojsonType;
+ slug: string;
}
export default function ProjectCard({
@@ -16,6 +17,7 @@ export default function ProjectCard({
title,
description,
// geojson,
+ slug,
}: IProjectCardProps) {
const navigate = useNavigate();
@@ -30,7 +32,7 @@ export default function ProjectCard({
className="!naxatw-col-span-1 naxatw-max-h-[25.25rem] naxatw-cursor-pointer naxatw-rounded-md naxatw-border naxatw-border-grey-400 naxatw-p-[0.625rem] naxatw-transition-all naxatw-duration-300 naxatw-ease-in-out hover:-naxatw-translate-y-1 hover:naxatw-scale-100 hover:naxatw-shadow-xl"
>
{/* */}
- ID: #{id}
+ {slug}
{title}
{description}
diff --git a/src/frontend/src/views/Projects/index.tsx b/src/frontend/src/views/Projects/index.tsx
index 8f57622e..7fa7458d 100644
--- a/src/frontend/src/views/Projects/index.tsx
+++ b/src/frontend/src/views/Projects/index.tsx
@@ -53,6 +53,7 @@ const Projects = () => {
title={singleproject.name}
description={singleproject.description}
// geojson={singleproject.outline_geojson}
+ slug={singleproject?.slug}
/>
),
)
From 263c290a9ee7ed91bbbb1dd9e00c13f72ec47191 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Fri, 23 Aug 2024 17:24:28 +0545
Subject: [PATCH 21/24] feat(tsak-description): remove preview images from
selected folders use icon insted cause it takes time to preview all the image
if images are in large number or size
---
.../PopoverBox/ImageBox/ImageCard/index.tsx | 35 ++++++++-----------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/ImageCard/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/ImageCard/index.tsx
index de4285e7..c9bb0557 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/ImageCard/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/ImageCard/index.tsx
@@ -1,14 +1,8 @@
-/* eslint-disable jsx-a11y/interactive-supports-focus */
-/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
-/* eslint-disable jsx-a11y/click-events-have-key-events */
-import { useState } from 'react';
-
import {
setSelectedImage,
unCheckImages,
} from '@Store/actions/droneOperatorTask';
import { useTypedDispatch } from '@Store/hooks';
-import Skeleton from '@Components/RadixComponents/Skeleton';
interface IImageCardProps {
image: string;
@@ -23,32 +17,33 @@ const ImageCard = ({
deselectImages,
}: IImageCardProps) => {
const dispatch = useTypedDispatch();
- const [loading, setLoading] = useState(true);
- const handleLoad = () => {
- setLoading(false);
- };
return (
<>
- {loading && (
-
- )}
dispatch(setSelectedImage(image))}
>
-
-
+ {/*
dispatch(setSelectedImage(image))}
- />
+ /> */}
+
+ image
+
dispatch(unCheckImages(deselectImages))}
+ onClick={e => {
+ e.stopPropagation();
+ dispatch(unCheckImages(deselectImages));
+ }}
>
Date: Fri, 23 Aug 2024 17:27:42 +0545
Subject: [PATCH 22/24] feat(task-description): refactor uploading images
preview popup
---
.../PopoverBox/ImageBox/PreviewImage/index.tsx | 4 +++-
src/frontend/src/constants/modalContents.tsx | 10 ++++++++++
src/frontend/src/store/actions/droneOperatorTask.ts | 1 +
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/PreviewImage/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/PreviewImage/index.tsx
index 7673227b..75f4ad56 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/PreviewImage/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/PreviewImage/index.tsx
@@ -1,7 +1,9 @@
import { useTypedSelector } from '@Store/hooks';
const PreviewImage = () => {
- const { clickedImage } = useTypedSelector(state => state.droneOperatorTask);
+ const clickedImage = useTypedSelector(
+ state => state.droneOperatorTask.clickedImage,
+ );
return (
,
};
+
+ case 'raw-image-preview':
+ return {
+ className: '!naxatw-w-[60vw]',
+ title: 'Upload Raw Image',
+ content:
,
+ };
+
default:
return {
title: '',
diff --git a/src/frontend/src/store/actions/droneOperatorTask.ts b/src/frontend/src/store/actions/droneOperatorTask.ts
index 9d136faa..5564edd5 100644
--- a/src/frontend/src/store/actions/droneOperatorTask.ts
+++ b/src/frontend/src/store/actions/droneOperatorTask.ts
@@ -9,4 +9,5 @@ export const {
showPopover,
unCheckAllImages,
checkAllImages,
+ setFiles,
} = droneOperatorTaskSlice.actions;
From f048057c6f1418fac9ada820f090d057211e4631 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Fri, 23 Aug 2024 17:28:43 +0545
Subject: [PATCH 23/24] feat(task-description): refactor images uploading
process
combine description, comment and image uplaod on same page
---
.../DescriptionBox/index.tsx | 11 +-
.../PopoverBox/ImageBox/index.tsx | 161 ++++++++----------
.../DescriptionSection/QuestionBox/index.tsx | 32 ++--
.../DescriptionSection/UploadsBox/index.tsx | 25 +--
.../src/store/slices/droneOperartorTask.ts | 5 +
5 files changed, 108 insertions(+), 126 deletions(-)
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx
index bb39b42d..78f30a1f 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/DescriptionBox/index.tsx
@@ -1,13 +1,15 @@
import { useParams } from 'react-router-dom';
import { useGetIndividualTaskQuery } from '@Api/tasks';
-import { useTypedSelector } from '@Store/hooks';
+import { useState } from 'react';
+// import { useTypedSelector } from '@Store/hooks';
import { format } from 'date-fns';
import DescriptionBoxComponent from './DescriptionComponent';
import QuestionBox from '../QuestionBox';
const DescriptionBox = () => {
- const secondPageStates = useTypedSelector(state => state.droneOperatorTask);
- const { secondPage } = secondPageStates;
+ // const secondPageStates = useTypedSelector(state => state.droneOperatorTask);
+ const [flyable, setFlyable] = useState('yes');
+ // const { secondPage } = secondPageStates;
const { taskId } = useParams();
const { data: taskDescription }: Record =
@@ -88,7 +90,8 @@ const DescriptionBox = () => {
/>
))}
- {!secondPage &&
}
+ {/* {!secondPage &&
} */}
+
>
);
};
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/index.tsx
index b0ffc9a3..1245e9c4 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/index.tsx
@@ -22,17 +22,16 @@ import delay from '@Utils/createDelay';
import chunkArray from '@Utils/createChunksOfArray';
import callApiSimultaneously from '@Utils/callApiSimultaneously';
import widthCalulator from '@Utils/percentageCalculator';
-
import ImageCard from './ImageCard';
import FilesUploadingPopOver from '../LoadingBox';
import PreviewImage from './PreviewImage';
-interface IImageBoxPopOverProps {
- show: boolean;
- imageFiles: any[];
-}
+// interface IImageBoxPopOverProps {
+// show: boolean;
+// imageFiles: any[];
+// }
-const ImageBoxPopOver = ({ show, imageFiles }: IImageBoxPopOverProps) => {
+const ImageBoxPopOver = () => {
const dispatch = useTypedDispatch();
const { projectId, taskId } = useParams();
@@ -42,9 +41,12 @@ const ImageBoxPopOver = ({ show, imageFiles }: IImageBoxPopOverProps) => {
const [imagesNames, setImagesNames] = useState
([]);
const [loadingWidth, setLoadingWidth] = useState(0);
const [files, setFiles] = useState([]);
-
- const { clickedImage, checkedImages } = useTypedSelector(
- state => state.droneOperatorTask,
+ const imageFiles = useTypedSelector(state => state.droneOperatorTask.files);
+ const clickedImage = useTypedSelector(
+ state => state.droneOperatorTask.clickedImage,
+ );
+ const checkedImages = useTypedSelector(
+ state => state.droneOperatorTask.checkedImages,
);
// function that gets the signed urls for the images and again puts them in chunks of 4
@@ -140,100 +142,75 @@ const ImageBoxPopOver = ({ show, imageFiles }: IImageBoxPopOverProps) => {
};
return (
<>
+ {/* ------------------ image section ----------------- */}
- {/* ------------------ header section ----------------- */}
-
-
-
- Upload Raw Image
-
-
- Please uncheck the image that doesn't need to be uploaded
-
-
-
dispatch(showPopover())}
- className="naxatw-cursor-pointer naxatw-text-[1.5rem] naxatw-text-[#555555]"
+ {imageObject?.map((image, index) => (
+
-
+ ))}
+
+
+ {/* ----------------- preview Image --------------------- */}
+
+
+
+
- {/* ------------------ image section ----------------- */}
+ {/* ------------------ buttons section ----------------- */}
+
+
-
- {imageObject?.map((image, index) => (
-
- ))}
-
-
- {/* ----------------- preview Image --------------------- */}
-
-
-
+
+
+ Select All
+
-
- {/* ------------------ buttons section ----------------- */}
-
-
-
-
-
value === false,
- )}
- />
-
- Deselect All
-
-
-
-
-
-
+
+
value === false,
+ )}
+ />
+
+ Deselect All
+
+
+
+
{/* ---------- loading popover-------------- */}
{
+interface IQuestionBoxProps {
+ flyable: string;
+ setFlyable: React.Dispatch>;
+}
+
+const QuestionBox = ({ flyable, setFlyable }: IQuestionBoxProps) => {
const { projectId, taskId } = useParams();
const dispatch = useTypedDispatch();
- const [flyable, setFlyable] = useState('yes');
const [comment, setComment] = useState('');
const variants = {
open: { opacity: 1, y: 0 },
@@ -101,17 +106,20 @@ const QuestionBox = () => {
value={comment}
onChange={e => setComment(e.target.value)}
/>
+
+
+
+
-
+ {flyable === 'yes' && }
>
);
diff --git a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx
index f1ed4d9b..a57e1718 100644
--- a/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx
+++ b/src/frontend/src/components/DroneOperatorTask/DescriptionSection/UploadsBox/index.tsx
@@ -1,30 +1,20 @@
/* eslint-disable no-await-in-loop */
/* eslint-disable no-console */
/* eslint-disable no-unused-vars */
-import { useState } from 'react';
-
-import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
-import {
- setSelectedImage,
- showPopover,
-} from '@Store/actions/droneOperatorTask';
import { Button } from '@Components/RadixComponents/Button';
-
-import ImageBoxPopOver from '../PopoverBox/ImageBox';
+import { toggleModal } from '@Store/actions/common';
+import { setFiles, showPopover } from '@Store/actions/droneOperatorTask';
+import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
const UploadsBox = () => {
const dispatch = useTypedDispatch();
- const { popOver } = useTypedSelector(state => state.droneOperatorTask);
-
- const [files, setFiles] = useState([]);
- const [popoverOpen, setPopoverOpen] = useState(false);
-
+ const files = useTypedSelector(state => state.droneOperatorTask.files);
const handleFileChange = (event: any) => {
const selectedFiles = event.target.files;
if (!selectedFiles) return;
const selectedFilesArray = Array.from(selectedFiles);
- setFiles(selectedFilesArray);
- dispatch(showPopover());
+ dispatch(setFiles(selectedFilesArray));
+ dispatch(toggleModal('raw-image-preview'));
};
return (
@@ -47,13 +37,12 @@ const UploadsBox = () => {
)}
-
>
);
};
diff --git a/src/frontend/src/store/slices/droneOperartorTask.ts b/src/frontend/src/store/slices/droneOperartorTask.ts
index 8fa3dfcb..5bb88bbc 100644
--- a/src/frontend/src/store/slices/droneOperartorTask.ts
+++ b/src/frontend/src/store/slices/droneOperartorTask.ts
@@ -7,6 +7,7 @@ export interface IDroneOperatorTaskState {
clickedImage: string;
checkedImages: Record;
popOver: boolean;
+ files: any[];
}
const initialState: IDroneOperatorTaskState = {
@@ -15,6 +16,7 @@ const initialState: IDroneOperatorTaskState = {
clickedImage: '',
checkedImages: {},
popOver: false,
+ files: [],
};
export const droneOperatorTaskSlice = createSlice({
@@ -50,6 +52,9 @@ export const droneOperatorTaskSlice = createSlice({
state.checkedImages[key] = true;
});
},
+ setFiles: (state, action) => {
+ state.files = action.payload;
+ },
},
});
From 447f5e10279711fa79238ce745a3030f7cfa70ba Mon Sep 17 00:00:00 2001
From: Sujit
Date: Fri, 23 Aug 2024 17:43:21 +0545
Subject: [PATCH 24/24] feat(individual-project): show no-fly zone popup on
nofly zone click
---
.../components/IndividualProject/MapSection/index.tsx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/frontend/src/components/IndividualProject/MapSection/index.tsx b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
index 0962aa4a..09798b2b 100644
--- a/src/frontend/src/components/IndividualProject/MapSection/index.tsx
+++ b/src/frontend/src/components/IndividualProject/MapSection/index.tsx
@@ -128,8 +128,10 @@ const MapSection = () => {
return `This task is locked for mapping ${properties.locked_user_name ? `by ${userDetails?.id === properties?.locked_user_id ? 'you' : properties?.locked_user_name}` : ''}`;
case 'UNFLYABLE_TASK':
return 'This task is not flyable';
- default:
+ case 'COMPLETED':
return 'This Task is completed';
+ default:
+ return '';
}
};
return {popupText(status)}
;
@@ -256,7 +258,11 @@ const MapSection = () => {
) => {
dispatch(setProjectState({ selectedTaskId: properties.id }));
setLockedUser({