Use transition-colors for brand buttons

Adjust PDF export pagination for better orphan handling

Increase dense header space to 300px for PDF export

Prevent orphan pages with fewer than 2 items in PDF export
This commit is contained in:
2025-07-30 20:39:06 -04:00
parent acc8731e09
commit 0040fae499
3 changed files with 19 additions and 20 deletions

View File

@@ -87,7 +87,7 @@ export default function HomePage() {
<Link href="/auth/register"> <Link href="/auth/register">
<Button <Button
size="lg" size="lg"
className="btn-brand-secondary group w-full px-6 py-3 text-base font-semibold shadow-xl transition-all duration-300 sm:w-auto sm:px-8 sm:py-4 sm:text-lg" className="btn-brand-secondary group w-full px-6 py-3 text-base font-semibold shadow-xl transition-colors duration-300 sm:w-auto sm:px-8 sm:py-4 sm:text-lg"
> >
Get Started Get Started
<ArrowRight className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1 sm:h-5 sm:w-5" /> <ArrowRight className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1 sm:h-5 sm:w-5" />
@@ -381,7 +381,7 @@ export default function HomePage() {
<Button <Button
size="lg" size="lg"
variant="secondary" variant="secondary"
className="btn-brand-secondary group w-full px-6 py-3 text-base font-semibold shadow-xl transition-all duration-300 sm:w-auto sm:px-8 sm:py-4 sm:text-lg" className="btn-brand-secondary group w-full px-6 py-3 text-base font-semibold shadow-xl transition-colors duration-300 sm:w-auto sm:px-8 sm:py-4 sm:text-lg"
> >
Start Free Today Start Free Today
<Rocket className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1 sm:h-5 sm:w-5" /> <Rocket className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1 sm:h-5 sm:w-5" />

View File

@@ -623,7 +623,7 @@ function calculateItemsForPage(
if (isFirstPage) { if (isFirstPage) {
// Dense header takes significant space // Dense header takes significant space
availableHeight -= 200; // Dense header space availableHeight -= 300; // Dense header space
} else { } else {
// Abridged header is smaller // Abridged header is smaller
availableHeight -= 60; // Abridged header space availableHeight -= 60; // Abridged header space
@@ -675,7 +675,7 @@ function calculateItemsPerPage(
if (isFirstPage) { if (isFirstPage) {
// Dense header takes significant space // Dense header takes significant space
availableHeight -= 200; // Dense header space availableHeight -= 300; // Dense header space
} else { } else {
// Abridged header is smaller // Abridged header is smaller
availableHeight -= 60; // Abridged header space availableHeight -= 60; // Abridged header space
@@ -717,36 +717,35 @@ function paginateItems(
const isFirstPage = pageIndex === 0; const isFirstPage = pageIndex === 0;
const remainingItems = validItems.length - currentIndex; const remainingItems = validItems.length - currentIndex;
// Check if this is the last page to determine if we need space for notes // Determine if this could be the last page with simple calculation
const couldBeLastPage = const maxPossibleItems = calculateItemsPerPage(isFirstPage, false);
currentIndex + calculateItemsPerPage(isFirstPage, false) >= const wouldBeLastPage =
validItems.length; 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( let itemsPerPage = calculateItemsForPage(
validItems, validItems,
currentIndex, currentIndex,
isFirstPage, isFirstPage,
couldBeLastPage && hasNotes, wouldBeLastPage && hasNotes,
); );
// Fallback to old method if dynamic calculation fails // Fallback to conservative calculation if dynamic fails
if (itemsPerPage === 0) { if (itemsPerPage === 0) {
itemsPerPage = calculateItemsPerPage( itemsPerPage = calculateItemsPerPage(
isFirstPage, isFirstPage,
couldBeLastPage && hasNotes, wouldBeLastPage && hasNotes,
); );
} }
// Check if this would create orphans (< 3 items on next page) // Ensure we don't have tiny orphan pages
if (remainingItems > itemsPerPage && remainingItems - itemsPerPage < 3) { if (remainingItems > itemsPerPage && remainingItems - itemsPerPage < 2) {
// Try to fit a few more items or split more evenly itemsPerPage = Math.max(1, itemsPerPage - 1);
const potentialItemsPerPage = Math.floor(remainingItems / 2);
if (potentialItemsPerPage > 0) {
itemsPerPage = potentialItemsPerPage;
}
} }
// Never take more items than we have
itemsPerPage = Math.min(itemsPerPage, remainingItems);
const pageItems = validItems.slice( const pageItems = validItems.slice(
currentIndex, currentIndex,
currentIndex + itemsPerPage, currentIndex + itemsPerPage,

View File

@@ -671,7 +671,7 @@
/* Additional Brand Utility Classes */ /* Additional Brand Utility Classes */
.btn-brand-primary { .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 { .btn-brand-secondary {