import { useState } from 'react'; import { motion } from 'framer-motion'; import { Clock, MapPin, Users, ChevronLeft, ChevronRight } from 'lucide-react'; import { schedules } from '../../data/dummy'; function Schedule() { const [currentDate, setCurrentDate] = useState(new Date()); const [selectedDate, setSelectedDate] = useState(null); // 달력 관련 함수 const getDaysInMonth = (year, month) => new Date(year, month + 1, 0).getDate(); const getFirstDayOfMonth = (year, month) => new Date(year, month, 1).getDay(); const year = currentDate.getFullYear(); const month = currentDate.getMonth(); const daysInMonth = getDaysInMonth(year, month); const firstDay = getFirstDayOfMonth(year, month); const days = ['일', '월', '화', '수', '목', '금', '토']; const monthNames = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']; // 스케줄이 있는 날짜 목록 const scheduleDates = schedules.map(s => s.date); const hasSchedule = (day) => { const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`; return scheduleDates.includes(dateStr); }; const prevMonth = () => { setCurrentDate(new Date(year, month - 1, 1)); setSelectedDate(null); }; const nextMonth = () => { setCurrentDate(new Date(year, month + 1, 1)); setSelectedDate(null); }; const selectDate = (day) => { const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`; setSelectedDate(selectedDate === dateStr ? null : dateStr); }; // 필터링된 스케줄 const filteredSchedules = selectedDate ? schedules.filter(s => s.date === selectedDate) : schedules; const formatDate = (dateStr) => { const date = new Date(dateStr); const dayNames = ['일', '월', '화', '수', '목', '금', '토']; return { month: date.getMonth() + 1, day: date.getDate(), weekday: dayNames[date.getDay()], }; }; return (