fix(admin-schedule): 카테고리 필터를 공개 페이지와 통일

- categoryCounts를 선택 날짜와 무관하게 해당 달 전체 기준으로 변경
- 달력 점도 카테고리 필터 반영

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
caadiq 2026-06-01 12:54:47 +09:00
parent 70fb6527fe
commit c0ac18060d

View file

@ -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);