'use client'; import React from 'react'; import { useCollectionProducts } from '@/editor/hooks/use-shopify-collections'; import ProductCard from './product-card'; import { Skeleton } from '@/components/ui/skeleton'; const CollectionDetail: React.FC<{ handle?: string }> = ({ handle: handleProp }) => { const handle = handleProp ?? ''; const { collection, loading, error, refetch } = useCollectionProducts(handle); // Format title from handle const formattedTitle = handle ? handle.replace(/-/g, ' ').replace(/\b\w/g, l => l.toUpperCase()) : 'Collection'; if (loading || !handle) { return (
Could not load collection
{error}
This collection doesn't have any products yet.