/** * 일정 아이템 컴포넌트 * - 일정 목록에서 사용되는 개별 아이템 * - 일반 모드와 검색 모드에서 공통 사용 */ import { memo } from 'react'; import { motion } from 'framer-motion'; import { Edit2, Trash2, ExternalLink, Clock, Tag, Link2 } from 'lucide-react'; import { decodeHtmlEntities } from '@/utils'; import { getMemberList, getScheduleDate, getScheduleTime, getCategoryInfo, } from '@/utils/schedule'; /** * 카테고리별 수정 경로 반환 */ export const getEditPath = (scheduleId, categoryName) => { switch (categoryName) { case '유튜브': return `/admin/schedule/${scheduleId}/edit/youtube`; case 'X': return `/admin/schedule/${scheduleId}/edit/x`; default: return `/admin/schedule/${scheduleId}/edit`; } }; /** * 일정 아이템 컴포넌트 - React.memo로 불필요한 리렌더링 방지 * @param {Object} props * @param {Object} props.schedule - 일정 데이터 * @param {number} props.index - 목록 인덱스 (애니메이션 지연용) * @param {string} props.selectedDate - 선택된 날짜 * @param {Function} props.getColorStyle - 색상 스타일 함수 * @param {Function} props.navigate - 네비게이션 함수 * @param {Function} props.openDeleteDialog - 삭제 다이얼로그 열기 함수 * @param {boolean} props.showYear - 연도 표시 여부 (검색 모드용) * @param {boolean} props.animated - 애니메이션 적용 여부 (기본: true) * @param {string} props.className - 추가 클래스명 */ const ScheduleItem = memo(function ScheduleItem({ schedule, index = 0, selectedDate, getColorStyle, navigate, openDeleteDialog, showYear = false, animated = true, className = '', }) { const scheduleDate = new Date(getScheduleDate(schedule)); const isBirthday = schedule.is_birthday || String(schedule.id).startsWith('birthday-'); const categoryInfo = getCategoryInfo(schedule); const categoryColor = getColorStyle(categoryInfo.color)?.style?.backgroundColor || categoryInfo.color || '#6b7280'; const memberList = getMemberList(schedule); const timeStr = getScheduleTime(schedule); const content = (