// app/search/[collection]/page.tsx // Simulate fetching products for a collection async function getProductsByCollection(collectionName: string) { // Simulate network delay await new Promise(resolve => setTimeout(resolve, 50)); const allProducts: { [key: string]: any[] } = { 't-shirts': [ { id: 'ts1', name: 'Cool T-Shirt', price: { amount: '19.99', currencyCode: 'USD' }, image: { src: '/placeholder-tshirt1.jpg', alt: 'T-Shirt 1' } }, { id: 'ts2', name: 'Graphic Tee', price: { amount: '24.99', currencyCode: 'USD' }, image: { src: '/placeholder-tshirt2.jpg', alt: 'T-Shirt 2' } }, { id: 'ts3', name: 'Plain V-Neck', price: { amount: '15.50', currencyCode: 'USD' }, image: { src: '/placeholder-tshirt3.jpg', alt: 'Plain V-Neck' } }, ], 'accessories': [ { id: 'ac1', name: 'Stylish Cap', price: { amount: '15.00', currencyCode: 'USD' }, image: { src: '/placeholder-cap.jpg', alt: 'Cap' } }, { id: 'ac2', name: 'Leather Belt', price: { amount: '35.00', currencyCode: 'USD' }, image: { src: '/placeholder-belt.jpg', alt: 'Leather Belt' } }, ], 'footwear': [ { id: 'fw1', name: 'Running Shoes', price: { amount: '79.99', currencyCode: 'USD' }, image: { src: '/placeholder-shoes1.jpg', alt: 'Running Shoes' } }, { id: 'fw2', name: 'Casual Sneakers', price: { amount: '65.00', currencyCode: 'USD' }, image: { src: '/placeholder-sneakers1.jpg', alt: 'Casual Sneakers' } }, { id: 'fw3', name: 'Formal Shoes', price: { amount: '120.00', currencyCode: 'USD' }, image: { src: '/placeholder-shoes2.jpg', alt: 'Formal Shoes' } }, ] // Add more dummy collections and products as needed }; // Ensure collectionName is string and lowercase for object key access return allProducts[String(collectionName).toLowerCase()] || []; } interface CollectionPageProps { params: Promise<{ collection: string }>; searchParams: Promise<{ [key: string]: string | string[] | undefined }>; } export default async function CollectionPage({ params, searchParams }: CollectionPageProps) { const resolvedParams = await params; // const resolvedSearchParams = await searchParams; // Await if needed for filtering, etc. const products = await getProductsByCollection(resolvedParams.collection); const collectionName = resolvedParams.collection.charAt(0).toUpperCase() + resolvedParams.collection.slice(1); return (
{product.price.amount} {product.price.currencyCode}
{/* Use a generic link for now; specific product pages are handled by [handle] route */} View DetailsNo products found in this collection.
)}