From 2b017a9395ce31395130a6fe508f983e51ab5252 Mon Sep 17 00:00:00 2001 From: alma Date: Wed, 30 Apr 2025 17:07:09 +0200 Subject: [PATCH] courrier formatting --- app/courrier/page.tsx | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/courrier/page.tsx b/app/courrier/page.tsx index cbc58fd6..003dad41 100644 --- a/app/courrier/page.tsx +++ b/app/courrier/page.tsx @@ -714,9 +714,7 @@ export default function CourrierPage() { -
- {/* Buttons removed from here to avoid duplication with the BulkActionsToolbar */} -
+ {/* Buttons removed from here to avoid duplication with the BulkActionsToolbar */} {/* Email List - Always visible */} @@ -743,7 +741,23 @@ export default function CourrierPage() { ) : (
{/* Email List */} -
+
{ + const target = e.currentTarget; + const { scrollTop, scrollHeight, clientHeight } = target; + const distanceToBottom = scrollHeight - scrollTop - clientHeight; + const scrollPercentage = (scrollTop + clientHeight) / scrollHeight; + + console.log(`[DEBUG-WRAPPER-SCROLL] Distance to bottom: ${distanceToBottom}px, percentage: ${Math.round(scrollPercentage * 100)}%, hasMoreEmails: ${page < totalPages}, isLoading: ${isLoading}`); + + // If near bottom and not already loading and has more emails + if (distanceToBottom < 300 && !isLoading && page < totalPages) { + console.log(`[DEBUG-WRAPPER-TRIGGER] Calling handleLoadMore from wrapper`); + handleLoadMore(); + } + }} + > {emails.length === 0 ? (