Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/applicants additionals #339

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Hooks/study/useAcceptApplyMutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useAcceptApplyMutation = (studyId: number, applicantId: number, suc
mutationKey: [...STUDY.APPLY_ACCEPT(studyId, applicantId)],
mutationFn: () => acceptApply(studyId, applicantId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [STUDY.APPLICNATS(studyId)] });
queryClient.invalidateQueries({ queryKey: [...STUDY.APPLICNATS(studyId)] });
successHandler();
openModal();
},
Expand Down
72 changes: 32 additions & 40 deletions src/Pages/Applicants/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { ApplicantCard } from '@/Components/ApplicantCard';
import { Applicant } from '@/Types/study';
import Button from '@/Components/Common/Button';
import { useUserStore } from '@/store/user';
import { Link, useLocation, useNavigate, useParams } from 'react-router-dom';
import { Link, useNavigate, useParams } from 'react-router-dom';
import { useApplicantsDetail } from '@/Hooks/study/useApplicantsDetail';
import { useCloseRecruitmentMutation } from '@/Hooks/recruitments/useCloseRecruitmentMutation';
import { useEffect } from 'react';
import { RowDivider } from '@/Components/Common/Divider/RowDivider';
import Footer from '@/Components/Footer';

Expand All @@ -22,16 +21,6 @@ export const ApplicantsPage = () => {

const { mutate: closeRecruitmentMutate } = useCloseRecruitmentMutation(studyId);

const { pathname } = useLocation();

useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);

if (isLoading) return <Loading />;

const isOwner = user?.id === study.owner.id;

return (
<Page>
<Header>
Expand All @@ -46,33 +35,37 @@ export const ApplicantsPage = () => {
</Header>
<RowDivider />
<Main>
<MainInner>
<ParentNav studyTitle={study.title} />
<InfoSection>
<InfoFields>
<InfoField title="ν˜„μž¬ μΈμ›μˆ˜" content={study.participantCount} flexDirection="column" />
<InfoField title="λͺ©ν‘œ μΈμ›μˆ˜" content={study.participantLimit} flexDirection="column" />
</InfoFields>
<Applicants>
{applicants.map((applicant) => (
<ApplicantLi key={applicant.id}>
<ApplicantCard
studyId={studyId}
id={applicant.id}
title={study.title}
nickname={applicant.nickname}
email={applicant.email}
position={applicant.position}
isOwner={isOwner}
reviewStatistics={applicant.reviewStatistics}
/>
</ApplicantLi>
))}
</Applicants>
</InfoSection>
</MainInner>
{isLoading ? (
<Loading />
) : (
<MainInner>
<ParentNav studyTitle={study.title} />
<InfoSection>
<InfoFields>
<InfoField title="ν˜„μž¬ μΈμ›μˆ˜" content={study.participantCount} flexDirection="column" />
<InfoField title="λͺ©ν‘œ μΈμ›μˆ˜" content={study.participantLimit} flexDirection="column" />
</InfoFields>
<Applicants>
{applicants.map((applicant) => (
<ApplicantLi key={applicant.id}>
<ApplicantCard
studyId={studyId}
id={applicant.id}
title={study.title}
nickname={applicant.nickname}
email={applicant.email}
position={applicant.position}
isOwner={user?.id === study.owner.id}
reviewStatistics={applicant.reviewStatistics}
/>
</ApplicantLi>
))}
</Applicants>
</InfoSection>
</MainInner>
)}
</Main>
{isOwner && (
{user?.id === study?.owner.id && (
<CloseSection>
<CloseSectionInner>
<Button scheme="secondary" onClick={() => (closeRecruitmentMutate(), navigate('./..'))}>
Expand Down Expand Up @@ -251,7 +244,7 @@ const InfoFields = styled.div`

const Applicants = styled.ul`
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(248px, 392px));
min-width: 300px;
max-width: 1224px;
gap: 24px;
Expand All @@ -265,7 +258,6 @@ const Applicants = styled.ul`
// <li> μš”μ†Œλ₯Ό λ„£κΈ° μœ„ν•΄ μΆ”κ°€μ μœΌλ‘œ λ§Œλ“  λ ˆμ΄μ–΄
const ApplicantLi = styled.li`
display: flex;
justify-content: center;

& > * {
flex: 1;
Expand Down