Skip to content

Commit

Permalink
Merge pull request #59 from DDD-Community/develop
Browse files Browse the repository at this point in the history
3차 베포 - 에러 메세지 기반 토큰 재발급 로직 임시 제거, 중간알람 유효성 추가
  • Loading branch information
minh0518 authored May 29, 2024
2 parents d1e5b46 + 86fe621 commit 3da10cf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@
}
}
}

.alarmWaring {
color: $red-7;
margin-right: 10px;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use client';

import { ChangeEventHandler, Dispatch, SetStateAction, forwardRef } from 'react';

import Input from '@/app/_components/_elements/Input';
import { ChangeEventHandler, Dispatch, SetStateAction, forwardRef, useState } from 'react';

import { UploadDataType, ValidtaionType } from '@/types/service';

Expand All @@ -20,6 +18,7 @@ interface UploadTimerProps {

const UploadTimer = forwardRef<HTMLInputElement, UploadTimerProps>(
({ timeLimit, alertTime, setPresentationData, currentPageIndex, getValues }, ref) => {
const [warn, setWarn] = useState(false);
const onChange: ChangeEventHandler<HTMLInputElement> = (e) => {
let { name, value } = e.target;
let changeValue = Number(value);
Expand All @@ -41,12 +40,31 @@ const UploadTimer = forwardRef<HTMLInputElement, UploadTimerProps>(

if (name === 'alertTime_hour') {
if (changeValue > 12) changeValue = 12;
alertTimeShallow['hours'] = changeValue;
const alarmHour = changeValue;
const alarmMinute = alertTimeShallow['minutes'] ?? 0;
const limitHour = timeLimitShallow['hours'] ?? 0;
const limitMinute = timeLimitShallow['minutes'] ?? 0;
if (alarmHour * 60 + alarmMinute >= limitHour * 60 + limitMinute) {
setWarn(true);
} else {
setWarn(false);
alertTimeShallow['hours'] = changeValue;
}
}

if (name === 'alertTime_minute') {
if (changeValue > 59) changeValue = 59;
alertTimeShallow['minutes'] = changeValue;

const alarmHour = alertTimeShallow['hours'] ?? 0;
const alarmMinute = changeValue;
const limitHour = timeLimitShallow['hours'] ?? 0;
const limitMinute = timeLimitShallow['minutes'] ?? 0;
if (alarmHour * 60 + alarmMinute >= limitHour * 60 + limitMinute) {
setWarn(true);
} else {
setWarn(false);
alertTimeShallow['minutes'] = changeValue;
}
}

shallow.title = getValues('title');
Expand All @@ -64,39 +82,6 @@ const UploadTimer = forwardRef<HTMLInputElement, UploadTimerProps>(
slides: shallowSlides,
};
});
// setPresentationData((prev) => {
// let { name, value } = e.target;
// let changeValue = Number(value);

// const timeLimitShallow = { ...prev.timeLimit };
// const alertTimeShallow = { ...prev.alertTime };

// if (name === 'timeLimit_hour') {
// if (changeValue > 12) changeValue = 12;
// timeLimitShallow['hours'] = changeValue;
// }

// if (name === 'timeLimit_minute') {
// if (changeValue > 59) changeValue = 59;
// timeLimitShallow['minutes'] = changeValue;
// }

// if (name === 'alertTime_hour') {
// if (changeValue > 12) changeValue = 12;
// alertTimeShallow['hours'] = changeValue;
// }

// if (name === 'alertTime_minute') {
// if (changeValue > 59) changeValue = 59;
// alertTimeShallow['minutes'] = changeValue;
// }

// return {
// ...prev,
// timeLimit: timeLimitShallow,
// alertTime: alertTimeShallow,
// };
// });
};

return (
Expand Down Expand Up @@ -136,6 +121,9 @@ const UploadTimer = forwardRef<HTMLInputElement, UploadTimerProps>(
</label>

<div className={styles.timerInput}>
{warn && (
<p className={styles.alarmWaring}>알림 시간은 총 발표 시간보다 작아야 합니다.</p>
)}
<input
type="number"
id="alarm"
Expand Down
8 changes: 5 additions & 3 deletions src/app/(afterlogin)/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ export default function Error({
// 미들웨어 기반 리다이렉션
window.location.href = fullUrl;
};
if (error.message === 'reIssue') reIssue();
// if (error.message === 'reIssue') reIssue();
reIssue();
}, [error]);

return (
<>
{error.message === 'reIssue' ? (
{/* {error.message === 'reIssue' ? (
<Spinner />
) : (
<div>
Expand All @@ -48,7 +49,8 @@ export default function Error({
Try again
</button>
</div>
)}
)} */}
<Spinner />
</>
);
}

0 comments on commit 3da10cf

Please sign in to comment.