feat(products): add product gallery, image zoom lightbox, clean duplicate analysis/usage sections and style catalog button
Deploy Canina / deploy (push) Successful in 1m47s
Deploy Canina / deploy (push) Successful in 1m47s
This commit is contained in:
1 parent
43f59813b6
commit
4cbde63b89
6 files changed
+343
-200
No files matched your search
@@ -60,6 +60,7 @@ export interface Product {
|
||||
feedingAdvice: string;
|
||||
specialist: Specialist;
|
||||
image: string;
|
||||
images?: string[];
|
||||
relatedProducts?: string[];
|
||||
faqs?: FAQ[];
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ interface BackendProduct {
|
||||
slug?: string;
|
||||
imageUrl?: string;
|
||||
image?: string;
|
||||
images?: string[];
|
||||
productGroup?: string;
|
||||
ingredientList?: Array<{ ingredient: string }>;
|
||||
ingredients?: string;
|
||||
@@ -129,6 +130,14 @@ export class ProductService {
|
||||
if (data.imageUrl.startsWith('/products/')) return local?.image || '/assets/images/hero-section-image.png';
|
||||
return local?.image || data.imageUrl || '/assets/images/hero-section-image.png';
|
||||
})(),
|
||||
images: Array.isArray(data.images) && data.images.length > 0
|
||||
? data.images.map((img: string) => {
|
||||
const apiBase = (process.env.NEXT_PUBLIC_API_URL || '').replace(/\/api$/, '');
|
||||
if (img.startsWith('http://') || img.startsWith('https://')) return img;
|
||||
if (img.startsWith('/uploads/')) return `${apiBase}${img}`;
|
||||
return img;
|
||||
})
|
||||
: (local?.images || []),
|
||||
|
||||
main_ingredients: data.ingredientList?.map(i => i.ingredient) || data.ingredients?.split(/[،,-]/).map(s => s.trim()).filter(Boolean) || [],
|
||||
symptoms: data.symptoms?.map(s => typeof s === 'string' ? s : s.symptom || '').filter(Boolean) || [],
|
||||
|
||||
Reference in new issue
Block a user