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

[시간표] 시간표 이미지 저장 에러 수정 #591

Merged
merged 1 commit into from
Nov 25, 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
38 changes: 26 additions & 12 deletions src/pages/TimetablePage/components/MainTimetable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,37 @@ function MainTimetable({ frameId }: { frameId: number }) {
const { data: deptList } = useDeptList();
const { data: mySemester } = useSemesterCheck(token);

const isSemesterAndTimetableExist = () => {
if (mySemester?.semesters.length === 0) {
toast.error('학기가 존재하지 않습니다. 학기를 추가해주세요.');
return false;
}

if (timeTableFrameList.length === 0) {
toast.error('시간표가 존재하지 않습니다. 시간표를 추가해주세요.');
return false;
}

return true;
};

const onClickDownloadImage = (e: React.MouseEvent<HTMLButtonElement>) => {
e.stopPropagation();
logger.actionEventClick({
actionTitle: 'USER',
title: 'timetable',
value: '이미지저장',
duration_time: (new Date().getTime() - Number(sessionStorage.getItem('enterTimetablePage'))) / 1000,
});
openModal();

if (isSemesterAndTimetableExist()) {
logger.actionEventClick({
actionTitle: 'USER',
title: 'timetable',
value: '이미지저장',
duration_time:
(new Date().getTime() - Number(sessionStorage.getItem('enterTimetablePage'))) / 1000,
});
openModal();
}
};

const onClickEdit = () => {
if (mySemester?.semesters.length === 0) {
toast('학기가 존재하지 않습니다. 학기를 추가해주세요.');
} else if (timeTableFrameList.length === 0) {
toast('시간표가 존재하지 않습니다. 시간표를 추가해주세요.');
} else {
if (isSemesterAndTimetableExist()) {
navigate(`/timetable/modify/regular/${token ? frameId : semester}`);
}
};
Expand Down
Loading