Skip to content

Commit

Permalink
[Fix] 제출 기한 지나면 제출 못하도록 막기 (#387)
Browse files Browse the repository at this point in the history
* feat: 지원 시간 종료 시 지원서 제출 막는 모달창 생성

* fix: 지원 기간 지나면 지원서 버튼 눌러도 제출 안 되도록 수정

* fix: 모달 버튼 디자인 수정
  • Loading branch information
eonseok-jeon authored Aug 13, 2024
1 parent f6d6477 commit 6f311ba
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/views/ApplyPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useCheckBrowser from '@hooks/useCheckBrowser';
import useDate from '@hooks/useDate';
import useScrollToHash from '@hooks/useScrollToHash';
import { DraftDialog, SubmitDialog } from 'views/dialogs';
import PreventApplyDialog from 'views/dialogs/PreventApplyDialog';
import NoMore from 'views/ErrorPage/components/NoMore';
import BigLoading from 'views/loadings/BigLoding';

Expand Down Expand Up @@ -35,6 +36,7 @@ const ApplyPage = ({ onSetComplete }: ApplyPageProps) => {
useCheckBrowser(); // 크롬 브라우저 권장 알럿

const draftDialog = useRef<HTMLDialogElement>(null);
const preventApplyDialog = useRef<HTMLDialogElement>(null);
const submitDialog = useRef<HTMLDialogElement>(null);
const sectionsRef = useRef<HTMLSelectElement[]>([]);

Expand Down Expand Up @@ -187,6 +189,12 @@ const ApplyPage = ({ onSetComplete }: ApplyPageProps) => {
const commonQuestionIds = commonQuestions?.questions.map((question) => question.id);

const handleSendData = (type: 'draft' | 'submit') => {
if (NoMoreApply) {
preventApplyDialog.current?.showModal();

return;
}

const mostRecentSeason = mostRecentSeasonValue === '해당사항 없음' ? 0 : mostRecentSeasonValue;
const leaveAbsence =
getValues('leaveAbsence') == undefined ? undefined : getValues('leaveAbsence') === '재학' ? false : true;
Expand Down Expand Up @@ -269,6 +277,7 @@ const ApplyPage = ({ onSetComplete }: ApplyPageProps) => {
return (
<FormProvider {...methods}>
<DraftDialog ref={draftDialog} />
<PreventApplyDialog ref={preventApplyDialog} />
<SubmitDialog
userInfo={{
name,
Expand Down
24 changes: 24 additions & 0 deletions src/views/dialogs/PreventApplyDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { forwardRef, type KeyboardEvent } from 'react';

import Dialog from '@components/Dialog';

import { buttonInside, buttonOutside, buttonWrapper, mainText } from '../style.css';

const PreventApplyDialog = forwardRef<HTMLDialogElement>((_, ref) => {
const handlePreventESCKeyPress = (e: KeyboardEvent<HTMLDialogElement>) => {
if (e.key === 'Escape') e.preventDefault();
};

return (
<Dialog ref={ref} onKeyDown={handlePreventESCKeyPress}>
<p className={mainText}>지원서 제출 기한이 지났어요.</p>
<form method="dialog" className={`${buttonWrapper} ${buttonOutside.solid}`}>
<button className={buttonInside.solid}>확인</button>
</form>
</Dialog>
);
});

PreventApplyDialog.displayName = 'PreventApplyDialog';

export default PreventApplyDialog;

0 comments on commit 6f311ba

Please sign in to comment.