@@ -134,11 +134,13 @@ function App() {
134134 description,
135135 location,
136136 category,
137- repeat : {
138- type : isRepeating ? repeatType : 'none' ,
139- interval : repeatInterval ,
140- endDate : repeatEndDate || undefined ,
141- } ,
137+ repeat : editingEvent
138+ ? { type : 'none' , interval : 0 , endDate : undefined }
139+ : {
140+ type : isRepeating ? repeatType : 'none' ,
141+ interval : repeatInterval ,
142+ endDate : repeatEndDate || undefined ,
143+ } ,
142144 notificationTime,
143145 } ;
144146
@@ -420,84 +422,87 @@ function App() {
420422 ) ) }
421423 </ Select >
422424 </ FormControl >
423-
424- < FormControl >
425- < FormControlLabel
426- control = {
427- < Checkbox
428- checked = { isRepeating }
429- onChange = { ( e ) => setIsRepeating ( e . target . checked ) }
425+ { ! editingEvent && (
426+ < >
427+ < FormControl >
428+ < FormControlLabel
429+ control = {
430+ < Checkbox
431+ checked = { isRepeating }
432+ onChange = { ( e ) => setIsRepeating ( e . target . checked ) }
433+ />
434+ }
435+ label = "반복 일정"
430436 />
431- }
432- label = "반복 일정"
433- />
434- </ FormControl >
435-
436- < FormControl fullWidth >
437- < FormLabel htmlFor = "notification" > 알림 설정</ FormLabel >
438- < Select
439- id = "notification"
440- size = "small"
441- value = { notificationTime }
442- onChange = { ( e ) => setNotificationTime ( Number ( e . target . value ) ) }
443- >
444- { notificationOptions . map ( ( option ) => (
445- < MenuItem key = { option . value } value = { option . value } >
446- { option . label }
447- </ MenuItem >
448- ) ) }
449- </ Select >
450- </ FormControl >
437+ </ FormControl >
451438
452- { /* ! 반복은 8주차 과제에 포함됩니다. 구현하고 싶어도 참아주세요~ */ }
453- { isRepeating && (
454- < Stack spacing = { 2 } >
455439 < FormControl fullWidth >
456- < FormLabel id = "repeat-type-label" > 반복 유형 </ FormLabel >
440+ < FormLabel htmlFor = "notification" > 알림 설정 </ FormLabel >
457441 < Select
442+ id = "notification"
458443 size = "small"
459- value = { repeatType }
460- onChange = { ( e ) => setRepeatType ( ( e . target . value as RepeatType ) || '' ) }
461- aria-labelledby = "repeat-type-label"
462- aria-label = "반복 유형"
444+ value = { notificationTime }
445+ onChange = { ( e ) => setNotificationTime ( Number ( e . target . value ) ) }
463446 >
464- < MenuItem value = "daily" aria-label = "daily-option" >
465- 매일
466- </ MenuItem >
467- < MenuItem value = "weekly" aria-label = "weekly-option" >
468- 매주
469- </ MenuItem >
470- < MenuItem value = "monthly" aria-label = "monthly-option" >
471- 매월
472- </ MenuItem >
473- < MenuItem value = "yearly" aria-label = "yearly-option" >
474- 매년
475- </ MenuItem >
447+ { notificationOptions . map ( ( option ) => (
448+ < MenuItem key = { option . value } value = { option . value } >
449+ { option . label }
450+ </ MenuItem >
451+ ) ) }
476452 </ Select >
477453 </ FormControl >
478- < Stack direction = "row" spacing = { 2 } >
479- < FormControl fullWidth >
480- < FormLabel > 반복 간격</ FormLabel >
481- < TextField
482- size = "small"
483- type = "number"
484- value = { repeatInterval }
485- onChange = { ( e ) => setRepeatInterval ( Number ( e . target . value ) ) }
486- slotProps = { { htmlInput : { min : 1 } } }
487- />
488- </ FormControl >
489- < FormControl fullWidth >
490- < FormLabel htmlFor = "repeat-end-date" > 반복 종료일</ FormLabel >
491- < TextField
492- id = "repeat-end-date"
493- size = "small"
494- type = "date"
495- value = { repeatEndDate }
496- onChange = { ( e ) => setRepeatEndDate ( e . target . value ) }
497- />
498- </ FormControl >
499- </ Stack >
500- </ Stack >
454+
455+ { /* ! 반복은 8주차 과제에 포함됩니다. 구현하고 싶어도 참아주세요~ */ }
456+ { isRepeating && (
457+ < Stack spacing = { 2 } >
458+ < FormControl fullWidth >
459+ < FormLabel id = "repeat-type-label" > 반복 유형</ FormLabel >
460+ < Select
461+ size = "small"
462+ value = { repeatType }
463+ onChange = { ( e ) => setRepeatType ( ( e . target . value as RepeatType ) || '' ) }
464+ aria-labelledby = "repeat-type-label"
465+ aria-label = "반복 유형"
466+ >
467+ < MenuItem value = "daily" aria-label = "daily-option" >
468+ 매일
469+ </ MenuItem >
470+ < MenuItem value = "weekly" aria-label = "weekly-option" >
471+ 매주
472+ </ MenuItem >
473+ < MenuItem value = "monthly" aria-label = "monthly-option" >
474+ 매월
475+ </ MenuItem >
476+ < MenuItem value = "yearly" aria-label = "yearly-option" >
477+ 매년
478+ </ MenuItem >
479+ </ Select >
480+ </ FormControl >
481+ < Stack direction = "row" spacing = { 2 } >
482+ < FormControl fullWidth >
483+ < FormLabel > 반복 간격</ FormLabel >
484+ < TextField
485+ size = "small"
486+ type = "number"
487+ value = { repeatInterval }
488+ onChange = { ( e ) => setRepeatInterval ( Number ( e . target . value ) ) }
489+ slotProps = { { htmlInput : { min : 1 } } }
490+ />
491+ </ FormControl >
492+ < FormControl fullWidth >
493+ < FormLabel htmlFor = "repeat-end-date" > 반복 종료일</ FormLabel >
494+ < TextField
495+ id = "repeat-end-date"
496+ size = "small"
497+ type = "date"
498+ value = { repeatEndDate }
499+ onChange = { ( e ) => setRepeatEndDate ( e . target . value ) }
500+ />
501+ </ FormControl >
502+ </ Stack >
503+ </ Stack >
504+ ) }
505+ </ >
501506 ) }
502507
503508 < Button
0 commit comments