From c0ac18060ddd479fd167065f6ee94f8cf2eba5c3 Mon Sep 17 00:00:00 2001 From: caadiq Date: Mon, 1 Jun 2026 12:54:47 +0900 Subject: [PATCH] =?UTF-8?q?fix(admin-schedule):=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=ED=95=84=ED=84=B0=EB=A5=BC=20=EA=B3=B5?= =?UTF-8?q?=EA=B0=9C=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=99=80=20=ED=86=B5?= =?UTF-8?q?=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - categoryCounts를 선택 날짜와 무관하게 해당 달 전체 기준으로 변경 - 달력 점도 카테고리 필터 반영 Co-Authored-By: Claude Opus 4.7 --- .../pages/pc/admin/schedules/Schedules.jsx | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/frontend/src/pages/pc/admin/schedules/Schedules.jsx b/frontend/src/pages/pc/admin/schedules/Schedules.jsx index 9b038f2..40c362b 100644 --- a/frontend/src/pages/pc/admin/schedules/Schedules.jsx +++ b/frontend/src/pages/pc/admin/schedules/Schedules.jsx @@ -348,7 +348,7 @@ function Schedules() { overscan: 5, // 버퍼 아이템 수 }); - // 카테고리별 카운트 맵 (useMemo로 미리 계산) - 선택된 날짜 기준 + // 카테고리별 카운트 맵 (선택 날짜와 무관하게 해당 달 전체 기준) const categoryCounts = useMemo(() => { // 검색어가 있을 때만 검색 결과 사용, 아니면 기존 schedules 사용 const source = isSearchMode && searchTerm ? searchResults : schedules; @@ -356,14 +356,6 @@ function Schedules() { let total = 0; source.forEach((s) => { - // 검색 모드에서 검색어가 있을 때는 전체 대상 - // 그 외에는 선택된 날짜 기준으로 필터링 - if (!(isSearchMode && searchTerm) && selectedDate) { - const sDate = getScheduleDate(s); - const scheduleDate = formatDate(sDate); - if (scheduleDate !== selectedDate) return; - } - const catId = getCategoryId(s); counts.set(catId, (counts.get(catId) || 0) + 1); total++; @@ -371,7 +363,7 @@ function Schedules() { counts.set('total', total); return counts; - }, [schedules, searchResults, isSearchMode, searchTerm, selectedDate]); + }, [schedules, searchResults, isSearchMode, searchTerm]); // 정렬된 카테고리 목록 (메모이제이션으로 깜빡임 방지) const sortedCategories = useMemo(() => { @@ -641,12 +633,14 @@ function Schedules() { const isToday = new Date().toDateString() === new Date(year, month, day).toDateString(); - // 해당 날짜의 일정 목록 (점 표시용, 최대 3개) + // 해당 날짜의 일정 목록 (점 표시용, 최대 3개) - 카테고리 필터 반영 const daySchedules = schedules .filter((s) => { const scheduleDate = s.date ? s.date.split('T')[0] : ''; - const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`; - return scheduleDate === dateStr; + const matchesDate = scheduleDate === dateStr; + const matchesCategory = + selectedCategories.length === 0 || selectedCategories.includes(s.category_id); + return matchesDate && matchesCategory; }) .slice(0, 3);