This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ruslan Kutliakhmetov <[email protected]>
- Loading branch information
1 parent
33d8a94
commit f442b52
Showing
69 changed files
with
1,391 additions
and
560 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,5 @@ | ||
export * from './useGetPositions'; | ||
export * from './useGetPositionsSkills'; | ||
export * from './useGetProject'; | ||
export * from './useGetProjectAvatar'; | ||
export * from './useGetUser'; |
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,9 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { api } from '~/shared/contexts'; | ||
|
||
export const useGetPositions = (projectId: string) => | ||
useQuery({ | ||
queryKey: ['getProjectPositions', projectId], | ||
queryFn: () => api.projectsApi.getProjectPositions(projectId), | ||
}); |
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,19 @@ | ||
import { useQueries } from '@tanstack/react-query'; | ||
|
||
import { GetProjectPositionsData } from '~/shared/api/types'; | ||
import { api } from '~/shared/contexts'; | ||
|
||
export const useGetPositionsSkills = ( | ||
projectId: string, | ||
projectPositions?: GetProjectPositionsData, | ||
) => | ||
useQueries({ | ||
queries: projectPositions | ||
? projectPositions.map(({ id }) => { | ||
return { | ||
queryKey: ['positionSkills', projectId, id], | ||
queryFn: () => api.projectsApi.getPositionSkills(projectId, id), | ||
}; | ||
}) | ||
: [], | ||
}); |
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,9 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { api } from '~/shared/contexts'; | ||
|
||
export const useGetProject = (projectId: string) => | ||
useQuery({ | ||
queryKey: ['getCurrentProject', projectId], | ||
queryFn: () => api.projectsApi.getCurrentProject(projectId), | ||
}); |
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,9 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { api } from '~/shared/contexts'; | ||
|
||
export const useGetProjectAvatar = (projectId: string) => | ||
useQuery({ | ||
queryKey: ['useGetProjectAvatar', projectId], | ||
queryFn: () => api.projectsApi.getProjectAvatar(projectId), | ||
}); |
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,9 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { api } from '~/shared/contexts'; | ||
|
||
export const useGetUser = (userID: string) => | ||
useQuery({ | ||
queryKey: ['userID', userID], | ||
queryFn: () => api.userApi.getUser(userID), | ||
}); |
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,30 @@ | ||
import { Flex, Heading, Stack, Text } from '@chakra-ui/layout'; | ||
import { Avatar, Skeleton } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import { Rating } from '~/shared/ui/rating'; | ||
|
||
import { useGetUser } from '../api'; | ||
|
||
export const Contacts = ({ ownerId }: { ownerId: string }) => { | ||
const { data: owner, isSuccess: loadedOwner } = useGetUser(ownerId); | ||
return ( | ||
<> | ||
<Heading variant="h2">Контакты</Heading> | ||
<Skeleton isLoaded={loadedOwner} borderRadius="2xl" fadeDuration={2}> | ||
<Flex alignItems="flex-start"> | ||
<Avatar src="" name={`${owner?.first_name} ${owner?.last_name}`} /> | ||
<Stack pl={2} gap={0}> | ||
<Heading variant="h3"> | ||
{owner?.first_name} {owner?.last_name} | ||
</Heading> | ||
<Text variant="caption">Организатор</Text> | ||
</Stack> | ||
<Flex ml="auto"> | ||
<Rating /> | ||
</Flex> | ||
</Flex> | ||
</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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Contacts'; |
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,2 +1,5 @@ | ||
export * from './card'; | ||
export * from './contacts'; | ||
export * from './avatars-group'; | ||
export * from './api'; | ||
export * from './info'; |
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,71 @@ | ||
import { Heading, Stack } from '@chakra-ui/layout'; | ||
import { Skeleton } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import { GetSpecsData } from '~/shared/api'; | ||
import { GetProjectPositionsData } from '~/shared/api/types'; | ||
import { STag } from '~/shared/ui/STag'; | ||
import { Status } from '~/shared/ui/status'; | ||
|
||
import { Card } from '../card'; | ||
|
||
interface Project { | ||
deadline: string; | ||
status: string; | ||
id: string; | ||
name: string; | ||
description: string | null; | ||
owner_id: string; | ||
startline: string; | ||
created_at: string; | ||
updated_at: string; | ||
} | ||
|
||
interface ProjectInfoProps { | ||
allSpecs?: GetSpecsData; | ||
specs: string[]; | ||
skills: string[][]; | ||
project: Project; | ||
positions?: GetProjectPositionsData; | ||
ioadedPositions: boolean; | ||
} | ||
|
||
export const ProjectInfo = ({ | ||
allSpecs, | ||
specs, | ||
skills, | ||
project, | ||
positions, | ||
ioadedPositions, | ||
}: ProjectInfoProps) => { | ||
const filterMainTag = (positionId?: string) => { | ||
const mainTag = allSpecs | ||
?.filter(({ id }) => id === positionId) | ||
.map(({ name }) => name ?? ''); | ||
return mainTag; | ||
}; | ||
return ( | ||
<> | ||
<Stack gap={0} mb={3} alignItems="start"> | ||
<Status mb={['3', '4']}>{project.status}</Status> | ||
<Card | ||
title={project.name} | ||
date={project.deadline} | ||
description={project.description} | ||
fullDescription={true} | ||
/> | ||
</Stack> | ||
|
||
<Stack gap={0} mb={6}> | ||
<Heading variant="h2">В проект требуются</Heading> | ||
<Skeleton isLoaded={ioadedPositions} borderRadius="2xl" fadeDuration={2}> | ||
<Stack> | ||
{positions?.map((_, i) => ( | ||
<STag key={i} mainTags={filterMainTag(specs[i])} tags={skills[i]} /> | ||
))} | ||
</Stack> | ||
</Skeleton> | ||
</Stack> | ||
</> | ||
); | ||
}; |
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 @@ | ||
export * from './ProjectInfo'; |
Oops, something went wrong.