Skip to content

Commit

Permalink
feat: 모임 삭제 dialog mds 마이그레이션 (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-nary authored Oct 20, 2024
1 parent 34e9643 commit 17708c4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 49 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@sopt-makers/fonts": "^2.0.1",
"@sopt-makers/icons": "^1.0.5",
"@sopt-makers/playground-common": "^1.5.2",
"@sopt-makers/ui": "^2.4.2",
"@sopt-makers/ui": "^2.4.4",
"@stitches/react": "^1.2.8",
"@tanstack/react-query": "^4.10.3",
"@types/autosize": "^4.0.3",
Expand Down

This file was deleted.

45 changes: 24 additions & 21 deletions src/components/page/meetingDetail/MeetingController/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import dayjs from 'dayjs';
import { playgroundLink } from '@sopt-makers/playground-common';
import useModal from '@hooks/useModal';
import DefaultModal from '@components/modal/DefaultModal';
import HostConfirmModal from './Modal/Confirm/HostConfirmModal';
import ProfileConfirmModal from './Modal/Confirm/ProfileConfirmModal';
import GuestConfirmModal from './Modal/Confirm/GuestConfirmModal';
import ApplicationModalContent from './Modal/Content/ApplicationModalContent';
Expand Down Expand Up @@ -93,11 +92,6 @@ const MeetingController = ({
const meetingId = router.query.id;
const isRecruiting = status === ERecruitmentStatus.RECRUITING;

const {
isModalOpened: isHostModalOpened,
handleModalOpen: handleHostModalOpen,
handleModalClose: handleHostModalClose,
} = useModal();
const {
isModalOpened: isGuestModalOpened,
handleModalOpen: handleGuestModalOpen,
Expand All @@ -122,6 +116,30 @@ const MeetingController = ({
setModalTitle(`모집 현황 (${approvedApplyCount}/${capacity}명)`);
};

const handleHostModalOpen = () => {
const dialogOption: DialogOptionType = {
title: '모임을 삭제하시겠습니까?',
description: '삭제한 모임은 되돌릴 수 없어요',
type: 'default',
typeOptions: {
cancelButtonText: '취소',
approveButtonText: '삭제하기',
buttonFunction: handleDeleteMeeting,
},
};
dialogOpen(dialogOption);
};

const handleDeleteMeeting = () => {
queryClient.invalidateQueries({ queryKey: ['fetchMeetingList'] });
mutateMeetingDeletion(Number(meetingId), {
onSuccess: () => {
dialogClose();
router.push('/');
},
});
};

const handleApplicationModal = () => {
if (!me?.hasActivities) {
handleProfileModalOpen();
Expand Down Expand Up @@ -209,16 +227,6 @@ const MeetingController = ({
});
};

const handleDeleteMeeting = () => {
queryClient.invalidateQueries({ queryKey: ['fetchMeetingList'] });
mutateMeetingDeletion(Number(meetingId), {
onSuccess: () => {
router.push('/');
},
});
handleHostModalClose();
};

return (
<>
<SPanelWrapper>
Expand Down Expand Up @@ -272,11 +280,6 @@ const MeetingController = ({
)}
</div>
</SPanelWrapper>
<HostConfirmModal
isModalOpened={isHostModalOpened}
handleModalClose={handleHostModalClose}
handleConfirm={handleDeleteMeeting}
/>
<ProfileConfirmModal
isModalOpened={isProfileModalOpened}
handleModalClose={handleProfileModalClose}
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6781,9 +6781,9 @@ __metadata:
languageName: node
linkType: hard

"@sopt-makers/ui@npm:^2.4.2":
version: 2.4.2
resolution: "@sopt-makers/ui@npm:2.4.2"
"@sopt-makers/ui@npm:^2.4.4":
version: 2.4.4
resolution: "@sopt-makers/ui@npm:2.4.4"
dependencies:
"@radix-ui/react-dialog": "npm:^1.0.5"
"@radix-ui/react-switch": "npm:^1.0.3"
Expand All @@ -6796,7 +6796,7 @@ __metadata:
peerDependencies:
react: ^18.2.0
react-dom: ^18.2.0
checksum: 10c0/05921a1b83e3ee5828627724e42b9eb98c6f07ce65e9be436cd2cbf0e60990a19495dd249b6c4b75a02d888916d3e55ac50a16b2c28361d1a71fbb8d5b09910a
checksum: 10c0/bb5fa03a300a674b564459393cdef9e5a9bd07bd99521f710a2cbcabe870794bfb9f9348d060edf2304a118e75248d3b5ec3294898778028c56e25ce47fe3907
languageName: node
linkType: hard

Expand Down Expand Up @@ -20703,7 +20703,7 @@ __metadata:
"@sopt-makers/fonts": "npm:^2.0.1"
"@sopt-makers/icons": "npm:^1.0.5"
"@sopt-makers/playground-common": "npm:^1.5.2"
"@sopt-makers/ui": "npm:^2.4.2"
"@sopt-makers/ui": "npm:^2.4.4"
"@stitches/react": "npm:^1.2.8"
"@storybook/addon-essentials": "npm:^8.1.11"
"@storybook/addon-interactions": "npm:^8.1.11"
Expand Down

0 comments on commit 17708c4

Please sign in to comment.