"use client"; import { useLocale, useTranslations } from "next-intl"; import { useEffect, useState } from "react"; import InfiniteScroll from "react-infinite-scroll-component"; import HeroCarousel from "./Carousel"; import CategoryGrid from "./CategoryGrid"; import CollectionSection from "./ProductGrid"; import { useCategories, useCarousels, useCollections } from "@/lib/hooks"; export default function HomePage() { const locale = useLocale(); const t = useTranslations("common"); const [mounted, setMounted] = useState(false); const [visibleCount, setVisibleCount] = useState(10); const { data: categories, isLoading: categoriesLoading, isError: categoriesError, } = useCategories(); const { data: carousels, isLoading: carouselsLoading } = useCarousels(); const { data: collections, isLoading: collectionsLoading, isError: collectionsError, } = useCollections(); useEffect(() => setMounted(true), []); const loadMore = () => { if (collections && visibleCount < collections.length) { setVisibleCount((prev) => Math.min(prev + 10, collections.length)); } }; if (!mounted) return
Failed to load collections. Please try again.
Loading more collections...
✓ All collections loaded