diff --git a/components/calendar/calendar-client.tsx b/components/calendar/calendar-client.tsx
index 3fcc5758..c91d617a 100644
--- a/components/calendar/calendar-client.tsx
+++ b/components/calendar/calendar-client.tsx
@@ -771,7 +771,7 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
end: new Date(eventForm.end).toISOString(),
allDay: eventForm.allDay,
location: eventForm.location,
- calendarId: selectedCalendarId,
+ calendarId: selectedCalendarId,
userId
};
@@ -787,7 +787,7 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
const responseData = await response.json();
console.log("Response from server:", responseData);
-
+
if (!response.ok) {
console.error("Error response:", responseData);
throw new Error(responseData.error || "Failed to save event");
@@ -897,9 +897,9 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
// Update CalendarSelector to handle visibility
const CalendarSelector = () => (
- {calendars.map((calendar) => (
+ {calendars.map((calendar) => (
-
-
+
{calendar.name !== "Calendrier principal" && (
-
+
)}
))}
@@ -988,110 +988,74 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
};
return (
-
- {/* Sidebar */}
-
-
-
-
-
+
+
+
+
+
-
-
+
+
handleViewChange("dayGridMonth")}
>
Mois
handleViewChange("timeGridWeek")}
>
Semaine
handleViewChange("timeGridDay")}
>
Jour
-
+
-
-
+
-
+ {loading ? (
+
+
+ Chargement des événements...
-
- {/* Calendar */}
-
-
+ ) : (
visibleCalendarIds.includes(cal.id))
- .flatMap(cal =>
- (cal.events || []).map(event => ({
+ events={calendars
+ .filter(cal => visibleCalendarIds.includes(cal.id))
+ .flatMap(cal =>
+ (cal.events || []).map(event => ({
id: event.id,
title: event.title,
- start: new Date(event.start),
- end: new Date(event.end),
+ start: new Date(event.start),
+ end: new Date(event.end),
allDay: event.isAllDay,
description: event.description,
location: event.location,
- calendarId: event.calendarId,
- backgroundColor: cal.color,
- borderColor: cal.color,
- textColor: '#ffffff',
- extendedProps: {
- location: event.location,
- description: event.description,
calendarId: event.calendarId,
- originalEvent: event
- }
- }))
- )}
- eventContent={(arg) => (
-
-
{arg.event.title}
- {!arg.event.allDay && (
-
- {new Date(arg.event.start).toLocaleTimeString('fr-FR', {
- hour: '2-digit',
- minute: '2-digit'
- })}
- {arg.event.end && (
- <> - {new Date(arg.event.end).toLocaleTimeString('fr-FR', {
+ backgroundColor: cal.color,
+ borderColor: cal.color,
+ textColor: '#ffffff',
+ extendedProps: {
+ location: event.location,
+ description: event.description,
+ calendarId: event.calendarId,
+ originalEvent: event
+ }
+ }))
+ )}
+ eventContent={(arg) => (
+
+
{arg.event.title}
+ {!arg.event.allDay && (
+
+ {new Date(arg.event.start).toLocaleTimeString('fr-FR', {
hour: '2-digit',
minute: '2-digit'
- })}>
- )}
-
- )}
- {arg.event.extendedProps.location && (
-
-
- {arg.event.extendedProps.location}
-
- )}
-
- )}
- eventClassNames="rounded-md shadow-sm hover:shadow-md transition-shadow cursor-pointer"
- locale={frLocale}
+ })}
+ {arg.event.end && (
+ <> - {new Date(arg.event.end).toLocaleTimeString('fr-FR', {
+ hour: '2-digit',
+ minute: '2-digit'
+ })}>
+ )}
+
+ )}
+ {arg.event.extendedProps.location && (
+
+
+ {arg.event.extendedProps.location}
+
+ )}
+
+ )}
+ eventClassNames="rounded-md shadow-sm hover:shadow-md transition-shadow cursor-pointer"
+ locale={frLocale}
selectable={true}
selectMirror={true}
- dayMaxEvents={false}
+ dayMaxEvents={true}
weekends={true}
select={handleDateSelect}
eventClick={handleEventClick}
- height="auto"
+ height="auto"
aspectRatio={1.8}
- slotMinTime="06:00:00"
- slotMaxTime="22:00:00"
- allDaySlot={true}
- allDayText="Toute la journée"
- slotLabelFormat={{
- hour: '2-digit',
- minute: '2-digit',
- hour12: false
- }}
- />
-
+ slotMinTime="06:00:00"
+ slotMaxTime="22:00:00"
+ allDaySlot={true}
+ allDayText="Toute la journée"
+ slotLabelFormat={{
+ hour: '2-digit',
+ minute: '2-digit',
+ hour12: false
+ }}
+ />
+ )}
+
{/* Calendar dialog */}