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

feat(shelter): 보호소앱의 봉사 모집 리스트 아이템 클릭 이벤트 msw 연결 및 기능 추가 #193

Merged
merged 16 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
465c868
fix(shelter): recruitDateText 컴포넌트의 오타 수정
kutta97 Nov 27, 2023
a5528e9
feat(shared): getDDay 함수가 number 를 return 하도록 수정
kutta97 Nov 27, 2023
200f8a9
fix(volunteer): volunteerRecruitItem 의volunteerDateDday prop 을 number…
kutta97 Nov 27, 2023
82a5533
feat(shared): optionMenu 의 MenuList minW 속성 추가
kutta97 Nov 27, 2023
22d2af9
feat(shelter): recruitItem 컴포넌트를 VolunteerRecruitItem 으로 리팩토링
kutta97 Nov 27, 2023
7479c9c
feat(shelter): volunteerRecruitItem prop 을 생성하는 유틸함수 추가
kutta97 Nov 27, 2023
6fc02bf
feat(shelter): 봉사자 모집 페이지에 VolunteerRecruitItem 컴포넌트 적용
kutta97 Nov 27, 2023
7cdef19
feat(shelter): 봉사자 검색 페이지에 VolunteerRecruitItem 컴포넌트 적용
kutta97 Nov 27, 2023
63b0067
fix(shelter): volunteerRecruitItem 에서 사용하지 않는 변수 제거
kutta97 Nov 27, 2023
1021923
feat(shelter): volunteerRecruitItem 컴포넌트에서 VolunteerRecruitItemButton…
kutta97 Nov 27, 2023
e6348c7
feat(shelter): 봉사모집 아이템 이벤트 핸들러를 useVolunteerRecruitItem hook 으로 공통화 …
kutta97 Nov 27, 2023
818536f
feat(shelter): 불필요한 컴포넌트 분리 제거
kutta97 Nov 27, 2023
3709b18
refactor(shelter): 코드 리팩토링
kutta97 Nov 27, 2023
3bc1d7f
feat(shelter): 봉사자 모집글 리스트 아이템 마감 또는 삭제 버튼 클릭 시, Modal 띄우는 기능 추가
kutta97 Nov 27, 2023
24e727d
feat(shelter): 봉사 모집글 마감 및 삭제 API msw 추가
kutta97 Nov 27, 2023
d5d010b
feat(shelter): useVolunteerRecruitItem hook 에 봉사 모집글 마감 및 삭제 기능 추가
kutta97 Nov 27, 2023
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
13 changes: 13 additions & 0 deletions apps/shelter/src/mocks/handlers/recruitment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@ export const handlers = [
await delay(1000);
return HttpResponse.json({ status: 204 });
}),
http.delete('/shelters/recruitments/:recruitmentId', async ({ request }) => {
console.log(request);
await delay(1000);
return HttpResponse.json({ status: 204 });
}),
http.patch(
'/shelters/recruitments/:recruitmentId/close',
async ({ request }) => {
console.log(request);
await delay(1000);
return HttpResponse.json({ status: 204 });
},
),
];
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default function RecruitDateText({
date,
time,
}: RecruitDateTextProps) {
return <Text fontSize="xs">{`${title} | ${date} ${time}`}</Text>;
return <Text fontSize="xs">{`${title} | ${date} · ${time}`}</Text>;
}
233 changes: 0 additions & 233 deletions apps/shelter/src/pages/volunteers/_components/RecruitItem.tsx

This file was deleted.

134 changes: 134 additions & 0 deletions apps/shelter/src/pages/volunteers/_components/VolunteerRecruitItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { Box, HStack, MenuItem, Text, VStack } from '@chakra-ui/react';
import ApplicantStatus from 'shared/components/ApplicantStatus';
import Label from 'shared/components/Label';
import LabelText from 'shared/components/LabelText';
import OptionMenu from 'shared/components/OptionMenu';

import VolunteerRecruitItemButton from '@/pages/volunteers/_components/VolunteerRecruitItemButton';

import RecruitDateText from './RecruitDateText';

type Recruitment = {
id: number;
title: string;
isRecruitmentClosed: boolean;
volunteerDate: string;
volunteerTime: string;
deadLineDate: string;
deadLineTime: string;
volunteerDateDday: number;
applicantCount: number;
recruitmentCapacity: number;
};

type RecruitItemProps = {
recruitment: Recruitment;
onClickItem: (id: number) => void;
onUpdateRecruitment: (id: number) => void;
onDeleteRecruitment: (id: number) => void;
onManageApplies: (id: number) => void;
onManageAttendances: (id: number) => void;
onCloseRecruitment: (id: number) => void;
};

export default function VolunteerRecruitItem({
recruitment,
onClickItem,
onUpdateRecruitment,
onDeleteRecruitment,
onManageApplies,
onManageAttendances,
onCloseRecruitment,
}: RecruitItemProps) {
const {
id,
title,
isRecruitmentClosed,
volunteerDate,
volunteerTime,
deadLineDate,
deadLineTime,
volunteerDateDday,
applicantCount,
recruitmentCapacity,
} = recruitment;

return (
<Box
py={3.5}
px={4}
pos="relative"
borderBottom="1px"
borderColor="gray.200"
>
<VStack spacing={18} align="stretch">
<VStack
spacing={2}
align="stretch"
position="relative"
onClick={() => onClickItem(id)}
>
{isRecruitmentClosed || volunteerDateDday < 0 ? (
<Label type="GRAY" labelTitle="마감완료" />
) : (
<LabelText
type="GREEN"
content={`D-${
volunteerDateDday === 0 ? 'Day' : volunteerDateDday
}`}
labelTitle="모집중"
/>
)}
<Text fontWeight="bold" lineHeight="base">
{title}
</Text>
<Box>
<RecruitDateText
title="봉사일시"
date={volunteerDate}
time={volunteerTime}
/>
<RecruitDateText
title="마감일시"
date={deadLineDate}
time={deadLineTime}
/>
</Box>
<Box pos="absolute" right={0} bottom={0}>
<ApplicantStatus
numerator={applicantCount}
denominator={recruitmentCapacity}
/>
</Box>
</VStack>
{isRecruitmentClosed ? (
<VolunteerRecruitItemButton
type="PRIMARY"
onClick={() => onManageAttendances(id)}
>
출석 관리
</VolunteerRecruitItemButton>
) : (
<HStack justifyContent="space-between" spacing={5}>
<VolunteerRecruitItemButton
type="SECONDARY"
onClick={() => onManageApplies(id)}
>
신청현황
</VolunteerRecruitItemButton>
<VolunteerRecruitItemButton
type="PRIMARY"
onClick={() => onCloseRecruitment(id)}
>
마감하기
</VolunteerRecruitItemButton>
</HStack>
)}
</VStack>
<OptionMenu pos="absolute" w={5} h={5} top={4} right={4}>
<MenuItem onClick={() => onUpdateRecruitment(id)}>수정하기</MenuItem>
<MenuItem onClick={() => onDeleteRecruitment(id)}>삭제하기</MenuItem>
</OptionMenu>
</Box>
);
}
Loading