From 1a9fa549816a0502596e5f0169e20aed6ccb19bc Mon Sep 17 00:00:00 2001 From: caadiq Date: Mon, 19 Jan 2026 16:41:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=83=9D=EC=9D=BC=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8=ED=94=BD=EC=BB=A4=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 생일이 생년 이전 년도에 표시되는 버그 수정 - 페이지 진입 애니메이션 추가 (사전 관리, 일정 추가) - 데이트픽커 12년 단위 이동으로 변경 - 년도 선택 시 월 선택 화면 전환 제거 - 시작 년도 2025년 고정, 이전 이동 비활성화 - PC/모바일 일정 페이지, 관리자 페이지 모두 적용 Co-Authored-By: Claude Opus 4.5 --- backend/src/routes/schedules/index.js | 5 +++++ .../src/components/admin/CustomDatePicker.jsx | 12 +++++++----- frontend/src/pages/mobile/public/Schedule.jsx | 13 ++++++++----- frontend/src/pages/pc/admin/AdminSchedule.jsx | 18 ++++++++++-------- .../src/pages/pc/admin/AdminScheduleDict.jsx | 2 +- .../src/pages/pc/admin/schedule/form/index.jsx | 2 +- frontend/src/pages/pc/public/Schedule.jsx | 13 +++++++------ 7 files changed, 39 insertions(+), 26 deletions(-) diff --git a/backend/src/routes/schedules/index.js b/backend/src/routes/schedules/index.js index 7af35e1..36fa758 100644 --- a/backend/src/routes/schedules/index.js +++ b/backend/src/routes/schedules/index.js @@ -327,6 +327,11 @@ async function handleMonthlySchedules(db, year, month) { // 생일 일정 추가 for (const member of birthdays) { const birthDate = new Date(member.birth_date); + const birthYear = birthDate.getFullYear(); + + // 조회 연도가 생년보다 이전이면 스킵 + if (year < birthYear) continue; + const birthdayThisYear = new Date(year, birthDate.getMonth(), birthDate.getDate()); const dateKey = birthdayThisYear.toISOString().split('T')[0]; diff --git a/frontend/src/components/admin/CustomDatePicker.jsx b/frontend/src/components/admin/CustomDatePicker.jsx index 98abb0c..e4524b7 100644 --- a/frontend/src/components/admin/CustomDatePicker.jsx +++ b/frontend/src/components/admin/CustomDatePicker.jsx @@ -40,13 +40,15 @@ function CustomDatePicker({ value, onChange, placeholder = '날짜 선택', show days.push(i); } - const startYear = Math.floor(year / 10) * 10 - 1; + const MIN_YEAR = 2025; + const startYear = Math.max(MIN_YEAR, Math.floor(year / 12) * 12 - 1); const years = Array.from({ length: 12 }, (_, i) => startYear + i); + const canGoPrevYearRange = startYear > MIN_YEAR; const prevMonth = () => setViewDate(new Date(year, month - 1, 1)); const nextMonth = () => setViewDate(new Date(year, month + 1, 1)); - const prevYearRange = () => setViewDate(new Date(year - 10, month, 1)); - const nextYearRange = () => setViewDate(new Date(year + 10, month, 1)); + const prevYearRange = () => canGoPrevYearRange && setViewDate(new Date(Math.max(MIN_YEAR, year - 12), month, 1)); + const nextYearRange = () => setViewDate(new Date(year + 12, month, 1)); const selectDate = (day) => { const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`; @@ -57,7 +59,6 @@ function CustomDatePicker({ value, onChange, placeholder = '날짜 선택', show const selectYear = (y) => { setViewDate(new Date(y, month, 1)); - setViewMode('months'); }; const selectMonth = (m) => { @@ -124,7 +125,8 @@ function CustomDatePicker({ value, onChange, placeholder = '날짜 선택', show diff --git a/frontend/src/pages/mobile/public/Schedule.jsx b/frontend/src/pages/mobile/public/Schedule.jsx index fc55c09..09e9d3c 100644 --- a/frontend/src/pages/mobile/public/Schedule.jsx +++ b/frontend/src/pages/mobile/public/Schedule.jsx @@ -1239,8 +1239,10 @@ function CalendarPicker({ } }; - const [yearRangeStart, setYearRangeStart] = useState(Math.floor(year / 12) * 12); + const MIN_YEAR = 2025; + const [yearRangeStart, setYearRangeStart] = useState(MIN_YEAR); const yearRange = Array.from({ length: 12 }, (_, i) => yearRangeStart + i); + const canGoPrevYearRange = yearRangeStart > MIN_YEAR; // 배경 스크롤 막기 useEffect(() => { @@ -1364,16 +1366,17 @@ function CalendarPicker({ > {/* 년도 범위 헤더 */}
- {yearRangeStart} - {yearRangeStart + 11} - diff --git a/frontend/src/pages/pc/admin/AdminScheduleDict.jsx b/frontend/src/pages/pc/admin/AdminScheduleDict.jsx index 5338ea9..19e9242 100644 --- a/frontend/src/pages/pc/admin/AdminScheduleDict.jsx +++ b/frontend/src/pages/pc/admin/AdminScheduleDict.jsx @@ -613,7 +613,7 @@ function AdminScheduleDict() { ) : (
- + diff --git a/frontend/src/pages/pc/admin/schedule/form/index.jsx b/frontend/src/pages/pc/admin/schedule/form/index.jsx index 133fa5f..07bd1b4 100644 --- a/frontend/src/pages/pc/admin/schedule/form/index.jsx +++ b/frontend/src/pages/pc/admin/schedule/form/index.jsx @@ -34,7 +34,7 @@ const formVariants = { visible: { opacity: 1, y: 0, - transition: { duration: 0.3, ease: "easeOut" }, + transition: { duration: 0.3, ease: "easeOut", delay: 0.3 }, }, exit: { opacity: 0, diff --git a/frontend/src/pages/pc/public/Schedule.jsx b/frontend/src/pages/pc/public/Schedule.jsx index 3247360..30ccfa4 100644 --- a/frontend/src/pages/pc/public/Schedule.jsx +++ b/frontend/src/pages/pc/public/Schedule.jsx @@ -431,7 +431,6 @@ function Schedule() { const selectYear = (newYear) => { setCurrentDate(new Date(newYear, month, 1)); - setViewMode('months'); }; const selectMonth = (newMonth) => { @@ -568,12 +567,14 @@ function Schedule() { return year === now.getFullYear() && m === now.getMonth(); }; - // 연도 선택 범위 - const [yearRangeStart, setYearRangeStart] = useState(currentYear - 1); + // 연도 선택 범위 (2025년부터 시작) + const MIN_YEAR = 2025; + const [yearRangeStart, setYearRangeStart] = useState(MIN_YEAR); const yearRange = Array.from({ length: 12 }, (_, i) => yearRangeStart + i); const monthNames = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']; - const prevYearRange = () => setYearRangeStart(prev => prev - 3); - const nextYearRange = () => setYearRangeStart(prev => prev + 3); + const canGoPrevYearRange = yearRangeStart > MIN_YEAR; + const prevYearRange = () => canGoPrevYearRange && setYearRangeStart(prev => Math.max(MIN_YEAR, prev - 12)); + const nextYearRange = () => setYearRangeStart(prev => prev + 12); // 선택된 카테고리 이름 const getSelectedCategoryNames = () => { @@ -680,7 +681,7 @@ function Schedule() { className="absolute top-20 left-8 right-8 mx-auto w-80 bg-white rounded-xl shadow-lg border border-gray-200 p-4 z-10" >
-
# 단어