Skip to content
Merged
7 changes: 7 additions & 0 deletions src/api/applicant.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ export const patchPassNonPassStatus = async (
);
return response.data;
};

export const getPassNonPassList = async (projectId: number) => {
const response = await httpClient.get(
`/project/${projectId}/applicant/summary`
);
return response.data;
};
3 changes: 2 additions & 1 deletion src/components/common/noContent/NoContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import * as S from './NoContent.styled';
import { DocumentTextIcon } from '@heroicons/react/24/outline';

interface NoContentProps {
type: 'projects' | 'applicants';
type: 'projects' | 'applicants' | 'passNonPass';
}

export default function NoContent({ type }: NoContentProps) {
const INPUT_CONTENT = {
projects: '공고가',
applicants: '지원자가',
passNonPass: '합/불합격자 리스트가',
};

return (
Expand Down
15 changes: 15 additions & 0 deletions src/components/manageProjects/ProjectHeader.styled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import styled from 'styled-components';

export const TitleWrapper = styled.div`
display: flex;
justify-content: start;
align-items: center;
width: 100%;
`;

export const RecruitmentEnd = styled.h3`
margin-left: 1.2rem;
font-size: 1rem;
font-weight: 400;
color: ${({ theme }) => theme.color.red};
`;
21 changes: 21 additions & 0 deletions src/components/manageProjects/ProjectHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as S from './ProjectHeader.styled';
import Title from '../common/title/Title';
import { ProjectDetailExtended } from '../../models/projectDetail';
import RecruitmentDate from './RecruitmentDate';
interface ProjectHeaderProps {
projectData: ProjectDetailExtended;
}

function ProjectHeader({ projectData }: ProjectHeaderProps) {
return (
<>
<S.TitleWrapper>
{projectData && <Title size='semiLarge'>{projectData.title} </Title>}
{projectData?.isDone && <S.RecruitmentEnd>공고 마감</S.RecruitmentEnd>}
</S.TitleWrapper>
{projectData && <RecruitmentDate ProjectData={projectData} />}
</>
);
}

export default ProjectHeader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import styled from 'styled-components';

export const ItemWrapper = styled.li`
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
padding: 1rem;
border: 1px solid ${({ theme }) => theme.color.grey};
border-radius: ${({ theme }) => theme.borderRadius.primary};
&:hover {
background-color: ${({ theme }) => theme.color.navy};
color: ${({ theme }) => theme.color.white};
}

svg {
color: #e69191;
width: 1.2rem;
height: 1.2rem;
}
`;

export const NickName = styled.p`
font-size: ${({ theme }) => theme.heading.small.fontSize};
font-weight: 400;
`;

export const DeleteButton = styled.button``;
20 changes: 20 additions & 0 deletions src/components/manageProjects/passNonPassList/PassNonPassItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ApplicantInfo } from '../../../models/applicant';
import * as S from './PassNonPassItem.styled';
import { XCircleIcon } from '@heroicons/react/24/outline';

interface PassNonPassItemProps {
userInfo: ApplicantInfo;
}

function PassNonPassItem({ userInfo }: PassNonPassItemProps) {
return (
<S.ItemWrapper>
<S.NickName>{userInfo.User.nickname}</S.NickName>
<S.DeleteButton>
<XCircleIcon />
</S.DeleteButton>
</S.ItemWrapper>
);
}

export default PassNonPassItem;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import styled from 'styled-components';

export const Wrapper = styled.ul`
width: 100%;
height: 27rem;
min-width: 22rem;
border-radius: ${({ theme }) => theme.borderRadius.primary};
border: 1px solid ${({ theme }) => theme.color.border};
padding: 1.6rem 2rem;
gap: 1rem;
display: flex;
flex-direction: column;
justify-content: start;
align-items: center;
overflow: hidden;
overflow-y: auto;
&::-webkit-scrollbar {
display: none;
}
`;
19 changes: 19 additions & 0 deletions src/components/manageProjects/passNonPassList/PassNonPassList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ApplicantInfo } from '../../../models/applicant';
import PassNonPassItem from './PassNonPassItem';
import * as S from './PassNonPassList.styled';

interface PassNonPassListProps {
passNonPassListData: ApplicantInfo[];
}

function PassNonPassList({ passNonPassListData }: PassNonPassListProps) {
return (
<S.Wrapper>
{passNonPassListData.map((data) => (
<PassNonPassItem key={data.userId} userInfo={data} />
))}
</S.Wrapper>
);
}

export default PassNonPassList;
1 change: 1 addition & 0 deletions src/hooks/queries/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const managedProjectsKey = {
export const applicantKey = {
all: ['applicantList'],
info: ['applicantInfo'],
passNonPass: ['passNonPassList'],
};

export const myInfoKey = {
Expand Down
13 changes: 13 additions & 0 deletions src/hooks/usePassNonPassList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useQuery } from '@tanstack/react-query';
import { applicantKey } from './queries/keys';
import { getPassNonPassList } from '../api/applicant.api';

export const usePassNonPassList = (projectId: number) => {
const { data } = useQuery({
queryKey: applicantKey.passNonPass,
queryFn: () => getPassNonPassList(projectId),
staleTime: 1 * 60 * 1000,
});

return { passNonPassListData: data };
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface useMutationParams {
userId: number;
}

export const usePassNonPass = (
export const usePassNonPassMutation = (
projectId: number,
openModal: (message: string) => void
) => {
Expand Down
10 changes: 10 additions & 0 deletions src/mock/applicant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { http, HttpResponse } from 'msw';
import mockApplicantsData from './mockApplicantsData.json';
import mockApplicantData from './mockApplicantData.json';
import mockPassNonPassListData from './mockPassNonPassListData.json';

export const applicantList = http.get(
`${import.meta.env.VITE_API_BASE_URL}/project/:projectId/applicant`,
Expand All @@ -20,6 +21,15 @@ export const applicantInfo = http.get(
}
);

export const passNonPassList = http.get(
`${import.meta.env.VITE_API_BASE_URL}/project/:projectId/applicant/summary`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 env도 하나의 상수처럼 관리하면 조금 더 편할지 모르겠네요 👀

() => {
return HttpResponse.json(mockPassNonPassListData, {
status: 200,
});
}
);

export const passNonPass = http.patch(
`${
import.meta.env.VITE_API_BASE_URL
Expand Down
8 changes: 7 additions & 1 deletion src/mock/browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { setupWorker } from 'msw/browser';
import { myProjectList } from './manageProjectList';
import { applicantInfo, applicantList, passNonPass } from './applicant';
import {
applicantInfo,
applicantList,
passNonPass,
passNonPassList,
} from './applicant';
import { projectDetail } from './projectDetail';

export const handlers = [
Expand All @@ -9,6 +14,7 @@ export const handlers = [
projectDetail,
applicantInfo,
passNonPass,
passNonPassList,
];

export const worker = setupWorker(...handlers);
Loading
Loading