diff --git a/src/components/ProductModal.jsx b/src/components/ProductModal.jsx index c00180c..1449f01 100644 --- a/src/components/ProductModal.jsx +++ b/src/components/ProductModal.jsx @@ -186,7 +186,7 @@ export function ProductModal({ product, onClose, onSelectRecommendation }) { {description &&

{description}

} - + {size_variants.length > 0 && (
diff --git a/src/components/nutrition/NutritionPanel.jsx b/src/components/nutrition/NutritionPanel.jsx index 3395f24..478334b 100644 --- a/src/components/nutrition/NutritionPanel.jsx +++ b/src/components/nutrition/NutritionPanel.jsx @@ -45,7 +45,21 @@ function ScoreBadge({ label, score }) { ); } -export function NutritionPanel({ brand, imageId, productName }) { +// Categories with no nutrition panel to show, mirroring +// backend/app/services/consumability.py. Kept here so the empty state can say +// WHY it is empty: "we could not find data" and "this is a bar of soap" are +// different facts, and the first reads as a failure the user might retry. +const NON_CONSUMABLE_CATEGORIES = new Set([ + 'hair care', 'skin care', 'skin & bath care', 'bath soap', 'beauty care', + 'oral care', 'fragrance & deodorants', "men's grooming", 'feminine hygiene', + 'personal care', 'detergents & fabric care', 'dishwash', 'household cleaning', + 'household - agarbatti', 'household - lamp oil', 'household - air freshener', + 'personal care - mosquito repellent', 'health care - cold & cough', + 'health care - digestive', 'health care - antiseptic', 'health care - first aid', + 'flowers', +]); + +export function NutritionPanel({ brand, imageId, productName, category }) { const [nutrition, setNutrition] = useState(null); const [loading, setLoading] = useState(false); const [perServing, setPerServing] = useState(false); @@ -80,11 +94,13 @@ export function NutritionPanel({ brand, imageId, productName }) { } if (!nutrition || nutrition.data_status === 'unavailable') { + const notFood = NON_CONSUMABLE_CATEGORIES.has((category || '').trim().toLowerCase()); return (

- Nutrition data unavailable for {productName || 'this product'}. Verified nutrition facts - couldn't be confidently matched from trusted sources yet. + {notFood + ? `Nutrition information doesn't apply to ${productName || 'this product'} — it isn't a food or drink.` + : `Nutrition data unavailable for ${productName || 'this product'}. Verified nutrition facts couldn't be confidently matched from trusted sources yet.`}

);