From cd3214960e65293802f073b3237e3a38ca37ca00 Mon Sep 17 00:00:00 2001 From: Louis Mazin Date: Fri, 25 Sep 2026 16:13:12 +0200 Subject: [PATCH] test --- frontend/src/pages/CalendarPage.jsx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/CalendarPage.jsx b/frontend/src/pages/CalendarPage.jsx index f651524..f33a23d 100644 --- a/frontend/src/pages/CalendarPage.jsx +++ b/frontend/src/pages/CalendarPage.jsx @@ -1,5 +1,6 @@ import React, { useEffect, + useLayoutEffect, useMemo, useRef, useState, @@ -112,6 +113,8 @@ const CalendarPage = () => { ); const [isMobile, setIsMobile] = useState(false); + const [calendarViewportHeight, setCalendarViewportHeight] = + useState(null); const [events, setEvents] = useState([]); const [loadingEvents, setLoadingEvents] = @@ -159,6 +162,7 @@ const CalendarPage = () => { end_time: '', color: DEFAULT_EVENT_COLOR, }); + const calendarViewportRef = useRef(null); /* SÉLECTION D'UNE PÉRIODE */ const [selectionStart, setSelectionStart] = useState(null); const [selectionEnd, setSelectionEnd] = useState(null); @@ -430,6 +434,22 @@ const CalendarPage = () => { useEffect(() => { if (isMobile) clearSelection(); }, [isMobile]); + useLayoutEffect(() => { + if (loadingEvents || !calendarViewportRef.current) return; + + const viewport = calendarViewportRef.current; + const updateHeight = () => { + const height = viewport.getBoundingClientRect().height; + setCalendarViewportHeight((previous) => + previous === height ? previous : height, + ); + }; + + updateHeight(); + const observer = new ResizeObserver(updateHeight); + observer.observe(viewport); + return () => observer.disconnect(); + }, [loadingEvents]); /* * ============================================================ * ANNÉE @@ -1386,6 +1406,7 @@ const CalendarPage = () => { )}
{ }} >