The catalog page atDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dlampatricio/florale/llms.txt
Use this file to discover all available pages before exploring further.
/catalogo is the main browsing surface of the Floralé storefront. It runs entirely as a Next.js server component — no 'use client' directive — so all data fetching happens on the server before the page is sent to the browser. Products are loaded from Supabase in a single parallel fetch, then grouped by their categoryId and rendered into a responsive grid of ProductCard items.
Server-side data fetching
The page callsgetProducts() and getCategories() in parallel using Promise.all, so neither request blocks the other. Both functions live in lib/products.ts and hit the Supabase REST API directly over fetch with cache: 'no-store', ensuring the catalog always reflects the latest inventory.
Data-fetching functions
Both helpers inlib/products.ts call an internal fetchFromSupabase<T>() utility that reads NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY from the environment and attaches the required apikey / Authorization headers automatically.
Function parameters
Fetches all products ordered by
created_at ascending. Returns an empty array if Supabase credentials are missing or the request fails.Fetches all categories ordered by
id ascending. Used to determine render order in ProductGrid.Fetches a single product by its UUID. Returns
undefined if not found, which triggers notFound() on the product detail page.Data types
The Supabase column is
category_id (snake_case). The mapProduct() helper in lib/products.ts converts it to camelCase categoryId so the rest of the app uses a consistent naming convention.ProductGrid and category grouping
ProductGrid receives the flat products array and the categories array, then builds a GroupedProducts map ({ [categoryId]: Product[] }) on the client. It iterates over categories in order, skipping any category with no products, and renders a titled section for each.
id attribute matching category.id, enabling anchor-link navigation from a future category nav bar. Categories are rendered in the same order they come from Supabase (order=id.asc).
ProductCard component
ProductCard is a 'use client' component that renders the product thumbnail, name, and price, and exposes a floating + button to add the item to the cart without navigating away from the catalog.
What the card renders
Product image
A square
aspect-square crop of the product’s Supabase Storage image, using ImageWithSkeleton for a progressive loading effect.Name & price
Product name in the display font, formatted price in UYU via
formatPrice() from lib/utils.ts.Add-to-cart button
Floating
+ circle in the bottom-right corner. Calls addItem(product.id) and shows a toast notification. Uses e.stopPropagation() so clicking it doesn’t navigate to the product page.Staggered animation
Each card fades and slides up when it enters the viewport (
whileInView), with a delay of index × 80ms for a cascading reveal effect.Summary
Request arrives at /catalogo
Next.js renders
CatalogoPage on the server as an async server component.Parallel Supabase fetch
Promise.all([getProducts(), getCategories()]) fires two concurrent requests to the Supabase REST API.ProductGrid groups products
The flat product array is reduced into a
{ [categoryId]: Product[] } map, then each category section is rendered in order.