'use client'; import { Button, message } from 'antd'; import { PlusOutlined } from '@ant-design/icons'; import { useDispatch } from 'react-redux'; import { addToCart } from '@/store/cartSlice'; import { useLanguage } from '@/app/context/LanguageContext'; function toLocaleNumber(n, locale) { return n.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US'); } export default function CatalogSection() { const { t, locale } = useLanguage(); const dispatch = useDispatch(); const currencySuffix = locale === 'fa' ? ' ریال' : ' Rials'; const handleAdd = (item) => { dispatch( addToCart({ id: `catalog-${item.id}`, name: item.name, priceNumeric: item.priceNumeric, priceLabel: `${toLocaleNumber(item.priceNumeric, locale)}${currencySuffix}`, image: item.image, }) ); message.success(t.catalog.addToast(item.name)); }; return (
{t.catalog.eyebrow}

{t.catalog.title}

{t.catalog.subtitle}

{t.catalog.items.map((item) => (
{item.name}
{item.category}

{item.name}

{toLocaleNumber(item.originalPriceNumeric, locale)} {currencySuffix}

{toLocaleNumber(item.priceNumeric, locale)} {currencySuffix}

))}
); }