calendar 11
This commit is contained in:
parent
f998e0948c
commit
c88091a1dc
@ -391,7 +391,10 @@ function EventPreview({ event, calendar }: { event: Event; calendar: Calendar })
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function CalendarClient({ initialCalendars, userId, userProfile }: CalendarClientProps) {
|
export function CalendarClient({ initialCalendars, userId, userProfile }: CalendarClientProps) {
|
||||||
const [calendars, setCalendars] = useState(initialCalendars);
|
const [calendars, setCalendars] = useState(initialCalendars.map(cal => ({
|
||||||
|
...cal,
|
||||||
|
events: cal.events || []
|
||||||
|
})));
|
||||||
const [selectedCalendarId, setSelectedCalendarId] = useState<string>(
|
const [selectedCalendarId, setSelectedCalendarId] = useState<string>(
|
||||||
initialCalendars[0]?.id || ""
|
initialCalendars[0]?.id || ""
|
||||||
);
|
);
|
||||||
@ -601,18 +604,20 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
|||||||
setSelectedCalendar(null);
|
setSelectedCalendar(null);
|
||||||
setIsCalendarModalOpen(true);
|
setIsCalendarModalOpen(true);
|
||||||
}}
|
}}
|
||||||
|
className="bg-white hover:bg-gray-50 text-gray-900 border-gray-200"
|
||||||
>
|
>
|
||||||
<Plus className="mr-2 h-4 w-4" />
|
<Plus className="mr-2 h-4 w-4" />
|
||||||
Nouveau calendrier
|
<span className="font-medium">Nouveau calendrier</span>
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedEvent(null);
|
setSelectedEvent(null);
|
||||||
setIsEventModalOpen(true);
|
setIsEventModalOpen(true);
|
||||||
}}
|
}}
|
||||||
|
className="bg-primary hover:bg-primary/90 text-white"
|
||||||
>
|
>
|
||||||
<Plus className="mr-2 h-4 w-4" />
|
<Plus className="mr-2 h-4 w-4" />
|
||||||
Nouvel événement
|
<span className="font-medium">Nouvel événement</span>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -656,7 +661,7 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
|||||||
right: "",
|
right: "",
|
||||||
}}
|
}}
|
||||||
events={calendars.flatMap(cal =>
|
events={calendars.flatMap(cal =>
|
||||||
cal.events.map(event => ({
|
(cal.events || []).map(event => ({
|
||||||
id: event.id,
|
id: event.id,
|
||||||
title: event.title,
|
title: event.title,
|
||||||
start: event.start,
|
start: event.start,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user