calendar 10

This commit is contained in:
Alma 2025-04-13 13:59:46 +02:00
parent b2240cb880
commit f998e0948c

View File

@ -592,10 +592,6 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
return (
<div className="space-y-4">
<StatisticsPanel statistics={statistics} />
<div className="grid grid-cols-12 gap-4">
<div className="col-span-8">
<Card className="p-4">
<div className="flex items-center justify-between mb-4">
<div className="flex items-center gap-4">
@ -681,72 +677,12 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
dayMaxEvents={true}
weekends={true}
select={handleDateSelect}
eventClick={(clickInfo) => {
handleEventClick(clickInfo);
setSelectedEventPreview(clickInfo.event.extendedProps.originalEvent);
}}
eventClick={handleEventClick}
height="auto"
aspectRatio={1.8}
/>
)}
</Card>
</div>
<div className="col-span-4 space-y-4">
{selectedEventPreview ? (
<EventPreview
event={selectedEventPreview}
calendar={calendars.find(c => c.id === selectedEventPreview.calendarId)!}
/>
) : (
<Card className="p-4">
<div className="space-y-4">
<h3 className="font-medium">Mini-calendrier</h3>
<FullCalendar
plugins={[dayGridPlugin]}
initialView="dayGridMonth"
headerToolbar={false}
height="auto"
aspectRatio={1}
events={calendars.flatMap(cal =>
cal.events.map(event => ({
id: event.id,
title: event.title,
start: event.start,
end: event.end,
backgroundColor: cal.color,
}))
)}
locale={frLocale}
/>
</div>
</Card>
)}
<Card className="p-4">
<h3 className="font-medium mb-4">Calendriers</h3>
<div className="space-y-2">
{calendars.map((calendar) => (
<Button
key={calendar.id}
variant={calendar.id === selectedCalendarId ? "secondary" : "ghost"}
className="w-full justify-start"
onClick={() => setSelectedCalendarId(calendar.id)}
>
<div
className="w-3 h-3 rounded-full mr-2"
style={{ backgroundColor: calendar.color }}
/>
{calendar.name}
<Badge variant="outline" className="ml-auto">
{calendar.events.length}
</Badge>
</Button>
))}
</div>
</Card>
</div>
</div>
{/* Calendar dialog */}
<CalendarDialog