import { useParams, Link } from 'react-router-dom'; import { useQuery, keepPreviousData } from '@tanstack/react-query'; import { motion } from 'framer-motion'; import { Calendar, ChevronRight } from 'lucide-react'; import { getSchedule } from '../../../api/public/schedules'; // 분리된 카테고리별 섹션 컴포넌트들 import { YoutubeSection, XSection, DefaultSection, CATEGORY_ID, decodeHtmlEntities, } from './schedule-sections'; function ScheduleDetail() { const { id } = useParams(); const { data: schedule, isLoading, error } = useQuery({ queryKey: ['schedule', id], queryFn: () => getSchedule(id), placeholderData: keepPreviousData, retry: false, // 404 등 에러 시 재시도하지 않음 }); if (isLoading) { return (
); } if (error || !schedule) { return (
{/* 아이콘 */}
{/* 메시지 */}

일정을 찾을 수 없습니다

요청하신 일정이 존재하지 않거나 삭제되었을 수 있습니다.
다른 일정을 확인해 주세요.

{/* 장식 요소 */} {[...Array(5)].map((_, i) => ( ))} {/* 버튼들 */} 일정 목록
); } // 카테고리별 섹션 렌더링 const categoryId = schedule.category?.id; const renderCategorySection = () => { switch (categoryId) { case CATEGORY_ID.YOUTUBE: return ; case CATEGORY_ID.X: return ; default: return ; } }; const isYoutube = categoryId === CATEGORY_ID.YOUTUBE; const isX = categoryId === CATEGORY_ID.X; const hasCustomLayout = isYoutube || isX; return (
{/* 브레드크럼 네비게이션 */} 일정 {schedule.category?.name} {decodeHtmlEntities(schedule.title)} {/* 메인 컨텐츠 */} {renderCategorySection()}
); } export default ScheduleDetail;