diff --git a/.claude/settings.local.json b/.claude/settings.local.json index be79e92..e4ca634 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -161,7 +161,8 @@ "Bash(curl -s \"http://127.0.0.1:3000/products/awd-hoodie\")", "Bash(git commit -m 'Fix: NavDropdown link navigation with stopPropagation *)", "Bash(git commit -m 'Feat: Remove all filters from products pages *)", - "Bash(git commit -m 'Feat: Add loading spinner for made-to-order page *)" + "Bash(git commit -m 'Feat: Add loading spinner for made-to-order page *)", + "Bash(git commit -m 'Revert: Remove loading spinner - was slowing down page *)" ] } } diff --git a/src/app/made-to-order/page.tsx b/src/app/made-to-order/page.tsx index 912e821..0712158 100644 --- a/src/app/made-to-order/page.tsx +++ b/src/app/made-to-order/page.tsx @@ -2,8 +2,6 @@ import { prisma } from '@/lib/prisma'; import { toProductDTO } from '@/lib/product'; import { fetchActivePromotions } from '@/lib/promotions'; import ProductCard from '@/components/ProductCard'; -import LoadingSpinner from '@/components/LoadingSpinner'; -import { Suspense } from 'react'; type SearchParams = { page?: string; @@ -11,7 +9,8 @@ type SearchParams = { const PRODUCTS_PER_PAGE = 20; -async function ProductsGrid({ currentPage }: { currentPage: number }) { +export default async function ProductsPage({ searchParams }: { searchParams: SearchParams }) { + const currentPage = Math.max(1, Number(searchParams.page) || 1); const activePromotions = await fetchActivePromotions(); const [rows, totalCount] = await Promise.all([ @@ -27,13 +26,6 @@ async function ProductsGrid({ currentPage }: { currentPage: number }) { const products = rows.map((p) => toProductDTO(p, activePromotions, 'personalised')); const totalPages = Math.ceil(totalCount / PRODUCTS_PER_PAGE); - return { products, totalPages, totalCount, currentPage }; -} - -export default async function ProductsPage({ searchParams }: { searchParams: SearchParams }) { - const currentPage = Math.max(1, Number(searchParams.page) || 1); - const totalCount = await prisma.product.count({ where: { showOnPersonalised: true } }); - return (
@@ -43,56 +35,46 @@ export default async function ProductsPage({ searchParams }: { searchParams: Sea

- }> - - -
- ); -} - -async function ProductsGridContent({ currentPage, totalCount }: { currentPage: number; totalCount: number }) { - const { products, totalPages } = await ProductsGrid({ currentPage }); - - return ( -
- {products.length === 0 ? ( -
-

Nothing here yet

-

Templates will show up here once created.

-
- ) : ( -
-
- {products.map((p) => ( - - ))} +
+ {products.length === 0 ? ( +
+

Nothing here yet

+

Templates will show up here once created.

- - {totalPages > 1 && ( -
- {currentPage > 1 && ( - - ← Previous - - )} -

- Page {currentPage} of {totalPages} -

- {currentPage < totalPages && ( - - Next → - - )} + ) : ( +
+
+ {products.map((p) => ( + + ))}
- )} -
- )} + + {totalPages > 1 && ( +
+ {currentPage > 1 && ( + + ← Previous + + )} +

+ Page {currentPage} of {totalPages} +

+ {currentPage < totalPages && ( + + Next → + + )} +
+ )} +
+ )} +
); } diff --git a/src/components/LoadingSpinner.tsx b/src/components/LoadingSpinner.tsx deleted file mode 100644 index d1256fd..0000000 --- a/src/components/LoadingSpinner.tsx +++ /dev/null @@ -1,10 +0,0 @@ -export default function LoadingSpinner() { - return ( -
-
-
-
-
-
- ); -}