32 lines
870 B
TypeScript
32 lines
870 B
TypeScript
// app/products/page.tsx
|
||
import ProductCard from '@/components/productcard';
|
||
import { getProducts } from '@/public/src/services/products/api';
|
||
|
||
export default async function ProductsPage() {
|
||
const data = await getProducts(1, 20);
|
||
|
||
const products = data.items.map((p: any) => ({
|
||
id: p.id,
|
||
title: p.title,
|
||
brand: p.brand,
|
||
price: p.calculated_price,
|
||
stock: p.stock,
|
||
slug: p.slug,
|
||
image: p.mainImageUrl || "/placeholder.png",
|
||
attributes: p.attributes
|
||
}));
|
||
|
||
return (
|
||
<div className="container mx-auto px-4 max-w-6xl">
|
||
<h1 className="text-2xl font-bold mb-6">همه محصولات</h1>
|
||
|
||
|
||
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
||
{products.map((product: any) => (
|
||
<ProductCard key={product.id} product={product} />
|
||
))}
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|