From a7018810a2cdd5e36fc3258b0a17ba0d2f4d7337 Mon Sep 17 00:00:00 2001 From: kimheeseok Date: Fri, 1 Dec 2023 15:43:14 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=EC=8A=A4=EC=BC=80=EC=A4=84=20?= =?UTF-8?q?=EB=B0=95=EC=8A=A4=20=EC=97=90=EB=94=94=ED=8A=B8,=EB=94=9C?= =?UTF-8?q?=EB=A6=AC=ED=8A=B8=20=EB=B2=84=ED=8A=BC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/scheduleModal/ScheduleModal.tsx | 31 ++++--------------- src/pages/schedule/Schedule.tsx | 21 ------------- src/pages/schedule/scheduleType.ts | 9 +----- 3 files changed, 7 insertions(+), 54 deletions(-) diff --git a/src/components/schedule/scheduleModal/ScheduleModal.tsx b/src/components/schedule/scheduleModal/ScheduleModal.tsx index 59d25c18..f9dc605f 100644 --- a/src/components/schedule/scheduleModal/ScheduleModal.tsx +++ b/src/components/schedule/scheduleModal/ScheduleModal.tsx @@ -1,39 +1,20 @@ import { useNavigate } from 'react-router-dom' -import { useMutation } from '@tanstack/react-query' import Profile from '@/components/common/profile/Profile.tsx' -import { queryClient } from '@/libs/api/queryClient.ts' -import { deleteSchedule } from '@/libs/api/schedule/scheduleApi.ts' import { OverlappingScheduleType } from '@/libs/api/schedule/scheduleType.ts' -import { ScheduleModalProps } from '@/pages/schedule/scheduleType.ts' +import { HandlerScheduleProps } from '@/pages/schedule/scheduleType.ts' const ScheduleModal = ({ childSchedule, mainTitle, - modalType, date, - lessonId, - close -}: ScheduleModalProps) => { + lessonId +}: HandlerScheduleProps) => { const navigate = useNavigate() - const { mutate } = useMutation({ - mutationFn: (scheduleId: number) => - deleteSchedule({ scheduleId: scheduleId }), - onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['scheduleId'] }) - close() - } - }) const selectChild = (childInfo: OverlappingScheduleType) => { - if (modalType === 'edit') { - navigate(`/schedule/${childInfo.scheduleId}/edit`) - } else if (modalType === 'delete') { - mutate(childInfo.scheduleId) - } else { - navigate( - `/schedule/detail?date=${date}&scheduleId=${childInfo.scheduleId}&lessonId=${lessonId}&child=${childInfo.childId}` - ) - } + navigate( + `/schedule/detail?date=${date}&scheduleId=${childInfo.scheduleId}&lessonId=${lessonId}&child=${childInfo.childId}` + ) } return ( diff --git a/src/pages/schedule/Schedule.tsx b/src/pages/schedule/Schedule.tsx index 0ba4e2a6..89cf6144 100644 --- a/src/pages/schedule/Schedule.tsx +++ b/src/pages/schedule/Schedule.tsx @@ -105,28 +105,9 @@ const Schedule = () => { className={'flex mb-[16px] justify-center items-center'}> - handlerScheduleProfileClick({ - childSchedule: schedule.overlappingSchedules, - modalType: 'edit', - mainTitle: '어떤 아이의 스케줄을 수정하시겠습니까?', - date: scheduleData.date, - lessonId: schedule.lessonId - }) - } - handleDelete={() => - handlerScheduleProfileClick({ - childSchedule: schedule.overlappingSchedules, - modalType: 'delete', - mainTitle: '어떤 아이의 스케줄을 삭제하시겠습니까?', - date: scheduleData.date, - lessonId: schedule.lessonId - }) - } handleDetail={() => handlerScheduleProfileClick({ childSchedule: schedule.overlappingSchedules, - modalType: 'detail', mainTitle: '어떤 아이의 스케줄 정보를 확인할까요?', date: scheduleData.date, lessonId: schedule.lessonId @@ -160,10 +141,8 @@ const Schedule = () => { diff --git a/src/pages/schedule/scheduleType.ts b/src/pages/schedule/scheduleType.ts index 67b68577..5aab6c4e 100644 --- a/src/pages/schedule/scheduleType.ts +++ b/src/pages/schedule/scheduleType.ts @@ -1,15 +1,8 @@ import { OverlappingScheduleType } from '@/libs/api/schedule/scheduleType.ts' -export interface ScheduleModalType { - modalType: 'delete' | 'edit' | 'detail' | '' -} -export interface HandlerScheduleProps extends ScheduleModalType { +export interface HandlerScheduleProps { childSchedule: OverlappingScheduleType[] mainTitle: string date: string lessonId: number | null } - -export interface ScheduleModalProps extends HandlerScheduleProps { - close: () => void -} From fa801b6df4b461531d65d11c4c3cfb2617f47fe8 Mon Sep 17 00:00:00 2001 From: kimheeseok Date: Fri, 1 Dec 2023 15:47:41 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EC=8A=A4=EC=BC=80=EC=A4=84=20?= =?UTF-8?q?=EB=B0=95=EC=8A=A4=20=EC=97=90=EB=94=94=ED=8A=B8,=20=EB=94=9C?= =?UTF-8?q?=EB=A6=AC=ED=8A=B8=20=EB=B2=84=ED=8A=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduleProfileBox/ScheduleProfileBox.tsx | 21 +------------------ .../ScheduleProfileBoxType.ts | 2 -- .../schedule/scheduleModal/ScheduleModal.tsx | 3 +-- src/pages/schedule/Schedule.tsx | 8 ------- src/pages/schedule/scheduleType.ts | 1 - 5 files changed, 2 insertions(+), 33 deletions(-) diff --git a/src/components/common/scheduleProfileBox/ScheduleProfileBox.tsx b/src/components/common/scheduleProfileBox/ScheduleProfileBox.tsx index 854d64c7..e012ac4f 100644 --- a/src/components/common/scheduleProfileBox/ScheduleProfileBox.tsx +++ b/src/components/common/scheduleProfileBox/ScheduleProfileBox.tsx @@ -4,8 +4,6 @@ import { ScheduleProfileBoxProps } from '@/components/common/scheduleProfileBox/ const ScheduleProfileBox = ({ mainTitle, subTitle, - handleEdit, - handleDelete, handleDetail, children }: ScheduleProfileBoxProps) => { @@ -14,9 +12,8 @@ const ScheduleProfileBox = ({ className={ 'flex flex-col w-[360px] h-[88px] shadow-md pt-[22px] pb-[20px] px-[24px] rounded-[20px] font-nsk cursor-pointer' } - onClick={(e) => { + onClick={() => { handleDetail() - e.stopPropagation() }}>
{mainTitle} -
-
{ - handleEdit() - e.stopPropagation() - }}> - -
-
{ - handleDelete() - e.stopPropagation() - }}> - -
-
diff --git a/src/components/common/scheduleProfileBox/ScheduleProfileBoxType.ts b/src/components/common/scheduleProfileBox/ScheduleProfileBoxType.ts index 9530779b..12d0906e 100644 --- a/src/components/common/scheduleProfileBox/ScheduleProfileBoxType.ts +++ b/src/components/common/scheduleProfileBox/ScheduleProfileBoxType.ts @@ -3,8 +3,6 @@ import { ReactNode } from 'react' export interface ScheduleProfileBoxProps { mainTitle: string subTitle: string - handleEdit: () => void - handleDelete: () => void handleDetail: () => void children?: ReactNode } diff --git a/src/components/schedule/scheduleModal/ScheduleModal.tsx b/src/components/schedule/scheduleModal/ScheduleModal.tsx index f9dc605f..b0653ccc 100644 --- a/src/components/schedule/scheduleModal/ScheduleModal.tsx +++ b/src/components/schedule/scheduleModal/ScheduleModal.tsx @@ -5,7 +5,6 @@ import { HandlerScheduleProps } from '@/pages/schedule/scheduleType.ts' const ScheduleModal = ({ childSchedule, - mainTitle, date, lessonId }: HandlerScheduleProps) => { @@ -26,7 +25,7 @@ const ScheduleModal = ({ className={ 'subHead-18 w-full h-[20%] mt-[26px] ml-[36px] text-left mb-[10px]' }> - {mainTitle} + {'어떤 아이의 스케줄 정보를 확인할까요?'}
{ }) const [modalState, setModalState] = useState({ childSchedule: [], - modalType: '', - mainTitle: '', date: '', lessonId: null }) @@ -57,15 +55,11 @@ const Schedule = () => { const handlerScheduleProfileClick = ({ childSchedule, - modalType, - mainTitle, date, lessonId }: HandlerScheduleProps) => { setModalState(() => ({ childSchedule: childSchedule, - modalType: modalType, - mainTitle: mainTitle, date: date, lessonId: lessonId })) @@ -108,7 +102,6 @@ const Schedule = () => { handleDetail={() => handlerScheduleProfileClick({ childSchedule: schedule.overlappingSchedules, - mainTitle: '어떤 아이의 스케줄 정보를 확인할까요?', date: scheduleData.date, lessonId: schedule.lessonId }) @@ -139,7 +132,6 @@ const Schedule = () => { />