-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from hotosm/feat/create-project-form
Create project form
- Loading branch information
Showing
18 changed files
with
203 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { UseQueryOptions, useQuery } from "@tanstack/react-query"; | ||
import { getProjectsList } from "@Services/createproject"; | ||
|
||
export const useGetProjectsListQuery = (id?:number, queryOptions?: Partial<UseQueryOptions>) => { | ||
return useQuery({ | ||
queryKey: ['projects-list'], | ||
queryFn: () => getProjectsList(id), | ||
select: (res: any) => res.data, | ||
...queryOptions, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useParams } from 'react-router-dom'; | ||
|
||
export default function IndividualProject() { | ||
const { id } = useParams(); | ||
return ( | ||
<section> | ||
<h4>This is {id} project section</h4> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 31 additions & 12 deletions
43
src/frontend/src/components/Projects/ProjectCard/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(`/projects/${id}`); | ||
}; | ||
|
||
export default function ProjectCard({ containerId }: { containerId: string }) { | ||
return ( | ||
<div className="!naxatw-col-span-1 naxatw-rounded-md naxatw-border naxatw-border-grey-400 naxatw-p-[0.625rem]"> | ||
<MapSection containerId={containerId} /> | ||
<p className="naxatw-mt-2 naxatw-text-body-sm">ID: #12468</p> | ||
<p className="naxatw-text-body-btn naxatw-text-grey-800"> | ||
Lorem ipsum dolor sit amet consectur | ||
</p> | ||
<p className="naxatw-text-body-sm"> | ||
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 | ||
</p> | ||
<div | ||
onClick={onProjectCardClick} | ||
className="!naxatw-col-span-1 naxatw-max-h-[19.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" | ||
> | ||
<MapSection containerId={containerId} geojson={geojson} /> | ||
<p className="naxatw-mt-2 naxatw-text-body-sm">ID: #{id}</p> | ||
<p className="naxatw-text-body-btn naxatw-text-grey-800">{title}</p> | ||
<p className="naxatw-line-clamp-4 naxatw-text-body-sm">{description}</p> | ||
</div> | ||
); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/frontend/src/components/Projects/ProjectCardSkeleton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Skeleton from '@Components/RadixComponents/Skeleton'; | ||
|
||
export default function ProjectCardSkeleton() { | ||
return ( | ||
<Skeleton className="!naxatw-col-span-1 naxatw-max-h-[19.25rem] naxatw-w-[13.5rem] naxatw-cursor-pointer naxatw-rounded-md naxatw-border naxatw-border-grey-400 naxatw-p-[0.625rem] hover:naxatw-shadow-lg"> | ||
<Skeleton className="naxatw-h-[10rem] naxatw-bg-grey-50" /> | ||
<Skeleton className="naxatw-mt-2 naxatw-h-[20px] naxatw-w-1/2 naxatw-bg-grey-50" /> | ||
<Skeleton className="naxatw-mt-2 naxatw-h-[30px] naxatw-bg-grey-50" /> | ||
</Skeleton> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
export const navLinks = [ | ||
{ | ||
id: 1, | ||
link: '/', | ||
link: '/projects', | ||
linkName: 'Projects', | ||
}, | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.