feat: phase2 - split product names (nameFa/nameEn) across frontend cards, admin panel, search, and cart
This commit is contained in:
1 parent
f66170cc20
commit
4676f3a592
9 files changed
+132
-108
No files matched your search
@@ -26,7 +26,8 @@ export default function Products() {
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
artNo: '',
|
||||
name: '',
|
||||
nameFa: '',
|
||||
nameEn: '',
|
||||
scientificTagline: '',
|
||||
description: '',
|
||||
shortDescription: '',
|
||||
@@ -86,7 +87,8 @@ export default function Products() {
|
||||
setEditingProduct(product);
|
||||
setFormData({
|
||||
artNo: product.artNo,
|
||||
name: product.name,
|
||||
nameFa: product.nameFa || '',
|
||||
nameEn: product.nameEn || '',
|
||||
scientificTagline: product.scientificTagline || '',
|
||||
description: product.description || '',
|
||||
shortDescription: product.shortDescription || '',
|
||||
@@ -107,7 +109,7 @@ export default function Products() {
|
||||
} else {
|
||||
setEditingProduct(null);
|
||||
setFormData({
|
||||
artNo: '', name: '', scientificTagline: '', description: '', shortDescription: '', categoryId: '',
|
||||
artNo: '', nameFa: '', nameEn: '', scientificTagline: '', description: '', shortDescription: '', categoryId: '',
|
||||
priceValue: 0, priceDisplay: '', unit: '', packageSize: 0, dosageLogic: '', suitableFor: 'سگ و گربه',
|
||||
imageUrl: '', metaTitle: '', metaDescription: '', keywords: '', canonicalUrl: '', slug: ''
|
||||
});
|
||||
@@ -214,7 +216,7 @@ export default function Products() {
|
||||
<tr key={product.id} className="hover:bg-gray-50/50 transition-colors">
|
||||
<td className="py-3 px-6">
|
||||
{product.imageUrl ? (
|
||||
<img src={product.imageUrl.startsWith('http') ? product.imageUrl : `${BASE_DOMAIN}${product.imageUrl}`} alt={product.name} className="w-12 h-12 rounded-xl object-cover border border-gray-200" />
|
||||
<img src={product.imageUrl.startsWith('http') ? product.imageUrl : `${BASE_DOMAIN}${product.imageUrl}`} alt={product.nameFa || ''} className="w-12 h-12 rounded-xl object-cover border border-gray-200" />
|
||||
) : (
|
||||
<div className="w-12 h-12 rounded-xl bg-gray-100 flex items-center justify-center text-gray-400">
|
||||
<ImageIcon className="w-5 h-5" />
|
||||
@@ -222,7 +224,12 @@ export default function Products() {
|
||||
)}
|
||||
</td>
|
||||
<td className="py-4 px-6 text-gray-500 font-mono text-sm">{product.artNo}</td>
|
||||
<td className="py-4 px-6 font-bold text-gray-900">{product.name}</td>
|
||||
<td className="py-4 px-6">
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<span className="font-bold text-gray-900" dir="rtl">{product.nameFa || product.name || '-'}</span>
|
||||
{product.nameEn && <span className="text-xs text-gray-400 font-mono" dir="ltr">{product.nameEn}</span>}
|
||||
</div>
|
||||
</td>
|
||||
<td className="py-4 px-6 text-gray-600 text-sm">{product.category?.name || 'بدون دسته'}</td>
|
||||
<td className="py-4 px-6">
|
||||
<div className="flex flex-col">
|
||||
@@ -294,8 +301,12 @@ export default function Products() {
|
||||
<input required type="text" value={formData.artNo} onChange={(e) => setFormData({...formData, artNo: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none font-mono" dir="ltr" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-bold text-gray-700">نام محصول *</label>
|
||||
<input required type="text" value={formData.name} onChange={(e) => setFormData({...formData, name: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none" />
|
||||
<label className="text-sm font-bold text-gray-700">نام فارسی محصول *</label>
|
||||
<input required type="text" value={formData.nameFa} onChange={(e) => setFormData({...formData, nameFa: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none" dir="rtl" placeholder="مثال: ژل دندان میکروسیلور" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-bold text-gray-700">نام انگلیسی / آلمانی (nameEn) *</label>
|
||||
<input required type="text" value={formData.nameEn} onChange={(e) => setFormData({...formData, nameEn: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none font-mono" dir="ltr" placeholder="e.g. Canina Mikrosilber Zahngel - 50ml" />
|
||||
</div>
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
<label className="text-sm font-bold text-gray-700">شعار علمی (Tagline)</label>
|
||||
|
||||
@@ -18,7 +18,9 @@ export async function generateMetadata(
|
||||
// Get raw data for custom fields if we added them (like metaTitle)
|
||||
// Since we don't have local access to raw DB object without modifying productService,
|
||||
// we can just use the mapped product fields for now.
|
||||
const title = product.name.includes("Canina") ? product.name : `${product.name} | برند کانینا آلمان`;
|
||||
const nameFa = product.nameFa || product.name;
|
||||
const nameEn = product.nameEn || "";
|
||||
const title = nameFa.includes("Canina") ? nameFa : `${nameFa} (${nameEn}) | برند کانینا آلمان`;
|
||||
const description = (product.shortDescription || product.description || '').substring(0, 150).trim();
|
||||
const keywords = (product as any).keywords ? (product as any).keywords.split(',') : product.main_ingredients;
|
||||
|
||||
@@ -51,7 +53,7 @@ export default async function ShopProductPage({ params }: { params: Promise<{ sl
|
||||
const jsonLd = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Product',
|
||||
name: product.name,
|
||||
name: product.nameFa || product.name,
|
||||
image: product.image,
|
||||
description: product.shortDescription || product.description,
|
||||
sku: product.artNo,
|
||||
|
||||
@@ -134,7 +134,16 @@ const ArchiveProductCard: React.FC<{ product: Product, onClick: (p: Product) =>
|
||||
|
||||
<div className="p-6 flex flex-col flex-1">
|
||||
<div className="text-[10px] font-bold text-canina-blue uppercase tracking-widest mb-2">{product.category}</div>
|
||||
<h3 dir="ltr" className="text-lg font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors mb-3 leading-tight text-left">{product.name}</h3>
|
||||
<div className="flex flex-col gap-1 mb-3">
|
||||
<h3 dir="rtl" className="text-base font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors leading-tight text-right font-vazir">
|
||||
{product.nameFa || product.name}
|
||||
</h3>
|
||||
{product.nameEn && (
|
||||
<span dir="ltr" className="text-[11px] font-bold text-slate-400 font-sans text-left block">
|
||||
{product.nameEn}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-wrap gap-1 mb-6">
|
||||
{product.symptoms.slice(0, 2).map((s, i) => (
|
||||
|
||||
@@ -103,10 +103,10 @@ export default function CartDrawer({ isOpen, onClose, onCheckout, onShopNavigate
|
||||
{items.map((item) => (
|
||||
<div key={item.product.id} className="flex gap-4 p-4 bg-medical-gray-50 rounded-3xl border border-medical-gray-100 group">
|
||||
<div className="w-20 h-20 bg-white rounded-2xl p-2 flex-shrink-0 flex items-center justify-center shadow-sm">
|
||||
<SafeImage src={item.product.image} alt={item.product.name} className="w-full h-full" imgClassName="object-contain" />
|
||||
<SafeImage src={item.product.image} alt={item.product.nameFa || item.product.name} className="w-full h-full" imgClassName="object-contain" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h4 className="text-sm font-black text-medical-gray-900 truncate mb-1">{item.product.name}</h4>
|
||||
<h4 className="text-sm font-black text-medical-gray-900 truncate mb-1">{item.product.nameFa || item.product.name}</h4>
|
||||
<p className="text-[10px] text-canina-blue font-bold mb-3">{item.product.category}</p>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2 bg-white rounded-lg border border-medical-gray-200 p-1">
|
||||
|
||||
@@ -3,178 +3,169 @@ import { useState, useEffect, useMemo } from "react";
|
||||
import { Product } from "../lib/data/products";
|
||||
import { usePetStore } from "../lib/store/usePetStore";
|
||||
import { productService } from "../lib/services/productService";
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import { Eye, ShoppingCart, ShieldCheck, Heart, AlertCircle, Sparkles } from "lucide-react";
|
||||
import { motion } from "motion/react";
|
||||
import { Eye, ShoppingCart, Heart, AlertCircle, Sparkles } from "lucide-react";
|
||||
import SafeImage from "./SafeImage";
|
||||
import { ProductCardSkeleton } from "./Skeleton";
|
||||
import Link from 'next/link';
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
|
||||
import { useCartStore } from "../lib/store/cartStore";
|
||||
import { toast } from "sonner";
|
||||
|
||||
function ProductCard({ product, onClick }: { product: Product; key?: string | number; onClick: (p: Product) => void }) {
|
||||
function ProductCard({ product }: { product: Product }) {
|
||||
const router = useRouter();
|
||||
const getText = useSettingsStore(state => state.getText);
|
||||
const getText = useSettingsStore((state) => state.getText);
|
||||
const { getActivePet } = usePetStore();
|
||||
const activePet = getActivePet();
|
||||
const { addItem } = useCartStore();
|
||||
|
||||
const nameFa = product.nameFa || product.name;
|
||||
const nameEn = product.nameEn || "";
|
||||
|
||||
const compatibility = useMemo(() => {
|
||||
if (!activePet) return null;
|
||||
const sameSpecies = product.suitableFor === activePet.type || product.suitableFor === "هر دو";
|
||||
const helpsSymptom = (activePet.medicalConditions || []).some(s => product.symptoms.includes(s));
|
||||
if (!sameSpecies) return { type: 'alert', text: `مخصوص ${product.suitableFor}` };
|
||||
if (helpsSymptom) return { type: 'success', text: `توصیه شده برای ${activePet.name}` };
|
||||
return { type: 'neutral', text: `مناسب برای ${activePet.name}` };
|
||||
const helpsSymptom = (activePet.medicalConditions || []).some((s) => product.symptoms.includes(s));
|
||||
if (!sameSpecies) return { type: "alert", text: `مخصوص ${product.suitableFor}` };
|
||||
if (helpsSymptom) return { type: "success", text: `توصیه شده برای ${activePet.name}` };
|
||||
return { type: "neutral", text: `مناسب برای ${activePet.name}` };
|
||||
}, [product, activePet]);
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 30 }}
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true }}
|
||||
transition={{ duration: 0.5 }}
|
||||
className="group bg-white rounded-3xl border border-medical-gray-200 overflow-hidden hover:shadow-2xl hover:shadow-canina-blue/10 transition-all duration-500 flex flex-col h-full cursor-pointer relative"
|
||||
transition={{ duration: 0.45 }}
|
||||
className="group bg-white rounded-3xl border border-medical-gray-200 overflow-hidden hover:shadow-2xl hover:shadow-canina-blue/10 transition-all duration-500 flex flex-col cursor-pointer relative"
|
||||
>
|
||||
{/* Independent Category Tag at the absolute top-right of the card */}
|
||||
{/* Category Badge */}
|
||||
<div className="absolute top-4 right-4 z-30 px-3 py-1 bg-white/95 backdrop-blur-md rounded-full border border-medical-gray-200 text-[10px] font-bold text-medical-gray-600 uppercase tracking-widest shadow-sm">
|
||||
{product.category}
|
||||
</div>
|
||||
|
||||
{/* Compatibility Tag */}
|
||||
{compatibility && (
|
||||
<div className={`absolute top-16 right-4 z-10 text-[8px] font-black uppercase tracking-widest px-3 py-1 rounded-full shadow-md flex items-center gap-1 ${
|
||||
compatibility.type === 'alert' ? 'bg-amber-100 text-amber-700' :
|
||||
compatibility.type === 'success' ? 'bg-green-100 text-green-700' : 'bg-medical-gray-100 text-medical-gray-600'
|
||||
<div className={`absolute top-[3.25rem] right-4 z-10 text-[8px] font-black uppercase tracking-widest px-3 py-1 rounded-full shadow-md flex items-center gap-1 ${
|
||||
compatibility.type === "alert" ? "bg-amber-100 text-amber-700" :
|
||||
compatibility.type === "success" ? "bg-green-100 text-green-700" : "bg-medical-gray-100 text-medical-gray-600"
|
||||
}`}>
|
||||
{compatibility.type === 'alert' ? <AlertCircle className="w-2.5 h-2.5" /> : compatibility.type === 'success' ? <Heart className="w-2.5 h-2.5" /> : <Sparkles className="w-2.5 h-2.5" />}
|
||||
{compatibility.type === "alert" ? <AlertCircle className="w-2.5 h-2.5" /> : compatibility.type === "success" ? <Heart className="w-2.5 h-2.5" /> : <Sparkles className="w-2.5 h-2.5" />}
|
||||
{compatibility.text}
|
||||
</div>
|
||||
)}
|
||||
{/* Product Image Area */}
|
||||
<div className="relative aspect-square bg-medical-gray-50 p-4 flex items-center justify-center overflow-hidden">
|
||||
<SafeImage
|
||||
src={product.image}
|
||||
alt={product.name}
|
||||
className="w-full h-full group-hover:scale-105 transition-transform duration-500"
|
||||
imgClassName="object-contain"
|
||||
/>
|
||||
|
||||
{/* Main PDP Link */}
|
||||
<Link href={`/shop/${product.slug || product.id}`} className="absolute inset-0 z-10" />
|
||||
|
||||
{/* Hover Actions (z-20 to be clickable over the main PDP link) */}
|
||||
{/* Image */}
|
||||
<div className="relative aspect-[4/3] bg-medical-gray-50 flex items-center justify-center overflow-hidden p-5">
|
||||
<SafeImage
|
||||
src={product.image}
|
||||
alt={nameFa}
|
||||
className="w-full h-full group-hover:scale-105 transition-transform duration-500"
|
||||
imgClassName="object-contain max-h-[170px] mx-auto"
|
||||
/>
|
||||
{/* PDP Link overlay */}
|
||||
<Link href={`/shop/${product.slug || product.id}`} className="absolute inset-0 z-10" />
|
||||
{/* Hover Actions */}
|
||||
<div className="absolute inset-0 bg-canina-blue/60 opacity-0 group-hover:opacity-100 backdrop-blur-sm transition-all duration-300 flex items-center justify-center gap-4 z-20">
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
router.push(`/shop/${product.slug || product.id}`);
|
||||
}}
|
||||
className="w-12 h-12 rounded-full bg-white text-canina-blue flex items-center justify-center hover:scale-110 transition-transform shadow-lg cursor-pointer"
|
||||
<div
|
||||
onClick={(e) => { e.stopPropagation(); router.push(`/shop/${product.slug || product.id}`); }}
|
||||
className="w-11 h-11 rounded-full bg-white text-canina-blue flex items-center justify-center hover:scale-110 transition-transform shadow-lg cursor-pointer"
|
||||
>
|
||||
<Eye className="w-5 h-5" />
|
||||
</div>
|
||||
<div
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
addItem(product, 1);
|
||||
toast.success(`${product.name} به سبد خرید شما اضافه شد.`);
|
||||
toast.success(`${nameFa} به سبد خرید اضافه شد.`);
|
||||
}}
|
||||
className="w-12 h-12 rounded-full bg-canina-blue text-white flex items-center justify-center hover:scale-110 transition-transform shadow-lg border border-white/20 cursor-pointer"
|
||||
className="w-11 h-11 rounded-full bg-canina-blue text-white flex items-center justify-center hover:scale-110 transition-transform shadow-lg border border-white/20 cursor-pointer"
|
||||
>
|
||||
<ShoppingCart className="w-5 h-5" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Content Area */}
|
||||
<Link href={`/shop/${product.slug || product.id}`} className="p-8 flex flex-col flex-1 block text-right">
|
||||
<div className="mb-3">
|
||||
<h3 dir="ltr" className="text-base md:text-lg font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors leading-normal text-left line-clamp-2 min-h-[3.5rem] w-full">
|
||||
{product.name}
|
||||
{/* Content */}
|
||||
<Link href={`/shop/${product.slug || product.id}`} className="px-5 py-4 flex flex-col flex-1 gap-3">
|
||||
{/* Dual-language Name */}
|
||||
<div className="flex flex-col gap-1">
|
||||
<h3 dir="rtl" className="text-[14px] font-black text-medical-gray-900 group-hover:text-canina-blue transition-colors leading-snug text-right line-clamp-2 font-vazir">
|
||||
{nameFa}
|
||||
</h3>
|
||||
{nameEn && (
|
||||
<span dir="ltr" className="text-[11px] font-semibold text-slate-400 font-sans text-left block line-clamp-1">
|
||||
{nameEn}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<p className="text-sm text-medical-gray-500 leading-relaxed mb-6 line-clamp-3 min-h-[4.5rem]">
|
||||
|
||||
{/* Short description */}
|
||||
<p className="text-xs text-medical-gray-500 leading-relaxed line-clamp-2 flex-1">
|
||||
{product.shortDescription || product.description}
|
||||
</p>
|
||||
|
||||
<div className="space-y-4 pt-4 border-t border-medical-gray-100 mt-auto">
|
||||
{product.benefits && (
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-1.5 h-1.5 rounded-full bg-canina-blue" />
|
||||
<span className="text-xs font-semibold text-medical-gray-700 italic">{product.benefits}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="text-lg font-black text-medical-gray-900 font-vazir whitespace-nowrap">{product.price}</div>
|
||||
<span className="text-xs font-black text-canina-blue uppercase tracking-widest border-b-2 border-canina-blue pb-1 hover:text-medical-gray-900 hover:border-medical-gray-900 transition-all whitespace-nowrap">
|
||||
{getText('product_view_details', "مشاهده جزئیات")}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Footer: Price + CTA */}
|
||||
<div className="flex items-center justify-between pt-3 border-t border-medical-gray-100">
|
||||
<div className="text-base font-black text-medical-gray-900 font-vazir whitespace-nowrap">{product.price}</div>
|
||||
<span className="text-[11px] font-black text-canina-blue uppercase tracking-widest border-b-2 border-canina-blue pb-0.5 hover:text-medical-gray-900 hover:border-medical-gray-900 transition-all whitespace-nowrap">
|
||||
{getText("product_view_details", "مشاهده جزئیات")}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
</motion.div>
|
||||
);
|
||||
}
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
export default function FeaturedProducts() {
|
||||
const router = useRouter();
|
||||
const getText = useSettingsStore(state => state.getText);
|
||||
const getText = useSettingsStore((state) => state.getText);
|
||||
const [products, setProducts] = useState<Product[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchFeatured = async () => {
|
||||
try {
|
||||
const data = await productService.getFeaturedProducts();
|
||||
setProducts(data);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch featured products:", error);
|
||||
toast.error("خطا در دریافت لیست محصولات از سرور. لطفاً صفحه را رفرش کنید.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
fetchFeatured();
|
||||
productService.getFeaturedProducts()
|
||||
.then(setProducts)
|
||||
.catch(() => toast.error("خطا در دریافت لیست محصولات از سرور."))
|
||||
.finally(() => setIsLoading(false));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<section className="py-16 bg-medical-gray-50">
|
||||
<div className="max-w-7xl mx-auto px-4">
|
||||
{/* Header - Correct RTL alignment with primary and secondary elements */}
|
||||
<div className="flex items-center justify-between w-full mb-12 pb-6 border-b border-medical-gray-200">
|
||||
<div>
|
||||
<div className="text-canina-blue text-xs font-bold uppercase tracking-[0.2em] mb-2 font-vazir">{getText('featured_badge', "بیشترین انتخاب توسط دامپزشکان")}</div>
|
||||
<div className="text-canina-blue text-xs font-bold uppercase tracking-[0.2em] mb-2 font-vazir">
|
||||
{getText("featured_badge", "بیشترین انتخاب توسط دامپزشکان")}
|
||||
</div>
|
||||
<h2 className="text-2xl md:text-3xl lg:text-4xl font-black text-medical-gray-900 font-lalezar tracking-wide">
|
||||
{getText('featured_title_line1', "محصولات برگزیده و راهکارهای")} <span className="text-canina-blue">{getText('featured_title_line2', "درمان تخصصی")}</span>
|
||||
{getText("featured_title_line1", "محصولات برگزیده و راهکارهای")}{" "}
|
||||
<span className="text-canina-blue">{getText("featured_title_line2", "درمان تخصصی")}</span>
|
||||
</h2>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => router.push('/shop')}
|
||||
<button
|
||||
onClick={() => router.push("/shop")}
|
||||
className="inline-flex items-center gap-2 text-canina-blue font-black text-sm hover:translate-x-1 transition-all group font-vazir"
|
||||
>
|
||||
{getText('featured_view_all', "مشاهده تمامی محصولات")}
|
||||
{getText("featured_view_all", "مشاهده تمامی محصولات")}
|
||||
<span className="text-lg group-hover:-translate-x-1 transition-transform">←</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-10">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
{isLoading ? (
|
||||
Array.from({ length: 4 }).map((_, i) => <ProductCardSkeleton key={i} />)
|
||||
Array.from({ length: 4 }).map((_, i) => <ProductCardSkeleton key={i} />)
|
||||
) : products.length > 0 ? (
|
||||
products.map((p) => (
|
||||
<ProductCard key={p.id} onClick={(p) => router.push(`/shop/${p.slug || p.id}`)} product={p} />
|
||||
))
|
||||
products.map((p) => <ProductCard key={p.id} product={p} />)
|
||||
) : (
|
||||
<div className="col-span-full py-16 px-8 flex flex-col items-center justify-center text-center bg-white rounded-[2.5rem] border border-medical-gray-200 shadow-xl max-w-lg mx-auto">
|
||||
<AlertCircle className="w-12 h-12 text-canina-teal mb-4" />
|
||||
<h3 className="text-xl font-black text-medical-gray-900 mb-2 font-vazir">{getText('featured_no_products_title', "هیچ محصولی یافت نشد")}</h3>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 mb-2 font-vazir">
|
||||
{getText("featured_no_products_title", "هیچ محصولی یافت نشد")}
|
||||
</h3>
|
||||
<p className="text-sm text-medical-gray-500 font-medium font-vazir leading-relaxed">
|
||||
{getText('featured_no_products_desc', "در حال حاضر هیچ محصول برجستهای برای نمایش وجود ندارد. لطفاً در پنل ادمین محصولات برگزیده را تنظیم کنید.")}
|
||||
{getText("featured_no_products_desc", "در حال حاضر هیچ محصول برجستهای برای نمایش وجود ندارد.")}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -242,9 +242,16 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<h1 dir="ltr" className="text-2xl md:text-3xl lg:text-4xl font-black text-medical-gray-900 leading-tight mb-4 italic font-sans text-left">
|
||||
{product.name}
|
||||
</h1>
|
||||
<div className="flex flex-col gap-2 mb-4">
|
||||
<h1 dir="rtl" className="text-2xl md:text-3xl lg:text-4xl font-black text-medical-gray-900 leading-tight font-vazir text-right">
|
||||
{product.nameFa || product.name}
|
||||
</h1>
|
||||
{product.nameEn && (
|
||||
<h2 dir="ltr" className="text-base md:text-lg text-slate-400 font-bold italic font-sans text-left">
|
||||
{product.nameEn}
|
||||
</h2>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xl text-canina-blue font-bold italic opacity-70 leading-relaxed max-w-2xl font-vazir mb-6 text-right" dir="rtl">
|
||||
{isMounted && pets.length > 0 ? (
|
||||
product.optimisticTemplate?.replace("[PetName]", activePet?.name || "").replace("[OnSet]", product.onSetOfAction || "به زودی")
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function SearchResultsPage({ query }: { query: string }) {
|
||||
<div className="relative aspect-square mb-8 bg-medical-gray-50 rounded-[2rem] overflow-hidden p-6 flex items-center justify-center">
|
||||
<img
|
||||
src={product.image}
|
||||
alt={product.name}
|
||||
alt={product.nameFa || product.name}
|
||||
className="w-full h-full object-contain group-hover:scale-110 transition-transform duration-500"
|
||||
referrerPolicy="no-referrer"
|
||||
/>
|
||||
@@ -92,7 +92,7 @@ export default function SearchResultsPage({ query }: { query: string }) {
|
||||
|
||||
<div className="flex-1">
|
||||
<span className="text-[10px] font-black text-canina-blue uppercase tracking-widest mb-2 block">{product.category}</span>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 mb-2 leading-tight group-hover:text-canina-blue transition-colors">{product.name}</h3>
|
||||
<h3 className="text-xl font-black text-medical-gray-900 mb-2 leading-tight group-hover:text-canina-blue transition-colors">{product.nameFa || product.name}</h3>
|
||||
<p className="text-xs text-medical-gray-400 line-clamp-2 leading-relaxed mb-6">{product.benefits}</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ export interface Product {
|
||||
slug?: string;
|
||||
artNo: string;
|
||||
name: string;
|
||||
nameFa?: string;
|
||||
nameEn?: string;
|
||||
scientificTagline: string;
|
||||
description: string;
|
||||
shortDescription?: string;
|
||||
|
||||
@@ -42,7 +42,9 @@ export class ProductService {
|
||||
return {
|
||||
id: data.id,
|
||||
artNo: data.artNo,
|
||||
name: data.name,
|
||||
name: data.nameFa || data.name || '',
|
||||
nameFa: data.nameFa || data.name || '',
|
||||
nameEn: data.nameEn || '',
|
||||
scientificTagline: data.scientificTagline,
|
||||
description: data.description,
|
||||
shortDescription: data.shortDescription || '',
|
||||
|
||||
Reference in new issue
Block a user