달력에서 카테고리 필터 적용
- PC/모바일 일정 페이지 달력의 점에 카테고리 필터 적용 - 선택된 카테고리의 일정만 달력에 점으로 표시 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d1250124a7
commit
0c278597c0
2 changed files with 10 additions and 4 deletions
|
|
@ -686,9 +686,13 @@ function MobileSchedule() {
|
||||||
const day = String(date.getDate()).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
||||||
const dateStr = `${year}-${month}-${day}`;
|
const dateStr = `${year}-${month}-${day}`;
|
||||||
|
|
||||||
// 해당 날짜의 일정 목록 (최대 3개)
|
// 해당 날짜의 일정 목록 (최대 3개, 카테고리 필터 적용)
|
||||||
const daySchedules = schedules
|
const daySchedules = schedules
|
||||||
.filter(s => s.date?.split('T')[0] === dateStr)
|
.filter(s => {
|
||||||
|
const matchesDate = s.date?.split('T')[0] === dateStr;
|
||||||
|
const matchesCategory = selectedCategories.length === 0 || selectedCategories.includes(s.category_id);
|
||||||
|
return matchesDate && matchesCategory;
|
||||||
|
})
|
||||||
.slice(0, 3);
|
.slice(0, 3);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -804,11 +804,13 @@ function Schedule() {
|
||||||
const dayOfWeek = (firstDay + i) % 7;
|
const dayOfWeek = (firstDay + i) % 7;
|
||||||
const isToday = new Date().toDateString() === new Date(year, month, day).toDateString();
|
const isToday = new Date().toDateString() === new Date(year, month, day).toDateString();
|
||||||
|
|
||||||
// 해당 날짜의 일정 목록 (점 표시용, 최대 3개)
|
// 해당 날짜의 일정 목록 (점 표시용, 최대 3개, 카테고리 필터 적용)
|
||||||
const daySchedules = schedules.filter(s => {
|
const daySchedules = schedules.filter(s => {
|
||||||
const scheduleDate = s.date ? s.date.split('T')[0] : '';
|
const scheduleDate = s.date ? s.date.split('T')[0] : '';
|
||||||
const dateStr = `${year}-${String(month + 1).padStart(2, '0')}-${String(day).padStart(2, '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);
|
}).slice(0, 3);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue