Agenda refactor

This commit is contained in:
alma 2026-01-14 21:34:20 +01:00
parent df21ed0c4a
commit c6ce56f469

View File

@ -1464,10 +1464,20 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
center: "title", center: "title",
right: "", right: "",
}} }}
events={calendars events={(() => {
.filter(cal => visibleCalendarIds.includes(cal.id)) const visibleCalendars = calendars.filter(cal => visibleCalendarIds.includes(cal.id));
.flatMap(cal => const allEvents = visibleCalendars.flatMap(cal => {
(cal.events || []).map(event => ({ const events = cal.events || [];
console.log(`[CALENDAR] Calendar ${cal.name} (${cal.id}): ${events.length} events, visible: ${visibleCalendarIds.includes(cal.id)}`);
if (events.length > 0) {
console.log(`[CALENDAR] Events for ${cal.name}:`, events.slice(0, 3).map(e => ({
id: e.id,
title: e.title,
start: e.start,
isAllDay: e.isAllDay
})));
}
return events.map(event => ({
id: event.id, id: event.id,
title: event.title, title: event.title,
start: new Date(event.start), start: new Date(event.start),
@ -1487,8 +1497,11 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
originalEvent: event, originalEvent: event,
color: cal.color color: cal.color
} }
})) }));
)} });
console.log(`[CALENDAR] Total events for FullCalendar: ${allEvents.length}`);
return allEvents;
})()}
eventContent={(arg) => { eventContent={(arg) => {
return ( return (
<TooltipProvider> <TooltipProvider>