diff --git a/src/page/TableComposition/components/TimerCreationContent/TimerCreationContent.tsx b/src/page/TableComposition/components/TimerCreationContent/TimerCreationContent.tsx index 2a2363a7..1557f2b1 100644 --- a/src/page/TableComposition/components/TimerCreationContent/TimerCreationContent.tsx +++ b/src/page/TableComposition/components/TimerCreationContent/TimerCreationContent.tsx @@ -95,6 +95,7 @@ interface BellInputConfig { count: number; } +const MAX_SPEAKER_LEN = 5; export default function TimerCreationContent({ beforeData, initData, @@ -307,14 +308,15 @@ export default function TimerCreationContent({ // SpeechType에 맞게 문자열 매핑 let speechTypeToSend: string; let stanceToSend: Stance; + if (speaker.trim().length > MAX_SPEAKER_LEN) { + errors.push(`발언자는 최대 ${MAX_SPEAKER_LEN}자까지 입력할 수 있습니다.`); + } + if (currentSpeechType === 'CUSTOM') { // 텍스트 길이 유효성 검사 if (speechTypeTextValue.length > 10) { errors.push('발언 유형은 최대 10자까지 입력할 수 있습니다.'); } - if (speaker.length > 5) { - errors.push('발언자는 최대 5자까지 입력할 수 있습니다.'); - } // 발언시간 유효성 검사 if ( @@ -596,9 +598,12 @@ export default function TimerCreationContent({ setSpeaker(e.target.value)} + onChange={(e) => + setSpeaker(e.target.value.slice(0, MAX_SPEAKER_LEN)) + } onClear={() => setSpeaker('')} - placeholder="N번 토론자" + maxLength={MAX_SPEAKER_LEN} + placeholder="N번" disabled={ stance === 'NEUTRAL' || currentSpeechType === 'TIMEOUT' }