File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -716,15 +716,15 @@ const DashboardPage: React.FC = () => {
716716 ) ) }
717717 </ div >
718718 < div className = "grid grid-cols-7 gap-1" >
719- { calendarDays . map ( ( day ) => {
719+ { calendarDays . map ( ( day , index ) => {
720720 const dayEvents = getEventsForDate ( day ) ;
721721 const isCurrentMonth = isSameMonth ( day , calendarDate ) ;
722722 const isDayToday = isToday ( day ) ;
723723 const isSelected = isSameDay ( day , selectedDate ) ;
724724
725725 return (
726726 < motion . button
727- key = { day . toString ( ) }
727+ key = { ` ${ day . getTime ( ) } - ${ index } ` }
728728 className = { `
729729 text-xs p-1 rounded transition-colors relative
730730 ${ isCurrentMonth ? "text-gray-800" : "text-gray-300" }
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ export const useCalendar = (options: UseCalendarOptions = {}): UseCalendarReturn
329329 const targetDate = new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) ) ;
330330 const targetDateString = targetDate . toISOString ( ) . split ( 'T' ) [ 0 ] ; // YYYY-MM-DD 형식
331331
332- return events . filter ( event => {
332+ const filteredEvents = events . filter ( event => {
333333
334334 const eventStartDate = event . date instanceof Date ? new Date ( event . date ) : new Date ( event . date ) ;
335335 const eventStart = new Date ( eventStartDate . getFullYear ( ) , eventStartDate . getMonth ( ) , eventStartDate . getDate ( ) ) ;
@@ -408,6 +408,25 @@ export const useCalendar = (options: UseCalendarOptions = {}): UseCalendarReturn
408408
409409 return patternMatch ;
410410 } ) ;
411+
412+ // 중복 제거: 같은 제목, 시간, 카테고리를 가진 이벤트들을 하나로 합치기
413+ const uniqueEvents = filteredEvents . reduce ( ( acc : Event [ ] , current : Event ) => {
414+ const duplicate = acc . find ( event =>
415+ event . title === current . title &&
416+ event . startTime === current . startTime &&
417+ event . endTime === current . endTime &&
418+ event . category === current . category &&
419+ event . isAllDay === current . isAllDay
420+ ) ;
421+
422+ if ( ! duplicate ) {
423+ acc . push ( current ) ;
424+ }
425+
426+ return acc ;
427+ } , [ ] ) ;
428+
429+ return uniqueEvents ;
411430 } , [ events ] ) ;
412431
413432 // 자동 로드 - groupId, currentDate, currentView 변경 시 실행
You can’t perform that action at this time.
0 commit comments