From 3f700257d94d09cab0f07db95ae31ff3e39b57f9 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Thu, 27 Jun 2024 09:35:39 +0545 Subject: [PATCH 01/16] feat: add package @turf/bbox to get bounding box of geojson --- src/frontend/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/frontend/package.json b/src/frontend/package.json index 2c39bcbc..94a95a59 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -26,6 +26,7 @@ "@tanstack/react-table": "^8.9.3", "@terraformer/wkt": "^2.2.0", "@turf/area": "^7.0.0", + "@turf/bbox": "^7.0.0", "@turf/centroid": "^7.0.0", "@turf/flatten": "^7.0.0", "@turf/length": "^7.0.0", From d85b670736b0209108682aaef12186e789d334a8 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Thu, 27 Jun 2024 09:36:00 +0545 Subject: [PATCH 02/16] feat: add zoom to layer in create project forms map --- .../FormContents/DefineAOI/MapSection/index.tsx | 11 ++++++++++- .../FormContents/GenerateTask/MapSection/index.tsx | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/CreateProject/FormContents/DefineAOI/MapSection/index.tsx b/src/frontend/src/components/CreateProject/FormContents/DefineAOI/MapSection/index.tsx index 4e6e433b..24e87e48 100644 --- a/src/frontend/src/components/CreateProject/FormContents/DefineAOI/MapSection/index.tsx +++ b/src/frontend/src/components/CreateProject/FormContents/DefineAOI/MapSection/index.tsx @@ -5,8 +5,11 @@ import MapContainer from '@Components/common/MapLibreComponents/MapContainer'; import MeasureTool from '@Components/common/MapLibreComponents/MeasureTool'; import { setCreateProjectState } from '@Store/actions/createproject'; import VectorLayer from '@Components/common/MapLibreComponents/Layers/VectorLayer'; -import { Map } from 'maplibre-gl'; +import { LngLatBoundsLike, Map } from 'maplibre-gl'; import { GeojsonType } from '@Components/common/MapLibreComponents/types'; +import getBbox from '@turf/bbox'; +import { useEffect } from 'react'; +import { FeatureCollection } from 'geojson'; export default function MapSection() { const dispatch = useTypedDispatch(); @@ -26,6 +29,12 @@ export default function MapSection() { state => state.createproject.measureType, ); + useEffect(() => { + if (!uploadedGeojson) return; + const bbox = getBbox(uploadedGeojson as FeatureCollection); + map?.fitBounds(bbox as LngLatBoundsLike, { padding: 25 }); + }, [map, uploadedGeojson]); + return ( state.createproject.splitGeojson, ); + useEffect(() => { + if (!splitGeojson) return; + const bbox = getBbox(splitGeojson as FeatureCollection); + map?.fitBounds(bbox as LngLatBoundsLike, { padding: 30 }); + }, [splitGeojson, map]); + return ( Date: Thu, 27 Jun 2024 11:27:13 +0545 Subject: [PATCH 03/16] feat: add service to upload task boundary --- src/frontend/src/services/createproject.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/frontend/src/services/createproject.ts b/src/frontend/src/services/createproject.ts index 46c8aff7..ed5dc6ad 100644 --- a/src/frontend/src/services/createproject.ts +++ b/src/frontend/src/services/createproject.ts @@ -8,3 +8,6 @@ export const postCreateProject = (data: any) => export const postPreviewSplitBySquare = (data: any) => authenticated(api).post('/projects/preview-split-by-square/', data); + +export const postTaskBoundary = ({ id, data }: {id: number; data: any}) => + authenticated(api).post(`/projects/${id}/upload-task-boundaries/`, data); From ef3f5d29771b4764a17dfa96ca07c45acb655138 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Thu, 27 Jun 2024 11:27:47 +0545 Subject: [PATCH 04/16] feat: add projectId to global state --- 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 a063c46e..efa9dce2 100644 --- a/src/frontend/src/store/slices/createproject.ts +++ b/src/frontend/src/store/slices/createproject.ts @@ -3,6 +3,7 @@ import type { CaseReducer, PayloadAction } from '@reduxjs/toolkit'; import persist from '@Store/persist'; export interface CreateProjectState { + projectId: number | null; activeStep: number; uploadAreaOption: 'draw' | 'upload_file'; keyParamOption: 'basic' | 'advanced'; @@ -14,6 +15,7 @@ export interface CreateProjectState { } const initialState: CreateProjectState = { + projectId: null, activeStep: 1, uploadAreaOption: 'upload_file', keyParamOption: 'basic', From e394f23fa8e939a5dcfefd8565fa7ffdb4d35344 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 10:18:00 +0545 Subject: [PATCH 05/16] feat: add project list api in services and api folders --- src/frontend/src/api/projects.ts | 11 +++++++++++ src/frontend/src/services/createproject.ts | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/frontend/src/api/projects.ts diff --git a/src/frontend/src/api/projects.ts b/src/frontend/src/api/projects.ts new file mode 100644 index 00000000..f2483769 --- /dev/null +++ b/src/frontend/src/api/projects.ts @@ -0,0 +1,11 @@ +import { UseQueryOptions, useQuery } from "@tanstack/react-query"; +import { getProjectsList } from "@Services/createproject"; + +export const useGetProjectsListQuery = (id?:number, queryOptions?: Partial) => { + return useQuery({ + queryKey: ['projects-list'], + queryFn: () => getProjectsList(id), + select: (res: any) => res.data, + ...queryOptions, + }); +}; \ No newline at end of file diff --git a/src/frontend/src/services/createproject.ts b/src/frontend/src/services/createproject.ts index ed5dc6ad..88340b6b 100644 --- a/src/frontend/src/services/createproject.ts +++ b/src/frontend/src/services/createproject.ts @@ -1,6 +1,11 @@ /* eslint-disable import/prefer-default-export */ import { authenticated, api } from '.'; +export const getProjectsList = (id?: number) => { + const endpoint = `/projects${id ? `/${id}` : '/'}`; + return authenticated(api).get(endpoint); +} + export const postCreateProject = (data: any) => authenticated(api).post('/projects/create_project', data, { headers: { 'Content-Type': 'application/json' }, @@ -10,4 +15,4 @@ export const postPreviewSplitBySquare = (data: any) => authenticated(api).post('/projects/preview-split-by-square/', data); export const postTaskBoundary = ({ id, data }: {id: number; data: any}) => - authenticated(api).post(`/projects/${id}/upload-task-boundaries/`, data); + authenticated(api).post(`/projects/${id}/upload-task-boundaries`, data); From 59a8f04c44d07850585dba46a0614d65ab8c7d4c Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 10:23:58 +0545 Subject: [PATCH 06/16] feat: complete google auth component --- src/frontend/src/components/GoogleAuth/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/GoogleAuth/index.tsx b/src/frontend/src/components/GoogleAuth/index.tsx index 9937c0ef..ec64867b 100644 --- a/src/frontend/src/components/GoogleAuth/index.tsx +++ b/src/frontend/src/components/GoogleAuth/index.tsx @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { Flex } from '@Components/common/Layouts'; +import { toast } from 'react-toastify'; const { BASE_URL } = process.env; @@ -18,12 +19,17 @@ function GoogleAuth() { const loginRedirect = async () => { if (authcode) { const callbackUrl = `${BASE_URL}/users/callback/?code=${authcode}&state=${state}`; + const userDetailsUrl = `${BASE_URL}/users/me/`; const completeLogin = async () => { - await fetch(callbackUrl, { credentials: 'include' }); + const response = await fetch(callbackUrl, { credentials: 'include' }); + const token = await response.json(); + localStorage.setItem('token', token); }; - await completeLogin(); + + toast.success('Logged In Successfully'); + navigate('/user-profile'); } setIsReadyToRedirect(true); }; From 2b445262f52e65ef3247b15f67ee7808622b4ffc Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 10:27:27 +0545 Subject: [PATCH 07/16] feat: add individual project routes in appRoutes --- src/frontend/src/routes/appRoutes.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/frontend/src/routes/appRoutes.ts b/src/frontend/src/routes/appRoutes.ts index ef1938b3..11c7e9d2 100644 --- a/src/frontend/src/routes/appRoutes.ts +++ b/src/frontend/src/routes/appRoutes.ts @@ -5,6 +5,7 @@ import CreateProject from '@Components/CreateProject'; import GoogleAuth from '@Components/GoogleAuth'; import userRoutes from '@UserModule/routes'; import { IRoute } from './types'; +import IndividualProject from '@Components/IndividualProject'; const appRoutes: IRoute[] = [ ...userRoutes, @@ -32,6 +33,12 @@ const appRoutes: IRoute[] = [ component: CreateProject, authenticated: true, }, + { + path: '/project/:id', + name: 'Individual Project', + component: IndividualProject, + authenticated: true, + }, { path: '/user-profile', name: 'User Profile', From d272ec5534f713604c8b5f1a75022819b5d8ac77 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 13:03:51 +0545 Subject: [PATCH 08/16] feat: add skeleton component for project cards --- .../components/Projects/ProjectCardSkeleton/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/frontend/src/components/Projects/ProjectCardSkeleton/index.tsx diff --git a/src/frontend/src/components/Projects/ProjectCardSkeleton/index.tsx b/src/frontend/src/components/Projects/ProjectCardSkeleton/index.tsx new file mode 100644 index 00000000..2971d844 --- /dev/null +++ b/src/frontend/src/components/Projects/ProjectCardSkeleton/index.tsx @@ -0,0 +1,11 @@ +import Skeleton from '@Components/RadixComponents/Skeleton'; + +export default function ProjectCardSkeleton() { + return ( + + + + + + ); +} From 2251c2e5d4c6093c9ac61779a5d7daa5ad2105e8 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 13:04:47 +0545 Subject: [PATCH 09/16] refactor: modify project card skeleton component for dynamic prop passing --- .../components/Projects/ProjectCard/index.tsx | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/frontend/src/components/Projects/ProjectCard/index.tsx b/src/frontend/src/components/Projects/ProjectCard/index.tsx index d52c7715..7ac623b2 100644 --- a/src/frontend/src/components/Projects/ProjectCard/index.tsx +++ b/src/frontend/src/components/Projects/ProjectCard/index.tsx @@ -1,18 +1,37 @@ +import { useNavigate } from 'react-router-dom'; import MapSection from './MapSection'; +import { GeojsonType } from '@Components/common/MapLibreComponents/types'; + +interface IProjectCardProps { + containerId: string; + id: number; + title: string; + description: string; + geojson: GeojsonType; +} + +export default function ProjectCard({ + containerId, + id, + title, + description, + geojson, +}: IProjectCardProps) { + const navigate = useNavigate(); + + const onProjectCardClick = () => { + navigate(`/project/${id}`); + }; -export default function ProjectCard({ containerId }: { containerId: string }) { return ( -
- -

ID: #12468

-

- Lorem ipsum dolor sit amet consectur -

-

- Cameroon RoLorem ipsum dolor sit amet consec.Lorem ipsum dolor sit amet - consectetur.Lorem ipsum dolor sit amet consectetur.ad Assessment for - Sustainable Development in Rural Communities in Africa -

+
+ +

ID: #{id}

+

{title}

+

{description}

); } From 8ecc2662ba6242571447d756d65327d288543074 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 13:05:50 +0545 Subject: [PATCH 10/16] feat: zoom to layer in project card map section --- .../Projects/ProjectCard/MapSection/index.tsx | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/components/Projects/ProjectCard/MapSection/index.tsx b/src/frontend/src/components/Projects/ProjectCard/MapSection/index.tsx index caa17321..3c05854e 100644 --- a/src/frontend/src/components/Projects/ProjectCard/MapSection/index.tsx +++ b/src/frontend/src/components/Projects/ProjectCard/MapSection/index.tsx @@ -1,8 +1,20 @@ +import { useEffect } from 'react'; +import { LngLatBoundsLike, Map } from 'maplibre-gl'; import { useMapLibreGLMap } from '@Components/common/MapLibreComponents'; import BaseLayerSwitcher from '@Components/common/MapLibreComponents/BaseLayerSwitcher'; +import VectorLayer from '@Components/common/MapLibreComponents/Layers/VectorLayer'; import MapContainer from '@Components/common/MapLibreComponents/MapContainer'; +import { GeojsonType } from '@Components/common/MapLibreComponents/types'; +import getBbox from '@turf/bbox'; +import { FeatureCollection } from 'geojson'; -export default function MapSection({ containerId }: { containerId: string }) { +export default function MapSection({ + containerId, + geojson, +}: { + containerId: string; + geojson: GeojsonType; +}) { const { map, isMapLoaded } = useMapLibreGLMap({ containerId, mapOptions: { @@ -12,6 +24,13 @@ export default function MapSection({ containerId }: { containerId: string }) { }, disableRotation: true, }); + + useEffect(() => { + if (!geojson) return; + const bbox = getBbox(geojson as FeatureCollection); + map?.fitBounds(bbox as LngLatBoundsLike, { padding: 30 }); + }, [geojson, map]); + return ( + {geojson && ( + + )} ); From 9f3faa9d8515208433140c2a2e4c2c5a3fbd0a39 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 13:06:35 +0545 Subject: [PATCH 11/16] feat: implement api in projects section and add skeleton --- src/frontend/src/views/Projects/index.tsx | 29 ++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/views/Projects/index.tsx b/src/frontend/src/views/Projects/index.tsx index 33bad8a9..f7f9d6ca 100644 --- a/src/frontend/src/views/Projects/index.tsx +++ b/src/frontend/src/views/Projects/index.tsx @@ -4,9 +4,15 @@ import { ProjectsHeader, ProjectsMapSection, } from '@Components/Projects'; +import { useGetProjectsListQuery } from '@Api/projects'; +import ProjectCardSkeleton from '@Components/Projects/ProjectCardSkeleton'; export default function Projects() { const showMap = useTypedSelector(state => state.common.showMap); + + // fetch api for projectsList + const { data: projectsList, isLoading } = useGetProjectsListQuery(); + return (
@@ -19,9 +25,26 @@ export default function Projects() { : 'lg:scrollbar naxatw-grid-cols-1 sm:naxatw-grid-cols-2 md:naxatw-grid-cols-3 lg:naxatw-h-[75vh] lg:naxatw-grid-cols-2 lg:naxatw-overflow-y-scroll 2xl:naxatw-grid-cols-3' }`} > - {[1, 2, 3, 4, 5, 6].map(item => ( - - ))} + {isLoading ? ( + <> + {Array.from({ length: 6 }, (_, index) => ( + + ))} + + ) : ( + (projectsList as Record[])?.map( + (singleproject: Record) => ( + + ), + ) + )}
{showMap && } From 2ac25506571f3b593940eab1da64be446093c0c8 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 15:11:21 +0545 Subject: [PATCH 12/16] feat: able to draw in define aoi in form section --- .../CreateProject/FormContents/DefineAOI/index.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx b/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx index 142211ed..204114bf 100644 --- a/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx +++ b/src/frontend/src/components/CreateProject/FormContents/DefineAOI/index.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import { useTypedDispatch, useTypedSelector } from '@Store/hooks'; import { setCreateProjectState } from '@Store/actions/createproject'; import { FlexColumn } from '@Components/common/Layouts'; @@ -12,6 +13,9 @@ export default function DefineAOI({ formProps }: { formProps: any }) { const dispatch = useTypedDispatch(); const { setValue } = formProps; + const uploadedGeojson = useTypedSelector( + state => state.createproject.uploadedGeojson, + ); const uploadAreaOption = useTypedSelector( state => state.createproject.uploadAreaOption, ); @@ -26,7 +30,6 @@ export default function DefineAOI({ formProps }: { formProps: any }) { dispatch( setCreateProjectState({ uploadedGeojson: convertedGeojson }), ); - setValue('outline_geojson', convertedGeojson); } }); } catch (err: any) { @@ -35,6 +38,11 @@ export default function DefineAOI({ formProps }: { formProps: any }) { } }; + useEffect(() => { + if (!uploadedGeojson) return; + setValue('outline_geojson', uploadedGeojson); + }, [uploadedGeojson]); + return (
From 24292a102189c6255b242adb6193ed0418eebced Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 15:13:54 +0545 Subject: [PATCH 13/16] style: change box shadow in project cards --- src/frontend/src/components/Projects/ProjectCard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/Projects/ProjectCard/index.tsx b/src/frontend/src/components/Projects/ProjectCard/index.tsx index 7ac623b2..833b1750 100644 --- a/src/frontend/src/components/Projects/ProjectCard/index.tsx +++ b/src/frontend/src/components/Projects/ProjectCard/index.tsx @@ -26,7 +26,7 @@ export default function ProjectCard({ return (

ID: #{id}

From de04c02387ef2a207a5221e5cb52a7a2e1174765 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 15:15:15 +0545 Subject: [PATCH 14/16] feat: upload project boundary when creating project --- .../CreateprojectLayout/index.tsx | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx b/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx index ec02e863..58fd6550 100644 --- a/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx +++ b/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx @@ -1,5 +1,3 @@ -/* eslint-disable no-unused-vars */ -/* eslint-disable no-console */ import { useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; import { useTypedSelector, useTypedDispatch } from '@Store/hooks'; @@ -17,9 +15,11 @@ import { ContributionsForm, GenerateTaskForm, } from '@Components/CreateProject/FormContents'; -import { postCreateProject } from '@Services/createproject'; +import { postCreateProject, postTaskBoundary } from '@Services/createproject'; import { useMutation } from '@tanstack/react-query'; import { toast } from 'react-toastify'; +import { convertGeojsonToFile } from '@Utils/convertLayerUtils'; +import prepareFormData from '@Utils/prepareFormData'; /** * This function looks up the provided map of components to find and return @@ -59,6 +59,9 @@ export default function CreateprojectLayout() { const dispatch = useTypedDispatch(); const navigate = useNavigate(); const activeStep = useTypedSelector(state => state.createproject.activeStep); + const splitGeojson = useTypedSelector( + state => state.createproject.splitGeojson, + ); const initialState = { name: '', @@ -68,11 +71,26 @@ export default function CreateprojectLayout() { outline_geojson: {}, }; - const { mutate } = useMutation({ + const { mutate: uploadTaskBoundary } = useMutation({ + mutationFn: postTaskBoundary, + onSuccess: () => { + toast.success('Project Boundary Uploaded'); + navigate('/'); + }, + onError: err => { + toast.error(err.message); + }, + }); + + const { mutate: createProject } = useMutation({ mutationFn: postCreateProject, onSuccess: (res: any) => { toast.success('Project Created Successfully'); - navigate('/'); + dispatch(setCreateProjectState({ projectId: res.data.id })); + if (!splitGeojson) return; + const geojson = convertGeojsonToFile(splitGeojson); + const formData = prepareFormData({ task_geojson: geojson }); + uploadTaskBoundary({ id: res.data.id, data: formData }); }, onError: err => { toast.error(err.message); @@ -81,10 +99,11 @@ export default function CreateprojectLayout() { const onSubmit = (data: any) => { if (activeStep < 5) return; - mutate(data); + createProject(data); + reset(); }; - const { register, setValue, handleSubmit } = useForm({ + const { register, setValue, handleSubmit, reset } = useForm({ defaultValues: initialState, }); From eb69fb79255cc377f49cb4a766e1e57e160f90d0 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 15:15:40 +0545 Subject: [PATCH 15/16] feat: individual project initial slicing --- .../src/components/IndividualProject/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/frontend/src/components/IndividualProject/index.tsx diff --git a/src/frontend/src/components/IndividualProject/index.tsx b/src/frontend/src/components/IndividualProject/index.tsx new file mode 100644 index 00000000..6334b91c --- /dev/null +++ b/src/frontend/src/components/IndividualProject/index.tsx @@ -0,0 +1,10 @@ +import { useParams } from 'react-router-dom'; + +export default function IndividualProject() { + const { id } = useParams(); + return ( +
+

This is {id} project section

+
+ ); +} From c6cc35f6b04507e42891cbf0845aefed8adf56e7 Mon Sep 17 00:00:00 2001 From: prajwalism Date: Mon, 1 Jul 2024 15:28:16 +0545 Subject: [PATCH 16/16] refactor: change default route from / to /projects --- .../components/CreateProject/CreateProjectHeader/index.tsx | 2 +- .../components/CreateProject/CreateprojectLayout/index.tsx | 2 +- src/frontend/src/components/Projects/ProjectCard/index.tsx | 2 +- src/frontend/src/constants/index.ts | 2 +- .../src/components/Authentication/Login/index.tsx | 2 +- src/frontend/src/routes/appRoutes.ts | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/components/CreateProject/CreateProjectHeader/index.tsx b/src/frontend/src/components/CreateProject/CreateProjectHeader/index.tsx index d4d36203..3deefdaa 100644 --- a/src/frontend/src/components/CreateProject/CreateProjectHeader/index.tsx +++ b/src/frontend/src/components/CreateProject/CreateProjectHeader/index.tsx @@ -6,7 +6,7 @@ export default function CreateProjectHeader() { const navigate = useNavigate(); return ( - navigate('/')} /> + navigate('/projects')} />
Project /
 Add Project
diff --git a/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx b/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx index 58fd6550..af40ad69 100644 --- a/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx +++ b/src/frontend/src/components/CreateProject/CreateprojectLayout/index.tsx @@ -75,7 +75,7 @@ export default function CreateprojectLayout() { mutationFn: postTaskBoundary, onSuccess: () => { toast.success('Project Boundary Uploaded'); - navigate('/'); + navigate('/projects'); }, onError: err => { toast.error(err.message); diff --git a/src/frontend/src/components/Projects/ProjectCard/index.tsx b/src/frontend/src/components/Projects/ProjectCard/index.tsx index 833b1750..f54aee6b 100644 --- a/src/frontend/src/components/Projects/ProjectCard/index.tsx +++ b/src/frontend/src/components/Projects/ProjectCard/index.tsx @@ -20,7 +20,7 @@ export default function ProjectCard({ const navigate = useNavigate(); const onProjectCardClick = () => { - navigate(`/project/${id}`); + navigate(`/projects/${id}`); }; return ( diff --git a/src/frontend/src/constants/index.ts b/src/frontend/src/constants/index.ts index d7b1dda5..4b9508dc 100644 --- a/src/frontend/src/constants/index.ts +++ b/src/frontend/src/constants/index.ts @@ -2,7 +2,7 @@ export const navLinks = [ { id: 1, - link: '/', + link: '/projects', linkName: 'Projects', }, { diff --git a/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx b/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx index 4cc6060f..72738505 100644 --- a/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx +++ b/src/frontend/src/modules/user-auth-module/src/components/Authentication/Login/index.tsx @@ -40,7 +40,7 @@ export default function Login() { localStorage.setItem('token', res.data.access_token); localStorage.setItem('refresh', res.data.refresh_token); toast.success('Logged In Successfully'); - navigate('/'); + navigate('/projects'); }, onError: err => { toast.error(err.response.data.detail); diff --git a/src/frontend/src/routes/appRoutes.ts b/src/frontend/src/routes/appRoutes.ts index 11c7e9d2..cd7047de 100644 --- a/src/frontend/src/routes/appRoutes.ts +++ b/src/frontend/src/routes/appRoutes.ts @@ -10,7 +10,7 @@ import IndividualProject from '@Components/IndividualProject'; const appRoutes: IRoute[] = [ ...userRoutes, { - path: '/', + path: '/projects', name: 'Projects ', component: Projects, authenticated: true, @@ -34,7 +34,7 @@ const appRoutes: IRoute[] = [ authenticated: true, }, { - path: '/project/:id', + path: '/projects/:id', name: 'Individual Project', component: IndividualProject, authenticated: true,