diff --git a/src/app/page.tsx b/src/app/page.tsx index 36fb3ed..15cccc5 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -87,7 +87,7 @@ export default function HomePage() { Get Started @@ -381,7 +381,7 @@ export default function HomePage() { Start Free Today diff --git a/src/lib/pdf-export.tsx b/src/lib/pdf-export.tsx index 9ef0275..8fd8cac 100644 --- a/src/lib/pdf-export.tsx +++ b/src/lib/pdf-export.tsx @@ -623,7 +623,7 @@ function calculateItemsForPage( if (isFirstPage) { // Dense header takes significant space - availableHeight -= 200; // Dense header space + availableHeight -= 300; // Dense header space } else { // Abridged header is smaller availableHeight -= 60; // Abridged header space @@ -675,7 +675,7 @@ function calculateItemsPerPage( if (isFirstPage) { // Dense header takes significant space - availableHeight -= 200; // Dense header space + availableHeight -= 300; // Dense header space } else { // Abridged header is smaller availableHeight -= 60; // Abridged header space @@ -717,36 +717,35 @@ function paginateItems( const isFirstPage = pageIndex === 0; const remainingItems = validItems.length - currentIndex; - // Check if this is the last page to determine if we need space for notes - const couldBeLastPage = - currentIndex + calculateItemsPerPage(isFirstPage, false) >= - validItems.length; + // Determine if this could be the last page with simple calculation + const maxPossibleItems = calculateItemsPerPage(isFirstPage, false); + const wouldBeLastPage = + currentIndex + maxPossibleItems >= validItems.length; - // Calculate items per page using dynamic calculation + // Calculate items per page, accounting for notes space if this is likely the last page let itemsPerPage = calculateItemsForPage( validItems, currentIndex, isFirstPage, - couldBeLastPage && hasNotes, + wouldBeLastPage && hasNotes, ); - // Fallback to old method if dynamic calculation fails + // Fallback to conservative calculation if dynamic fails if (itemsPerPage === 0) { itemsPerPage = calculateItemsPerPage( isFirstPage, - couldBeLastPage && hasNotes, + wouldBeLastPage && hasNotes, ); } - // Check if this would create orphans (< 3 items on next page) - if (remainingItems > itemsPerPage && remainingItems - itemsPerPage < 3) { - // Try to fit a few more items or split more evenly - const potentialItemsPerPage = Math.floor(remainingItems / 2); - if (potentialItemsPerPage > 0) { - itemsPerPage = potentialItemsPerPage; - } + // Ensure we don't have tiny orphan pages + if (remainingItems > itemsPerPage && remainingItems - itemsPerPage < 2) { + itemsPerPage = Math.max(1, itemsPerPage - 1); } + // Never take more items than we have + itemsPerPage = Math.min(itemsPerPage, remainingItems); + const pageItems = validItems.slice( currentIndex, currentIndex + itemsPerPage, diff --git a/src/styles/globals.css b/src/styles/globals.css index 4a0ac9a..cc95400 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -671,7 +671,7 @@ /* Additional Brand Utility Classes */ .btn-brand-primary { - @apply bg-gradient-to-r from-teal-500 to-teal-700 text-white shadow-lg shadow-teal-500/25 transition-all duration-300 hover:from-teal-600 hover:to-teal-800 hover:shadow-xl hover:shadow-teal-500/30; + @apply bg-gradient-to-r from-teal-500 to-teal-700 text-white shadow-lg shadow-teal-500/25 transition-colors duration-300 hover:from-teal-600 hover:to-teal-800; } .btn-brand-secondary {