Fondation
This commit is contained in:
parent
250421c1c0
commit
1e00c2da4e
@ -241,6 +241,10 @@ export async function GET(req: NextRequest) {
|
||||
missionCount: missionCalendars.length,
|
||||
totalCount: sortedCalendars.length,
|
||||
filteredOut: personalCalendars.length - filteredPersonalCalendars.length,
|
||||
eventsPerCalendar: sortedCalendars.map(cal => ({
|
||||
name: cal.name,
|
||||
eventCount: cal.events?.length || 0
|
||||
}))
|
||||
});
|
||||
|
||||
// Cache the results
|
||||
|
||||
@ -60,6 +60,12 @@ export function CalendarWidget() {
|
||||
|
||||
const calendarsData = await response.json();
|
||||
console.log("Calendar Widget - Raw calendars data:", calendarsData);
|
||||
console.log("Calendar Widget - Calendars count:", calendarsData.length);
|
||||
console.log("Calendar Widget - Events per calendar:", calendarsData.map((cal: any) => ({
|
||||
name: cal.name,
|
||||
eventCount: cal.events?.length || 0,
|
||||
events: cal.events?.map((e: any) => ({ id: e.id, title: e.title, start: e.start })) || []
|
||||
})));
|
||||
|
||||
if (!Array.isArray(calendarsData)) {
|
||||
console.error("Calendar Widget - Calendars data is not an array:", calendarsData);
|
||||
@ -101,10 +107,10 @@ export function CalendarWidget() {
|
||||
});
|
||||
});
|
||||
|
||||
// Filter for upcoming events (today and tomorrow)
|
||||
const tomorrow = addDays(now, 1);
|
||||
// Filter for upcoming events (next 7 days, like the old widget)
|
||||
const nextWeek = addDays(now, 7);
|
||||
const upcomingEvents = allEvents
|
||||
.filter(event => event.start >= now && event.start <= tomorrow)
|
||||
.filter(event => event.start >= now && event.start <= nextWeek)
|
||||
.sort((a, b) => a.start.getTime() - b.start.getTime())
|
||||
.slice(0, 10);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user