Skip to content

Commit 0d85fdb

Browse files
committed
feat: MBTI 학번 입력 형식 검증 추가
1 parent db7147b commit 0d85fdb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/app/event/2026/MBTI/page.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ const TYPE_ICON_BY_KIND: Record<string, { sm: string; lg: string }> = {
176176
}
177177

178178
const TYPE_META = mbtiTypeMetaRaw as Record<string, MbtiTypeMeta>
179+
const STUDENT_ID_PATTERN = /^12\d{6}$/
179180

180181
const RESULTS: Record<string, ResultType> = {
181182
LPTI: {
@@ -860,7 +861,8 @@ export default function MbtiEventPage() {
860861

861862
const answeredCount = Object.keys(answers).length
862863
const isComplete = answeredCount === QUESTIONS.length
863-
const canStart = name.trim().length > 0 && studentId.trim().length > 0 && isPolicyAgreed
864+
const isStudentIdValid = STUDENT_ID_PATTERN.test(studentId.trim())
865+
const canStart = name.trim().length > 0 && isStudentIdValid && isPolicyAgreed
864866

865867
const result = useMemo(() => {
866868
const sharedType = sharedTypeRef.current
@@ -1127,6 +1129,11 @@ export default function MbtiEventPage() {
11271129
}
11281130
/>
11291131
</label>
1132+
{studentId.trim().length > 0 && !isStudentIdValid ? (
1133+
<p className="typo-m-c2 mt-2 pl-1 text-red">
1134+
※ 학번은 12로 시작하는 8자리 숫자로 입력해 주세요.
1135+
</p>
1136+
) : null}
11301137

11311138
<div className="mt-4 flex items-center justify-end gap-1">
11321139
<span className="text-base font-bold leading-6 text-red">*</span>

0 commit comments

Comments
 (0)