Skip to content

Commit

Permalink
Merge pull request #176 from hotosm/feat/drone-operator-task-page
Browse files Browse the repository at this point in the history
Feat/drone operator task page
  • Loading branch information
suzit-10 authored Aug 28, 2024
2 parents f87b0bf + c155870 commit ab0aa75
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ repos:
# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: "v0.6.1"
rev: "v0.6.2"
hooks:
# Run the linter
- id: ruff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const CreateprojectLayout = () => {
dispatch(setCreateProjectState({ projectId: res.data.project_id }));
if (!splitGeojson) return;
const geojson = convertGeojsonToFile(splitGeojson);
const formData = prepareFormData({ geojson: geojson });
const formData = prepareFormData({ geojson });
uploadTaskBoundary({ id: res.data.project_id, data: formData });
reset();
dispatch(resetUploadedAndDrawnAreas());
Expand Down Expand Up @@ -171,16 +171,14 @@ const CreateprojectLayout = () => {
if (activeStep === 2) {
if (
!data?.outline ||
(Array.isArray(data?.outline) &&
data?.outline?.length === 0)
(Array.isArray(data?.outline) && data?.outline?.length === 0)
) {
toast.error('Please upload or draw and save project area');
return;
}
if (
isNoflyzonePresent === 'yes' &&
(!data?.no_fly_zones ||
data?.no_fly_zones?.length === 0)
(!data?.no_fly_zones || data?.no_fly_zones?.length === 0)
) {
toast.error('Please upload or draw and save No Fly zone area');
return;
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: [84.124, 28.3949],
center: [21.4691, 78.6569],
maxZoom: 19,
},
disableRotation: true,
Expand Down Expand Up @@ -100,7 +100,7 @@ const MapSection = ({
isMapLoaded={isMapLoaded}
style={{
width: '100%',
height: '448px',
height: '375px',
position: 'relative',
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,19 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
<Input
placeholder="Enter GSD in cm/pixel"
type="number"
max={10}
min={0}
{...register('gsd_cm_px', {
required: 'GSD is required',
valueAsNumber: true,
max: {
value: 10,
message: 'GSD must be 10 or less',
},
min: {
value: 0,
message: 'GSD cannot be negative',
},
})}
/>
<ErrorMessage message={errors?.gsd_cm_px?.message as string} />
Expand All @@ -84,6 +94,7 @@ const KeyParameters = ({ formProps }: { formProps: UseFormPropsType }) => {
{...register('altitude_from_ground', {
required: 'Altitude From Round is Required',
valueAsNumber: true,
max: 10,
})}
/>
<ErrorMessage
Expand All @@ -97,11 +108,13 @@ 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,
})}
/>
<ErrorMessage
Expand All @@ -114,11 +127,11 @@ 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,
max: 100,
min: 0,
})}
/>
<ErrorMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const TaskLogsTable = ({ data: taskList }: ITaskLogsTableProps) => {
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1">
Total task area
</td>
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1">
{/* <td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1">
Est.flight time
</td>
</td> */}
<td className="naxatw-border-r-2 naxatw-px-2 naxatw-py-1">
Created Date
</td>
Expand All @@ -35,7 +35,7 @@ const TaskLogsTable = ({ data: taskList }: ITaskLogsTableProps) => {
<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">-</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')}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const tasksDataColumns = [
header: 'ID',
accessorKey: 'id',
},
{
header: 'Flight Time',
accessorKey: 'flight_time',
},
// {
// header: 'Flight Time',
// accessorKey: 'flight_time',
// },
{
header: 'Task Area in km²',
accessorKey: 'task_area',
Expand Down
5 changes: 3 additions & 2 deletions src/frontend/src/components/LandingPage/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
import { Flex, FlexRow } from '@Components/common/Layouts';
import Icon from '@Components/common/Icon';
import Image from '@Components/RadixComponents/Image';
Expand All @@ -11,7 +12,7 @@ export default function Footer() {
return (
<footer className="naxatw-h-fit naxatw-pb-6 naxatw-text-landing-white">
<div className="!naxatw-max-w-full">
<div className="naxatw-bg-landing-red naxatw-px-5 naxatw-py-24 md:naxatw-px-9 lg:naxatw-px-32">
{/* <div className="naxatw-bg-landing-red naxatw-px-5 naxatw-py-24 md:naxatw-px-9 lg:naxatw-px-32">
<motion.div
variants={fadeUpVariant}
initial="hidden"
Expand All @@ -35,7 +36,7 @@ export default function Footer() {
<Icon name="east" />
</Button>
</Flex>
</div>
</div> */}
<motion.div
variants={fadeUpVariant}
initial="hidden"
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/src/components/LandingPage/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default function Navbar() {
>
<p className="naxatw-border-r naxatw-pr-3">About</p>
<p className="naxatw-border-r naxatw-pr-3">FAQs</p>
<p className="naxatw-border-r naxatw-pr-3">Documentations</p>
<a href="https://hotosm.github.io/drone-tm/ ">
<p className="naxatw-border-r naxatw-pr-3">Documentations</p>
</a>
</FlexRow>
</FlexRow>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ export default function BasicDetails({ formProps }: { formProps: any }) {
<img src={userProfile.profile_img} alt="profilepic" />
</Flex>
<FormControl>
<Label required>Name</Label>
<Label>Name</Label>
<Input
placeholder="Enter Name"
className="naxatw-mt-1"
{...register('name', {
required: 'Name is Required',
})}
readOnly
/>
<ErrorMessage message={formState.errors?.name?.message} />
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,38 @@ export default function OrganizationDetails({ formProps }: { formProps: any }) {
</Flex>
<FlexColumn gap={5}>
<FormControl>
<Label required>Organization Name</Label>
<Label>Organization Name</Label>
<Input
placeholder="Enter Organization Name"
className="naxatw-mt-1"
{...register('organization_name', {
required: 'Organization name is Required',
// required: 'Organization name is Required',
})}
/>
<ErrorMessage
message={formProps.formState.errors?.organization_name?.message}
/>
</FormControl>
<FormControl>
<Label required>Organization Address</Label>
<Label>Organization Address</Label>
<Input
placeholder="Enter Organization Address"
className="naxatw-mt-1"
{...register('organization_address', {
required: 'Organization Address is Required',
// required: 'Organization Address is Required',
})}
/>
<ErrorMessage
message={formProps.formState.errors?.organization_address?.message}
/>
</FormControl>
<FormControl>
<Label required>Job Title</Label>
<Label>Job Title</Label>
<Input
placeholder="Enter Job Title"
className="naxatw-mt-1"
{...register('job_title', {
required: 'Job Title is Required',
// required: 'Job Title is Required',
})}
/>
<ErrorMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { FlexRow } from '@Components/common/Layouts';
import { Link } from 'react-router-dom';

export default function UserProfileHeader() {
return (
<FlexRow className="naxatw-mb-4 naxatw-py-3" gap={2}>
<p className="naxatw-text-body-md">Profile /</p>
<Link to="/projects">
<p className="naxatw-text-body-md">Profile /</p>
</Link>
<span className="naxatw-text-body-btn">Edit Profile</span>
</FlexRow>
);
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/components/common/DataTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default function DataTable({
const pageCounts = (dataList?.count ?? 0) / pageSize;

const table = useReactTable({
data: Array.isArray(dataList) ? dataList : dataList?.results ?? [],
data: Array.isArray(dataList) ? dataList : (dataList?.results ?? []),
columns,
pageCount: Number.isNaN(pageCounts) ? -1 : Number(Math.ceil(pageCounts)),
getCoreRowModel: getCoreRowModel(),
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/components/common/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NavLink, useLocation, useNavigate } from 'react-router-dom';
import dtmLogo from '@Assets/images/DTM-logo-black.svg';
import UserProfile from '../UserProfile';
import { FlexRow } from '../Layouts';
import Icon from '../Icon';
// import Icon from '../Icon';

export default function Navbar() {
const { pathname } = useLocation();
Expand All @@ -15,7 +15,7 @@ export default function Navbar() {
<div
className="naxatw-cursor-pointer"
role="presentation"
onClick={() => navigate('/dashboard')}
onClick={() => navigate('/')}
>
<Image
src={dtmLogo}
Expand Down Expand Up @@ -50,7 +50,7 @@ export default function Navbar() {
</NavLink>
</FlexRow>
<FlexRow className="naxatw-items-center" gap={2}>
<Icon name="notifications" />
{/* <Icon name="notifications" /> */}
<UserProfile />
</FlexRow>
</FlexRow>
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/components/common/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function UserProfile() {
name: 'Edit Profile',
icon: 'person',
onClick: () => {
navigate('/user-profile');
setToggle(false);
},
isRed: false,
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/constants/createProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
GenerateTask,
} from '@Components/CreateProject/DescriptionContents';
import orthoPhotoIcon from '@Assets/images/ortho-photo-icon.svg';
import _3DModal from '@Assets/images/3d-model-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';

Expand Down Expand Up @@ -162,7 +162,7 @@ export const lockApprovalOptions = [

export const FinalOutputOptions = [
{ label: '2D Orthophoto', value: 'ORTHOPHOTO_2D', icon: orthoPhotoIcon },
{ label: '3D Model', value: 'ORTHOPHOTO_3D', icon: _3DModal },
// { label: '3D Model', value: 'ORTHOPHOTO_3D', icon: _3DModal },
{
label: 'Digital Terrain Model (DTM)',
value: 'DIGITAL_TERRAIN_MODEL',
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/constants/landingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ export const accordionData = [
id: 1,
title: 'Enhanced Crisis Response',
description:
'Significant savings in mapping and surveying costs for underprivileged areas.',
'The Drone Tasking Manager will enable faster, more precise deployment of drones during emergencies, improving resource allocation and decision-making in critical situations. This will lead to quicker and more effective crisis interventions.',
isOpen: true,
},
{
id: 2,
title: 'Community Empowerment',
description:
"Yes, you can try us for free for 30 days. If you want, we'll provide you with a free, personalized 30-minute onboarding call to get you up and running as soon as possible.",
'The Drone Tasking Manager will empower local communities by providing them with access to real-time aerial data and insights. This tool will enhance their ability to participate in decision-making processes, improve disaster preparedness, and support local initiatives with accurate, timely information.',
isOpen: false,
},
{
id: 3,
title: 'Cost Reduction',
description:
"Yes, you can try us for free for 30 days. If you want, we'll provide you with a free, personalized 30-minute onboarding call to get you up and running as soon as possible.",
'The Drone Tasking Manager will lower operational costs by optimizing drone tasking, reducing the need for manual interventions, and minimizing resource wastage. This efficiency will lead to significant savings in both time and money during operations.',
isOpen: false,
},
{
id: 4,
title: 'Data Accessibility',
description:
"Yes, you can try us for free for 30 days. If you want, we'll provide you with a free, personalized 30-minute onboarding call to get you up and running as soon as possible.",
'The Drone Tasking Manager will provide users with easy access to drone data, enabling better decision-making and more informed actions. This centralized data access will ensure that critical information is readily available to all stakeholders.',
isOpen: false,
},
];
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/views/LandingPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Features,
UserAndRoles,
MajorImpacts,
CaseStudies,
// CaseStudies,
ClientAndPartners,
Footer,
SignInOverlay,
Expand All @@ -28,7 +28,7 @@ export default function LandingPage() {
<Features />
<UserAndRoles />
<MajorImpacts />
<CaseStudies />
{/* <CaseStudies /> */}
<ClientAndPartners />
<Footer />
</main>
Expand Down

0 comments on commit ab0aa75

Please sign in to comment.