- {filteredAnalysis.map(([key, value]) => (
-
-
{key}
-
{toPersian(value)}
-
- ))}
+
+ {/* Ingredients Pills */}
+ {product.main_ingredients && product.main_ingredients.length > 0 && (
+
+
مواد تشکیلدهنده برتر
+
+ {product.main_ingredients.map((ing, idx) => {
+ const termKey = termKeys.find(key => {
+ const termObj = scientificTerms[key] || SCIENTIFIC_TERMS[key];
+ const termName = termObj?.term || key;
+ const ingClean = ing.toLowerCase();
+ const keyClean = key.toLowerCase();
+ const termNameClean = termName.toLowerCase();
+ return ingClean.includes(keyClean) ||
+ keyClean.includes(ingClean) ||
+ ingClean.includes(termNameClean) ||
+ termNameClean.includes(ingClean);
+ });
+ return (
+
+
+ {termKey ? (
+ router.push(`/wiki?term=${id}`)}>
+ {ing}
+
+ ) : ing}
+
+
+
+ );
+ })}
- );
- })()}
-
-
+ )}
+
+ {/* Quantitative Analysis Cards (Responsive layout fitting 1 or multiple items naturally) */}
+ {(() => {
+ const filteredAnalysis = Object.entries(product.analysis || {}).filter(([key, val]) => {
+ const cleanKey = key.toLowerCase();
+ // Don't show duplicate ingredients here if already listed above
+ if (cleanKey.includes('مواد') || cleanKey.includes('ترکیبات') || cleanKey.includes('ingredient')) return false;
+ return Boolean(val);
+ });
+
+ if (filteredAnalysis.length === 0) return null;
+
+ return (
+
+
جدول آنالیز و آنالیتیکال ترکیبات
+
+ {filteredAnalysis.map(([key, value]) => (
+
+ {key}
+ {toPersian(value)}
+
+ ))}
+
+
+ );
+ })()}
+
+
+ )}
{/* Feeding / Usage Instructions Section (Merged and enriched) */}