From df648c2b70a62f92aec39866cb890ec96da0a4c9 Mon Sep 17 00:00:00 2001 From: Louis Mazin Date: Fri, 25 Sep 2026 16:25:50 +0200 Subject: [PATCH] test --- frontend/src/pages/WeeklySummaryPage.jsx | 113 ++++++----------------- 1 file changed, 26 insertions(+), 87 deletions(-) diff --git a/frontend/src/pages/WeeklySummaryPage.jsx b/frontend/src/pages/WeeklySummaryPage.jsx index 1c8f328..f662511 100644 --- a/frontend/src/pages/WeeklySummaryPage.jsx +++ b/frontend/src/pages/WeeklySummaryPage.jsx @@ -23,12 +23,8 @@ const DEFAULT_START_HOUR = 8; const DEFAULT_END_HOUR = 18; const SCHEDULE_HEADER_HEIGHT = 58; -const MIN_SCHEDULE_HEIGHT = 180; - -const MOBILE_MIN_HOUR_HEIGHT = 52; const MOBILE_TIME_COLUMN_WIDTH = 64; -const MOBILE_USER_COLUMN_WIDTH = 40; const MOBILE_DEFAULT_CONTENT_WIDTH = 236; const expandOvernightAttendances = (entries) => { @@ -443,17 +439,9 @@ const WeeklySummaryPage = ({ userId }) => { } setMobileContainerWidth( - scheduleTable.clientWidth, + Math.max(0, scheduleTable.clientWidth - 2), ); - if (window.innerWidth < 768) { - setMobileContainerHeight( - scheduleTable.clientHeight, - ); - - return; - } - const cardContent = scheduleTable.closest( '[data-slot="card-content"]', @@ -476,12 +464,11 @@ const WeeklySummaryPage = ({ userId }) => { ? footer.getBoundingClientRect().top : window.innerHeight; - const availableBottom = - Math.min( - contentRect.bottom, - footerTop, - window.innerHeight, - ); + const availableBottom = Math.min( + footerTop, + window.innerHeight, + contentRect.bottom, + ); const SAFETY_MARGIN = 4; @@ -490,23 +477,16 @@ const WeeklySummaryPage = ({ userId }) => { tableTop - SAFETY_MARGIN; - const nextTotalHeight = - Math.max( - SCHEDULE_HEADER_HEIGHT + - MIN_SCHEDULE_HEIGHT, - totalAvailableHeight, - ); - - const nextScheduleHeight = - Math.max( - MIN_SCHEDULE_HEIGHT, - nextTotalHeight - - SCHEDULE_HEADER_HEIGHT, - ); - - setAvailableScheduleHeight( - nextScheduleHeight, + const nextScheduleHeight = Math.max( + 0, + totalAvailableHeight - SCHEDULE_HEADER_HEIGHT, ); + + if (window.innerWidth < 768) { + setMobileContainerHeight(Math.max(0, totalAvailableHeight)); + } else { + setAvailableScheduleHeight(nextScheduleHeight); + } }; updateScheduleDimensions(); @@ -1066,27 +1046,9 @@ const WeeklySummaryPage = ({ userId }) => { SCHEDULE_HEADER_HEIGHT, ); - const mobileNaturalScheduleHeight = - hourCount * - MOBILE_MIN_HOUR_HEIGHT; - - const mobileScheduleHeight = - mobileAvailableBodyHeight > 0 - ? Math.max( - mobileAvailableBodyHeight, - mobileNaturalScheduleHeight, - ) - : Math.max( - MIN_SCHEDULE_HEIGHT, - mobileNaturalScheduleHeight, - ); - const scheduleHeight = isMobile - ? mobileScheduleHeight - : Math.max( - MIN_SCHEDULE_HEIGHT, - availableScheduleHeight, - ); + ? mobileAvailableBodyHeight + : availableScheduleHeight; const totalPlanningHeight = SCHEDULE_HEADER_HEIGHT + @@ -1148,7 +1110,7 @@ const WeeklySummaryPage = ({ userId }) => { mobileContainerWidth > 0 ? mobileContainerWidth : typeof window !== 'undefined' - ? window.innerWidth + ? window.innerWidth - 48 : MOBILE_DEFAULT_CONTENT_WIDTH + MOBILE_TIME_COLUMN_WIDTH; @@ -1160,17 +1122,7 @@ const WeeklySummaryPage = ({ userId }) => { ); const mobileUsersWidth = - isAdmin && showAllUsers - ? Math.max( - mobileUserCount * - MOBILE_USER_COLUMN_WIDTH, - MOBILE_DEFAULT_CONTENT_WIDTH, - availableMobileUsersWidth, - ) - : Math.max( - MOBILE_DEFAULT_CONTENT_WIDTH, - availableMobileUsersWidth, - ); + availableMobileUsersWidth; const mobilePlanningWidth = MOBILE_TIME_COLUMN_WIDTH + @@ -1199,7 +1151,7 @@ const WeeklySummaryPage = ({ userId }) => { icon={CalendarDays} className={ isMobile - ? 'overflow-visible' + ? 'overflow-hidden' : 'overflow-hidden' } title={ @@ -1408,22 +1360,9 @@ const WeeklySummaryPage = ({ userId }) => {
{/* ==================================================== @@ -1526,7 +1465,7 @@ const WeeklySummaryPage = ({ userId }) => {
{mobileActiveUsers.map( @@ -1732,10 +1671,10 @@ const WeeklySummaryPage = ({ userId }) => { ==================================================== */
{ ); }; -export default WeeklySummaryPage; \ No newline at end of file +export default WeeklySummaryPage;