From acacd4f2069126c8bd9f32f310793d5df5b27b49 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Mon, 9 Sep 2024 12:07:06 +0545
Subject: [PATCH 01/20] feat(project-dashboard): show project id insted of slug
on project cards
---
src/frontend/src/components/Projects/ProjectCard/index.tsx | 5 ++---
src/frontend/src/views/Projects/index.tsx | 1 -
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/frontend/src/components/Projects/ProjectCard/index.tsx b/src/frontend/src/components/Projects/ProjectCard/index.tsx
index 57019075..11a6e677 100644
--- a/src/frontend/src/components/Projects/ProjectCard/index.tsx
+++ b/src/frontend/src/components/Projects/ProjectCard/index.tsx
@@ -4,7 +4,6 @@ interface IProjectCardProps {
id: number;
title: string;
description: string;
- slug: string;
imageUrl: string | null;
}
@@ -12,7 +11,7 @@ export default function ProjectCard({
id,
title,
description,
- slug,
+
imageUrl,
}: IProjectCardProps) {
const navigate = useNavigate();
@@ -40,7 +39,7 @@ export default function ProjectCard({
)}
- {slug}
+ #{id}
{title}
diff --git a/src/frontend/src/views/Projects/index.tsx b/src/frontend/src/views/Projects/index.tsx
index 0431554e..8786db87 100644
--- a/src/frontend/src/views/Projects/index.tsx
+++ b/src/frontend/src/views/Projects/index.tsx
@@ -46,7 +46,6 @@ const Projects = () => {
imageUrl={project?.image_url}
title={project.name}
description={project.description}
- slug={project?.slug}
/>
),
)
From fabdbf62a6e288468273286ce3d3fafe627785d2 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Mon, 9 Sep 2024 12:09:00 +0545
Subject: [PATCH 02/20] fix(project-dashboard): map crash issue on 0 project
---
.../components/Projects/MapSection/index.tsx | 57 ++++++++++---------
1 file changed, 29 insertions(+), 28 deletions(-)
diff --git a/src/frontend/src/components/Projects/MapSection/index.tsx b/src/frontend/src/components/Projects/MapSection/index.tsx
index 559d84cd..8ac709dd 100644
--- a/src/frontend/src/components/Projects/MapSection/index.tsx
+++ b/src/frontend/src/components/Projects/MapSection/index.tsx
@@ -26,37 +26,38 @@ const ProjectsMapSection = () => {
},
disableRotation: true,
});
- const { data: projectsList, isLoading } = useGetProjectsListQuery({
- select: (data: any) => {
- // find all polygons centroid and set to geojson save to single geojson
- const combinedGeojson = data?.data?.reduce(
- (acc: Record, current: Record) => {
- return {
- ...acc,
- features: [
- ...acc.features,
- {
- ...centroid(current.outline),
- properties: {
- id: current?.id,
- name: current?.name,
- slug: current?.slug,
+ const { data: projectsList, isLoading }: Record =
+ useGetProjectsListQuery({
+ select: (data: any) => {
+ // find all polygons centroid and set to geojson save to single geojson
+ const combinedGeojson = data?.data?.reduce(
+ (acc: Record, current: Record) => {
+ return {
+ ...acc,
+ features: [
+ ...acc.features,
+ {
+ ...centroid(current.outline),
+ properties: {
+ id: current?.id,
+ name: current?.name,
+ slug: current?.slug,
+ },
},
- },
- ],
- };
- },
- {
- type: 'FeatureCollection',
- features: [],
- },
- );
- return combinedGeojson;
- },
- });
+ ],
+ };
+ },
+ {
+ type: 'FeatureCollection',
+ features: [],
+ },
+ );
+ return combinedGeojson;
+ },
+ });
useEffect(() => {
- if (!projectsList) return;
+ if (!projectsList || !projectsList?.features?.length) return;
const bbox = getBbox(projectsList as FeatureCollection);
map?.fitBounds(bbox as LngLatBoundsLike, { padding: 100 });
}, [projectsList, map]);
From d2bd55ae914e96b4540f58a124913fba9ba6a035 Mon Sep 17 00:00:00 2001
From: Sujit
Date: Tue, 10 Sep 2024 13:19:25 +0545
Subject: [PATCH 03/20] feat(project-creation): add task dimension limitation
to 50-700
---
.../FormContents/GenerateTask/index.tsx | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/frontend/src/components/CreateProject/FormContents/GenerateTask/index.tsx b/src/frontend/src/components/CreateProject/FormContents/GenerateTask/index.tsx
index 6f1a015c..36cf3f57 100644
--- a/src/frontend/src/components/CreateProject/FormContents/GenerateTask/index.tsx
+++ b/src/frontend/src/components/CreateProject/FormContents/GenerateTask/index.tsx
@@ -1,4 +1,6 @@
import { useMutation } from '@tanstack/react-query';
+import { useState } from 'react';
+import ErrorMessage from '@Components/common/ErrorMessage';
import { useTypedDispatch, useTypedSelector } from '@Store/hooks';
import { FormControl, Label, Input } from '@Components/common/FormUI';
import { Button } from '@Components/RadixComponents/Button';
@@ -11,6 +13,7 @@ import MapSection from './MapSection';
export default function GenerateTask({ formProps }: { formProps: any }) {
const dispatch = useTypedDispatch();
+ const [error, setError] = useState('');
const { register, watch } = formProps;
const dimension = watch('task_split_dimension');
@@ -53,11 +56,15 @@ export default function GenerateTask({ formProps }: { formProps: any }) {
type="number"
className="naxatw-mt-1"
value={dimension}
+ min={50}
+ max={700}
{...register('task_split_dimension', {
required: 'Required',
valueAsNumber: true,
})}
+ onFocus={() => setError('')}
/>
+ {error && }