diff --git a/components/calendar/calendar-client.tsx b/components/calendar/calendar-client.tsx index 325ea638..3fcc5758 100644 --- a/components/calendar/calendar-client.tsx +++ b/components/calendar/calendar-client.tsx @@ -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" && ( - + )}
))} @@ -1005,9 +1005,9 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend Nouveau calendrier - - + + - handleViewChange("dayGridMonth")} - > - Mois - - handleViewChange("dayGridMonth")} + > + Mois + + handleViewChange("timeGridWeek")} - > - Semaine - - handleViewChange("timeGridWeek")} + > + Semaine + + handleViewChange("timeGridDay")} - > - Jour - - + onClick={() => handleViewChange("timeGridDay")} + > + Jour + + - + - + {/* Calendar */}
@@ -1084,54 +1084,23 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend } .fc .fc-daygrid-event-harness { - margin-bottom: 4px; + margin-bottom: 2px; } .fc-daygrid-day-frame { min-height: 100px !important; height: 100px !important; } - - .fc-daygrid-event { - padding: 2px 4px !important; - border: none !important; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important; - } - - .fc-daygrid-event:hover { - filter: brightness(1.1); - } - - .fc-daygrid-event .fc-event-title { - font-weight: 600 !important; - font-size: 0.8rem !important; - padding: 0 !important; - } - - .fc-daygrid-event .fc-event-time { - font-size: 0.7rem !important; - opacity: 0.9 !important; - padding: 0 !important; - } - - .fc-daygrid-event .event-location { - font-size: 0.7rem !important; - opacity: 0.8 !important; - } - - .fc-event-title-container { - padding: 0 !important; - } `} - visibleCalendarIds.includes(cal.id)) .flatMap(cal => @@ -1141,8 +1110,8 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend start: new Date(event.start), end: new Date(event.end), allDay: event.isAllDay, - description: event.description, - location: event.location, + description: event.description, + location: event.location, calendarId: event.calendarId, backgroundColor: cal.color, borderColor: cal.color, @@ -1156,67 +1125,40 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend })) )} eventContent={(arg) => ( -
-
-
- {arg.event.title} -
- {!arg.event.allDay && ( -
- {new Date(arg.event.start).toLocaleTimeString('fr-FR', { +
+
{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={(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; - }} + eventClassNames="rounded-md shadow-sm hover:shadow-md transition-shadow cursor-pointer" locale={frLocale} - selectable={true} - selectMirror={true} + selectable={true} + selectMirror={true} dayMaxEvents={false} - weekends={true} - select={handleDateSelect} - eventClick={handleEventClick} + weekends={true} + select={handleDateSelect} + eventClick={handleEventClick} height="auto" - aspectRatio={1.8} + aspectRatio={1.8} slotMinTime="06:00:00" slotMaxTime="22:00:00" allDaySlot={true} @@ -1230,7 +1172,7 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
{/* Calendar dialog */} - setIsCalendarModalOpen(false)} onSave={handleCalendarSave}