diff --git a/apps/member/src/pages/ApplicationPage/ApplicationPage.tsx b/apps/member/src/pages/ApplicationPage/ApplicationPage.tsx deleted file mode 100644 index 44d5716d..00000000 --- a/apps/member/src/pages/ApplicationPage/ApplicationPage.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { Suspense } from 'react'; - -import ApplicationListSection from '@components/application/ApplicationListSection/ApplicationListSection'; -import Content from '@components/common/Content/Content'; -import Header from '@components/common/Header/Header'; - -import { ROLE_LEVEL } from '@constants/state'; -import { useMyProfile } from '@hooks/queries'; -import { useRecruitment } from '@hooks/queries/recruitment/useRecruitment'; -import { formattedDate } from '@utils/date'; - -const ApplicationPage = () => { - const { data } = useMyProfile(); - const { data: recruitmentList } = useRecruitment(); - - const optionList = recruitmentList.map((item) => ({ - id: item.id, - value: item.id, - name: `${item.applicationType} - ${formattedDate(item.startDate)} ~ ${formattedDate(item.endDate)}`, - })); - - if (data.roleLevel! < ROLE_LEVEL.ADMIN) { - throw new Error('접근 권한이 없습니다.'); - } - - return ( - -
- - - - - ); -}; - -export default ApplicationPage; diff --git a/apps/member/src/components/application/ApplicationListSection/ApplicationListSection.tsx b/apps/member/src/pages/ApplicationPage/components/ApplicationListSection.tsx similarity index 71% rename from apps/member/src/components/application/ApplicationListSection/ApplicationListSection.tsx rename to apps/member/src/pages/ApplicationPage/components/ApplicationListSection.tsx index 2a62a5b8..0eb0edab 100644 --- a/apps/member/src/components/application/ApplicationListSection/ApplicationListSection.tsx +++ b/apps/member/src/pages/ApplicationPage/components/ApplicationListSection.tsx @@ -1,5 +1,4 @@ -import { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useMemo, useState } from 'react'; import { Badge, Button, Table } from '@clab-platforms/design-system'; @@ -8,53 +7,50 @@ import { Section } from '@components/common/Section'; import Select from '@components/common/Select/Select'; import { TABLE_HEAD } from '@constants/head'; -import { useModal } from '@hooks/common/useModal'; import { usePagination } from '@hooks/common/usePagination'; +import { formattedDate } from '@utils/date'; +import { toKoreanApplicationType } from '@utils/string'; + import { useApplicationAllMemberMutation, useApplicationConditions, + useApplicationInoModal, useApplicationMemberMutation, useApplicationNonePassMutation, useApplicationPassMutation, -} from '@hooks/queries/application'; - -import type { ApplicationMemberType } from '@type/application'; - -import { ApplicationInfoModal } from './ApplicationInfoModal'; - -interface RecruitmentItem { - id: number; - value: number; - name: string; -} + useRecruitment, +} from '../hooks'; -interface ApplicationListSectionProps { - recruitmentList: RecruitmentItem[]; -} +export function ApplicationListSection() { + const { open } = useApplicationInoModal(); + const { data: recruitmentList } = useRecruitment(); -const ApplicationListSection = ({ - recruitmentList, -}: ApplicationListSectionProps) => { - const navigate = useNavigate(); - const { open } = useModal(); const [selectRecruitment, setSelectRecruitment] = useState( - recruitmentList.length, // 가장 최신의 모집공고 + recruitmentList.length, ); const { page, size, handlePageChange } = usePagination(); - const { data } = useApplicationConditions({ + + const { mutate: applicationMemberMutate } = useApplicationMemberMutation(); + const { mutate: applicationAllMemberMutate } = + useApplicationAllMemberMutation(); + const { mutate: applicationNonePassMutate } = + useApplicationNonePassMutation(); + const { mutate: applicationPassMutate } = useApplicationPassMutation(); + const { data: applicationConditions } = useApplicationConditions({ recruitmentId: selectRecruitment, page, size, }); - const { applicationMemberMutate } = useApplicationMemberMutation(); - const { applicationAllMemberMutate } = useApplicationAllMemberMutation(); - const { applicationNonePassMutate } = useApplicationNonePassMutation(); - const { applicationPassMutate } = useApplicationPassMutation(); - useEffect(() => { - navigate(''); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [selectRecruitment]); + const options = useMemo( + () => + recruitmentList.map(({ id, applicationType, startDate, endDate }) => ({ + id: id, + value: id, + name: `${id}. ${toKoreanApplicationType(applicationType)} / ${formattedDate(startDate)} ~ ${formattedDate(endDate)}`, + })), + [recruitmentList], + ); const handleRecruitmentChange = (e: React.ChangeEvent) => { setSelectRecruitment(+e.target.value); @@ -79,13 +75,6 @@ const ApplicationListSection = ({ applicationAllMemberMutate(selectRecruitment); }; - const handleViewButtonClick = (info: ApplicationMemberType) => { - return open({ - title: '지원서', - content: , - }); - }; - return (