Files
parsshop/app/products/page.tsx
2026-03-30 22:35:43 +03:30

32 lines
859 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 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 p-4">
<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>
);
}