pagination/filter product api

This commit is contained in:
haniyeroozmand
2026-04-02 21:13:40 +03:30
parent a2de32dfad
commit 5504e20948
9 changed files with 296 additions and 27 deletions

View File

@@ -9,9 +9,7 @@ interface PageProps {
}
export default async function SingleProductPage({ params }: PageProps) {
// --------------------------------------------------------
// ۱. منطق دریافت داده‌ها (دقیقا مشابه درخواست شما)
// --------------------------------------------------------
const resolvedParams = await params;
const slug = resolvedParams.slug;
@@ -28,10 +26,7 @@ export default async function SingleProductPage({ params }: PageProps) {
return notFound();
}
// --------------------------------------------------------
// ۲. آماده‌سازی و مپ کردن داده‌های API برای UI
// --------------------------------------------------------
// فرمت کردن قیمت
const formattedPrice = product.display_price
? product.display_price.toLocaleString('fa-IR')
@@ -49,12 +44,10 @@ export default async function SingleProductPage({ params }: PageProps) {
return attr ? attr.valueText : "-";
};
// --------------------------------------------------------
// ۳. خروجی UI (بدون تغییر در ساختار و استایل‌ها)
// --------------------------------------------------------
return (
<div className="bg-[#f8f9fc] min-h-screen py-8" dir="rtl">
<div className="mx-auto px-4 lg:px-8 container max-w-7xl">
<div className="mx-auto px-4 lg:px-8 container max-w-6xl">
<ScrollToTop />
{/* مسیر راهنما */}