diff --git a/components/calendar/calendar-client.tsx b/components/calendar/calendar-client.tsx index b1f328d6..325ea638 100644 --- a/components/calendar/calendar-client.tsx +++ b/components/calendar/calendar-client.tsx @@ -988,153 +988,246 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend }; return ( -
- -
-
- - +
+ {/* Sidebar */} +
+ +
+
+ + +
+ + + + handleViewChange("dayGridMonth")} + > + Mois + + handleViewChange("timeGridWeek")} + > + Semaine + + handleViewChange("timeGridDay")} + > + Jour + + +
- - - handleViewChange("dayGridMonth")} - > - Mois - - handleViewChange("timeGridWeek")} - > - Semaine - - handleViewChange("timeGridDay")} - > - Jour - - - -
+ + - + +
- {loading ? ( -
- - Chargement des événements... -
- ) : ( - 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), - allDay: event.isAllDay, - description: event.description, + {/* Calendar */} +
+ + 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), + 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, - 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}
+ 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', { - 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={true} - weekends={true} - select={handleDateSelect} - eventClick={handleEventClick} - 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 - }} - /> - )} - + {arg.event.extendedProps.location && ( +
+ + {arg.event.extendedProps.location} +
+ )} +
+ )} + eventClassNames={(arg) => { + // Generate a lighter version of the calendar color for the background + const color = arg.event.backgroundColor; + return [ + 'rounded-md', + 'transition-all', + 'duration-200', + 'hover:shadow-md', + 'cursor-pointer', + `hover:translate-y-[-1px]`, + 'border-l-4' + ]; + }} + eventBackgroundColor={(arg) => { + const color = arg.event.backgroundColor; + // Convert hex to RGB and lighten it + const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color); + if (result) { + const r = parseInt(result[1], 16); + const g = parseInt(result[2], 16); + const b = parseInt(result[3], 16); + return `rgba(${r}, ${g}, ${b}, 0.15)`; + } + return color; + }} + eventBorderColor={(arg) => arg.event.backgroundColor} + eventTextColor={(arg) => { + const color = arg.event.backgroundColor; + return color; + }} + locale={frLocale} + selectable={true} + selectMirror={true} + dayMaxEvents={false} + weekends={true} + select={handleDateSelect} + eventClick={handleEventClick} + 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 + }} + /> +
{/* Calendar dialog */}