correction finition widget done
This commit is contained in:
parent
614f8e5df3
commit
894f9555b7
@ -853,19 +853,11 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
// Calculer la hauteur disponible pour FullCalendar
|
||||
useEffect(() => {
|
||||
const calculateHeight = () => {
|
||||
// Calculer depuis la Card parent qui a une hauteur définie
|
||||
if (cardRef.current && headerRef.current) {
|
||||
const cardHeight = cardRef.current.clientHeight;
|
||||
const headerHeight = headerRef.current.offsetHeight;
|
||||
const padding = 16; // p-4 = 1rem = 16px (top + bottom)
|
||||
const availableHeight = cardHeight - headerHeight - padding;
|
||||
if (calendarContainerRef.current) {
|
||||
// Utiliser getBoundingClientRect pour obtenir la hauteur réelle du conteneur
|
||||
const rect = calendarContainerRef.current.getBoundingClientRect();
|
||||
const containerHeight = rect.height;
|
||||
|
||||
if (availableHeight > 0) {
|
||||
setCalendarHeight(availableHeight);
|
||||
}
|
||||
} else if (calendarContainerRef.current) {
|
||||
// Fallback: utiliser le conteneur si les refs ne sont pas disponibles
|
||||
const containerHeight = calendarContainerRef.current.clientHeight;
|
||||
if (containerHeight > 0) {
|
||||
setCalendarHeight(containerHeight);
|
||||
}
|
||||
@ -878,23 +870,25 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
// Recalculer après un court délai (au cas où le DOM n'est pas complètement rendu)
|
||||
const timeoutId1 = setTimeout(calculateHeight, 100);
|
||||
const timeoutId2 = setTimeout(calculateHeight, 500);
|
||||
const timeoutId3 = setTimeout(calculateHeight, 1000);
|
||||
|
||||
// Recalculer lors du redimensionnement de la fenêtre
|
||||
window.addEventListener('resize', calculateHeight);
|
||||
|
||||
// Observer les changements de taille de la Card
|
||||
// Observer les changements de taille du conteneur
|
||||
const resizeObserver = new ResizeObserver(() => {
|
||||
calculateHeight();
|
||||
});
|
||||
|
||||
if (cardRef.current) {
|
||||
resizeObserver.observe(cardRef.current);
|
||||
if (calendarContainerRef.current) {
|
||||
resizeObserver.observe(calendarContainerRef.current);
|
||||
}
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', calculateHeight);
|
||||
clearTimeout(timeoutId1);
|
||||
clearTimeout(timeoutId2);
|
||||
clearTimeout(timeoutId3);
|
||||
resizeObserver.disconnect();
|
||||
};
|
||||
}, [selectedDate, view]); // Recalculer quand la colonne de droite apparaît/disparaît ou la vue change
|
||||
@ -1745,7 +1739,8 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
|
||||
<div
|
||||
ref={calendarContainerRef}
|
||||
className="flex-1 min-h-0"
|
||||
className="flex-1 min-h-0 overflow-hidden"
|
||||
style={{ height: '100%' }}
|
||||
>
|
||||
<style jsx global>{`
|
||||
/* Fixed height and scrolling for day cells only */
|
||||
@ -1763,6 +1758,13 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
/* Assurer que le calendrier utilise toute la hauteur */
|
||||
.fc {
|
||||
height: 100% !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.fc .fc-view-harness {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Custom scrollbar styles */
|
||||
@ -1909,7 +1911,7 @@ export function CalendarClient({ initialCalendars, userId, userProfile }: Calend
|
||||
dayMaxEvents={false}
|
||||
weekends={true}
|
||||
eventClick={handleEventClick}
|
||||
contentHeight={calendarHeight}
|
||||
height="100%"
|
||||
slotMinTime="06:00:00"
|
||||
slotMaxTime="22:00:00"
|
||||
allDaySlot={true}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user