Skip to content

Commit

Permalink
Merge pull request #186 from hotosm/develop
Browse files Browse the repository at this point in the history
Production Release
  • Loading branch information
nrjadkry authored Sep 2, 2024
2 parents c9d73e9 + d066a9d commit 9908753
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ const CreateprojectLayout = () => {
},
});

const { mutate: createProject } = useMutation<any, any, any, unknown>({
const { mutate: createProject, isLoading: isCreatingProject } = useMutation<
any,
any,
any,
unknown
>({
mutationFn: postCreateProject,
onSuccess: (res: any) => {
dispatch(setCreateProjectState({ projectId: res.data.project_id }));
Expand Down Expand Up @@ -260,7 +265,7 @@ const CreateprojectLayout = () => {
className="!naxatw-bg-red !naxatw-text-white"
rightIcon="chevron_right"
withLoader
isLoading={isLoading}
isLoading={isLoading || isCreatingProject}
>
{activeStep === 5 ? 'Save' : 'Next'}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export default function BasicInformation({
<textarea
className="naxatw-flex naxatw-h-[100px] naxatw-rounded-[4px] naxatw-border naxatw-border-[#555555] naxatw-bg-transparent naxatw-p-2 naxatw-text-body-md file:naxatw-font-medium hover:naxatw-border-red focus:naxatw-border-red focus:naxatw-bg-transparent focus:naxatw-outline-none disabled:naxatw-cursor-not-allowed"
placeholder="Description of the Project"
ref={ref}
onChange={onChange}
value={value}
{...others}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const MapSection = ({
const { map, isMapLoaded } = useMapLibreGLMap({
mapOptions: {
zoom: 5,
center: [21.4691, 78.6569],
center: [289.927139, 18.542117],
maxZoom: 19,
},
disableRotation: true,
Expand Down Expand Up @@ -100,7 +100,7 @@ const MapSection = ({
isMapLoaded={isMapLoaded}
style={{
width: '100%',
height: '375px',
height: '100%',
position: 'relative',
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ const DefineAOI = ({ formProps }: { formProps: UseFormPropsType }) => {
</>
)}
</div>
<div className="naxatw-col-span-2 naxatw-overflow-hidden naxatw-rounded-md naxatw-border naxatw-border-[#F3C6C6]">
<div className="xl:[60vh] naxatw-col-span-2 naxatw-h-[375px] naxatw-overflow-hidden naxatw-rounded-md naxatw-border naxatw-border-[#F3C6C6] lg:naxatw-h-[50vh]">
<MapSection
onResetButtonClick={handleResetButtonClick}
handleDrawProjectAreaClick={handleDrawProjectAreaClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
{...register('altitude_from_ground', {
required: 'Altitude From Round is Required',
valueAsNumber: true,
max: 10,
})}
/>
<ErrorMessage
Expand All @@ -108,12 +107,12 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
<Input
placeholder="Image Overlap"
type="number"
// max={100}
max={100}
min={0}
{...register('front_overlap', {
required: 'Front Overlap is required',
valueAsNumber: true,
// max: 100,
max: 100,
min: 0,
})}
/>
Expand All @@ -127,11 +126,13 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
<Input
placeholder="Image Overlap"
type="number"
max={100}
min={0}
{...register('side_overlap', {
required: 'Side Overlap is required',
valueAsNumber: true,
min: 0,
max: 100,
})}
/>
<ErrorMessage
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/components/Dashboard/RequestLogs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const RequestLogs = () => {
className="naxatw-flex naxatw-h-fit naxatw-w-full naxatw-items-center naxatw-justify-between naxatw-rounded-xl naxatw-border naxatw-border-gray-300 naxatw-p-3"
>
<div>
The Task <strong>#{task.task_id}</strong> is requested for Mapping
The <strong>Task# {task.project_task_index}</strong> is requested
for Mapping
</div>
<div className="naxatw-flex naxatw-w-[172px] naxatw-gap-3">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ const TaskLogsTable = ({ data: taskList }: ITaskLogsTableProps) => {
<tbody>
{taskList?.map(task => (
<tr key={task.task_id}>
<td className="naxatw-px-2 naxatw-py-1">{task.task_id}</td>
<td className="naxatw-px-2 naxatw-py-1">{task.task_area}</td>
<td className="naxatw-px-2 naxatw-py-1">
Task# {task?.project_task_index}
</td>
<td className="naxatw-px-2 naxatw-py-1">
{Number(task?.task_area)?.toFixed(3)}
</td>
{/* <td className="naxatw-px-2 naxatw-py-1">-</td> */}
<td className="naxatw-px-2 naxatw-py-1">
{format(new Date(task.created_at), 'yyyy-MM-dd')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useParams } from 'react-router-dom';
import { useGetIndividualTaskQuery } from '@Api/tasks';
import { useGetIndividualTaskQuery, useGetTaskWaypointQuery } from '@Api/tasks';
import { useState } from 'react';
// import { useTypedSelector } from '@Store/hooks';
import { format } from 'date-fns';
Expand All @@ -10,10 +10,21 @@ const DescriptionBox = () => {
// const secondPageStates = useTypedSelector(state => state.droneOperatorTask);
const [flyable, setFlyable] = useState('yes');
// const { secondPage } = secondPageStates;
const { taskId } = useParams();
const { taskId, projectId } = useParams();

const { data: taskWayPoints }: any = useGetTaskWaypointQuery(
projectId as string,
taskId as string,
{
select: (data: any) => {
return data.data.features;
},
},
);

const { data: taskDescription }: Record<string, any> =
useGetIndividualTaskQuery(taskId as string, {
enabled: !!taskWayPoints,
select: (data: any) => {
const { data: taskData } = data;

Expand All @@ -34,6 +45,7 @@ const DescriptionBox = () => {
? `${Number(taskData?.task_area)?.toFixed(3)} km²`
: null,
},
{ name: 'Total points', value: taskWayPoints?.length },
{
name: 'Est. flight time',
value: taskData?.flight_time || null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ const DroneOperatorDescriptionBox = () => {

const handleDownloadFlightPlan = () => {
const link = document.createElement('a');
link.setAttribute('download', '');
// link.setAttribute('download', '');
link.download = 'flight_plan.kmz';
link.href = `${BASE_URL}/waypoint/task/${taskId}/?project_id=${projectId}&download=true`;
document.body.appendChild(link);
link.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import lock from '@Assets/images/lock.png';
import { useState } from 'react';

const Legend = () => {
const [showLegendItems, setShowLegendItems] = useState<Boolean>(false);
const [showLegendItems, setShowLegendItems] = useState<Boolean>(true);
return (
<div className="naxatw-absolute naxatw-bottom-2 naxatw-left-3 naxatw-z-50 naxatw-w-40 naxatw-rounded-sm naxatw-bg-white naxatw-p-3">
<div className="naxatw-flex naxatw-justify-between">
Expand All @@ -13,7 +13,7 @@ const Legend = () => {
role="presentation"
onClick={() => setShowLegendItems(!showLegendItems)}
>
{showLegendItems ? 'expand_less' : 'expand_more'}
{showLegendItems ? 'expand_more' : 'expand_less'}
</i>
</div>
{showLegendItems && (
Expand Down

0 comments on commit 9908753

Please sign in to comment.