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

[HOTFIX] develop 충돌 해결 과정에서의 timeBlockId 삭제 에러 해결 #231

Merged
merged 1 commit into from
Jul 19, 2024
Merged
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
18 changes: 15 additions & 3 deletions src/components/common/fullCalendar/FullCalendarBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function FullCalendarBox({ size, selectDate, selectedTarget }: FullCalendarBoxPr
const [isModalOpen, setModalOpen] = useState(false);
const [top, setTop] = useState(0);
const [left, setLeft] = useState(0);
const [modalTaskId, setModalTaskId] = useState<number | null>(null);
const [modalTimeBlockId, setModalTimeBlockId] = useState<number | null>(null);

const calendarRef = useRef<FullCalendar>(null);

Expand Down Expand Up @@ -90,11 +92,20 @@ function FullCalendarBox({ size, selectDate, selectedTarget }: FullCalendarBoxPr
const adjustedTop = Math.min(calculatedTop, MODAL.SCREEN_HEIGHT - MODAL.TASK_MODAL_HEIGHT);
setTop(adjustedTop);
setLeft(rect.left - MODAL.TASK_MODAL_WIDTH + 40);
setModalOpen(true);

const clickedEvent = info.event.extendedProps;

if (clickedEvent) {
setModalTaskId(clickedEvent.taskId);
setModalTimeBlockId(clickedEvent.timeBlockId);
setModalOpen(true);
}
};

const closeModal = () => {
setModalOpen(false);
setModalTaskId(null);
setModalTimeBlockId(null);
};

const addEventWhenDragged = (selectInfo: DateSelectArg) => {
Expand Down Expand Up @@ -217,14 +228,15 @@ function FullCalendarBox({ size, selectDate, selectedTarget }: FullCalendarBoxPr
eventDrop={updateEvent} // 기존 이벤트 드래그 수정 핸들러
eventResize={updateEvent} // 기존 이벤트 리사이즈 수정 핸들러
/>
{isModalOpen && (
{isModalOpen && modalTaskId !== null && modalTimeBlockId !== null && (
<Modal
isOpen={isModalOpen}
sizeType={{ type: 'short' }}
top={top}
left={left}
onClose={closeModal}
taskId={5} // 예시 taskId, 실제 데이터로 교체 필요
taskId={modalTaskId}
timeBlockId={modalTimeBlockId}
/>
)}
</FullCalendarLayout>
Expand Down
Loading