Add ingredients' products
Some checks failed
Build and Deploy / build-and-push (push) Failing after 1m20s

This commit is contained in:
2026-04-07 22:51:30 +02:00
parent ac32e05c31
commit 868862d031
11 changed files with 576 additions and 57 deletions

View File

@@ -20,6 +20,7 @@ export const CATEGORY_LABELS = {
* @typedef {{ kcal: number, protein: number, fat: number, carbs: number }} NutritionPer100
* @typedef {{ amount: number, label?: string }} PurchasePack
* @typedef {{ id: string, name: string, category: keyof typeof CATEGORY_LABELS, pantryUnit: 'g'|'ml'|'szt', purchasePack?: PurchasePack, nutritionPer100g?: NutritionPer100 }} IngredientDef
* @typedef {{ id: string, ingredientId: string, name: string, brand?: string, packSize: number, packLabel?: string, nutritionPer100g: NutritionPer100 }} ProductDef
*/
/** @type {Record<string, IngredientDef>} */
@@ -59,6 +60,14 @@ export const INGREDIENTS = {
purchasePack: { amount: 250, label: 'opakowanie 250 g' },
nutritionPer100g: { kcal: 174, protein: 11, fat: 13, carbs: 3 },
},
burrata: {
id: 'burrata',
name: 'Burrata',
category: 'nabial',
pantryUnit: 'g',
purchasePack: { amount: 150, label: 'opakowanie 150 g' },
nutritionPer100g: { kcal: 280, protein: 16, fat: 22, carbs: 2 },
},
serek_wiejski: {
id: 'serek_wiejski',
name: 'Serek wiejski',
@@ -339,7 +348,7 @@ export const RECIPES = {
{ ingredientId: 'czosnek', amount: 6, unit: 'g' },
{ ingredientId: 'tymianek', amount: 1, unit: 'g' },
{ ingredientId: 'oliwa', amount: 5, unit: 'ml' },
{ ingredientId: 'ricotta', amount: 75, unit: 'g' },
{ ingredientId: 'ricotta', amount: 75, unit: 'g', alternatives: ['burrata'] },
{ ingredientId: 'bazylia_swieza', amount: 3, unit: 'g' },
{ ingredientId: 'nasiona_slonecznika', amount: 15, unit: 'g' },
],
@@ -448,6 +457,119 @@ export const RECIPES = {
},
};
/* ══════════════════════════════════════════════════════════════════════
* Konkretne produkty — warianty składników generycznych.
* Każdy produkt należy do jednego IngredientDef (przez ingredientId).
* ══════════════════════════════════════════════════════════════════════ */
/** @type {Record<string, ProductDef>} */
export const PRODUCTS = {
/* ── Nabiał ───────────────────────────────────────── */
almette_naturalny: {
id: 'almette_naturalny',
ingredientId: 'serek_smietankowy',
name: 'Almette naturalny',
brand: 'Almette',
packSize: 150,
packLabel: '150 g',
nutritionPer100g: { kcal: 234, protein: 5.5, fat: 22, carbs: 3.5 },
},
philadelphia_original: {
id: 'philadelphia_original',
ingredientId: 'serek_smietankowy',
name: 'Philadelphia Original',
brand: 'Philadelphia',
packSize: 125,
packLabel: '125 g',
nutritionPer100g: { kcal: 235, protein: 5.4, fat: 21.5, carbs: 4.1 },
},
mozzarella_galbani: {
id: 'mozzarella_galbani',
ingredientId: 'mozzarella',
name: 'Galbani Mozzarella',
brand: 'Galbani',
packSize: 125,
packLabel: '125 g',
nutritionPer100g: { kcal: 253, protein: 18.4, fat: 19.1, carbs: 1.6 },
},
ricotta_galbani: {
id: 'ricotta_galbani',
ingredientId: 'ricotta',
name: 'Galbani Ricotta',
brand: 'Galbani',
packSize: 250,
packLabel: '250 g',
nutritionPer100g: { kcal: 138, protein: 10, fat: 10, carbs: 3 },
},
serek_wiejski_piatnica: {
id: 'serek_wiejski_piatnica',
ingredientId: 'serek_wiejski',
name: 'Piątnica Serek wiejski',
brand: 'Piątnica',
packSize: 200,
packLabel: '200 g',
nutritionPer100g: { kcal: 97, protein: 11, fat: 5, carbs: 2 },
},
serek_wiejski_piatnica_wb: {
id: 'serek_wiejski_piatnica_wb',
ingredientId: 'serek_wiejski',
name: 'Piątnica Serek wiejski wysokobiałkowy',
brand: 'Piątnica',
packSize: 200,
packLabel: '200 g',
nutritionPer100g: { kcal: 93, protein: 14, fat: 3, carbs: 2.4 },
},
/* ── Mięso i ryby ─────────────────────────────────── */
burrata_milbona: {
id: 'burrata_milbona',
ingredientId: 'burrata',
name: 'Milbona Burrata',
brand: 'Milbona',
packSize: 125,
packLabel: '125 g',
nutritionPer100g: { kcal: 254, protein: 10, fat: 23, carbs: 1.8 },
},
burrata_gustobello: {
id: 'burrata_gustobello',
ingredientId: 'burrata',
name: 'GustoBello Burrata',
brand: 'GustoBello',
packSize: 100,
packLabel: '100 g',
nutritionPer100g: { kcal: 259, protein: 10, fat: 23, carbs: 2 },
},
/* ── Mięso i ryby ─────────────────────────────────── */
losos_wedzony_suempol: {
id: 'losos_wedzony_suempol',
ingredientId: 'losos_wedzony',
name: 'Suempol Łosoś atlantycki wędzony',
brand: 'Suempol',
packSize: 100,
packLabel: '100 g',
nutritionPer100g: { kcal: 160, protein: 21.5, fat: 8, carbs: 0.5 },
},
/* ── Inne ─────────────────────────────────────────── */
hummus_klasyczny_well_well: {
id: 'hummus_klasyczny_well_well',
ingredientId: 'hummus',
name: 'Well Well Hummus klasyczny',
brand: 'Well Well',
packSize: 200,
packLabel: '200 g',
nutritionPer100g: { kcal: 198, protein: 6.6, fat: 12, carbs: 16 },
},
};
/** @param {string} ingredientId @returns {ProductDef[]} */
export function getProductsForIngredient(ingredientId) {
return Object.values(PRODUCTS).filter(p => p.ingredientId === ingredientId);
}
/** @param {string} ingredientId @returns {boolean} */
export function ingredientHasProducts(ingredientId) {
return Object.values(PRODUCTS).some(p => p.ingredientId === ingredientId);
}
/**
* Krok +/- w spiżarni: całe opakowanie albo domyślny krok (10 g/ml lub 1 szt.).
* @param {string} ingredientId