From 61940b55f7b455a09c679df5bf26dde1c417cdec Mon Sep 17 00:00:00 2001 From: Hasan Mohammad Fawzi Date: Fri, 2 Oct 2026 01:32:55 +0200 Subject: [PATCH] feature(recipes): add recipe models and mock dataset --- apps/web/src/data/recipes.ts | 587 +++++++++++++++++++++++++++++++++++ apps/web/src/types/recipe.ts | 50 +++ 2 files changed, 637 insertions(+) create mode 100644 apps/web/src/data/recipes.ts create mode 100644 apps/web/src/types/recipe.ts diff --git a/apps/web/src/data/recipes.ts b/apps/web/src/data/recipes.ts new file mode 100644 index 0000000..27d3fd2 --- /dev/null +++ b/apps/web/src/data/recipes.ts @@ -0,0 +1,587 @@ +import type { Recipe, UserSummary } from '../types/recipe'; + +export const currentUser: UserSummary = { + id: 'user-hasan', + name: 'Hasan', +}; + +const emma: UserSummary = { + id: 'user-emma', + name: 'Emma Larsen', +}; + +const yusuf: UserSummary = { + id: 'user-yusuf', + name: 'Yusuf Demir', +}; + +const nora: UserSummary = { + id: 'user-nora', + name: 'Nora Berg', +}; + +export const recipes: Recipe[] = [ + { + id: 'shakshuka', + title: 'Spicy shakshuka with herbs', + description: + 'Eggs poached in a rich tomato sauce with peppers, cumin and fresh herbs.', + category: 'Breakfast', + cuisine: 'Middle Eastern', + difficulty: 'easy', + prepMinutes: 10, + cookMinutes: 25, + servings: 4, + tags: ['vegetarian', 'one-pan', 'breakfast'], + imageUrl: + 'https://images.unsplash.com/photo-1590412200988-a436970781fa?auto=format&fit=crop&w=900&q=80', + author: yusuf, + ingredients: [ + { + id: 'shakshuka-tomatoes', + name: 'Chopped tomatoes', + amount: 800, + unit: 'g', + }, + { + id: 'shakshuka-eggs', + name: 'Eggs', + amount: 4, + unit: 'pcs', + }, + { + id: 'shakshuka-pepper', + name: 'Red pepper', + amount: 1, + unit: 'pc', + }, + ], + instructions: [ + { step: 1, text: 'Cook the pepper until soft.' }, + { step: 2, text: 'Add tomatoes and spices, then simmer.' }, + { step: 3, text: 'Add the eggs and cook until set.' }, + ], + rating: { average: 4.8, count: 126 }, + visibility: 'public', + isSaved: true, + isCreatedByCurrentUser: false, + createdAt: '2026-08-01T10:00:00Z', + updatedAt: '2026-09-10T14:30:00Z', + }, + { + id: 'salmon-pasta', + title: 'Creamy salmon pasta', + description: + 'A quick pasta dinner with salmon, lemon, spinach and a creamy sauce.', + category: 'Dinner', + cuisine: 'European', + difficulty: 'easy', + prepMinutes: 10, + cookMinutes: 20, + servings: 4, + tags: ['pasta', 'seafood', 'quick'], + imageUrl: + 'https://images.unsplash.com/photo-1473093295043-cdd812d0e601?auto=format&fit=crop&w=900&q=80', + author: emma, + ingredients: [ + { + id: 'salmon-pasta-pasta', + name: 'Pasta', + amount: 400, + unit: 'g', + }, + { + id: 'salmon-pasta-salmon', + name: 'Salmon fillet', + amount: 350, + unit: 'g', + }, + { + id: 'salmon-pasta-spinach', + name: 'Spinach', + amount: 100, + unit: 'g', + }, + ], + instructions: [ + { step: 1, text: 'Cook the pasta according to the package.' }, + { step: 2, text: 'Fry the salmon and add cream and spinach.' }, + { step: 3, text: 'Combine with pasta and season with lemon.' }, + ], + rating: { average: 4.6, count: 89 }, + visibility: 'public', + isSaved: false, + isCreatedByCurrentUser: false, + createdAt: '2026-08-04T09:00:00Z', + updatedAt: '2026-08-04T09:00:00Z', + }, + { + id: 'lentil-soup', + title: 'Red lentil soup', + description: + 'A warming and affordable soup with lentils, carrots and mild spices.', + category: 'Soup', + cuisine: 'Turkish', + difficulty: 'easy', + prepMinutes: 10, + cookMinutes: 35, + servings: 6, + tags: ['vegan', 'budget', 'soup'], + imageUrl: + 'https://images.unsplash.com/photo-1547592166-23ac45744acd?auto=format&fit=crop&w=900&q=80', + author: currentUser, + ingredients: [ + { + id: 'lentil-soup-lentils', + name: 'Red lentils', + amount: 300, + unit: 'g', + }, + { + id: 'lentil-soup-carrots', + name: 'Carrots', + amount: 2, + unit: 'pcs', + }, + { + id: 'lentil-soup-stock', + name: 'Vegetable stock', + amount: 1.2, + unit: 'l', + }, + ], + instructions: [ + { step: 1, text: 'Rinse the lentils and chop the vegetables.' }, + { step: 2, text: 'Simmer all ingredients until soft.' }, + { step: 3, text: 'Blend until smooth and adjust seasoning.' }, + ], + rating: { average: 4.5, count: 37 }, + visibility: 'public', + isSaved: false, + isCreatedByCurrentUser: true, + createdAt: '2026-08-08T11:00:00Z', + updatedAt: '2026-09-14T18:00:00Z', + }, + { + id: 'chicken-biryani', + title: 'Chicken biryani', + description: + 'Aromatic rice with marinated chicken, warm spices and caramelized onion.', + category: 'Dinner', + cuisine: 'South Asian', + difficulty: 'hard', + prepMinutes: 30, + cookMinutes: 60, + servings: 6, + tags: ['rice', 'chicken', 'spicy', 'weekend'], + imageUrl: + 'https://images.unsplash.com/photo-1563379926898-05f4575a45d8?auto=format&fit=crop&w=900&q=80', + author: yusuf, + ingredients: [ + { + id: 'biryani-rice', + name: 'Basmati rice', + amount: 500, + unit: 'g', + }, + { + id: 'biryani-chicken', + name: 'Chicken thighs', + amount: 800, + unit: 'g', + }, + { + id: 'biryani-yoghurt', + name: 'Natural yoghurt', + amount: 200, + unit: 'g', + }, + ], + instructions: [ + { step: 1, text: 'Marinate the chicken with yoghurt and spices.' }, + { step: 2, text: 'Partially cook the rice.' }, + { step: 3, text: 'Layer chicken and rice, then steam until done.' }, + ], + rating: { average: 4.9, count: 204 }, + visibility: 'public', + isSaved: true, + isCreatedByCurrentUser: false, + createdAt: '2026-08-12T12:00:00Z', + updatedAt: '2026-09-20T15:00:00Z', + }, + { + id: 'vegetable-tacos', + title: 'Roasted vegetable tacos', + description: + 'Colorful tacos with roasted vegetables, beans and avocado dressing.', + category: 'Dinner', + cuisine: 'Mexican', + difficulty: 'medium', + prepMinutes: 20, + cookMinutes: 25, + servings: 4, + tags: ['vegetarian', 'tacos', 'family'], + imageUrl: + 'https://images.unsplash.com/photo-1551504734-5ee1c4a1479b?auto=format&fit=crop&w=900&q=80', + author: nora, + ingredients: [ + { + id: 'tacos-tortillas', + name: 'Small tortillas', + amount: 8, + unit: 'pcs', + }, + { + id: 'tacos-beans', + name: 'Black beans', + amount: 400, + unit: 'g', + }, + { + id: 'tacos-avocado', + name: 'Avocado', + amount: 2, + unit: 'pcs', + }, + ], + instructions: [ + { step: 1, text: 'Roast the vegetables until golden.' }, + { step: 2, text: 'Warm the beans and tortillas.' }, + { step: 3, text: 'Assemble and serve with avocado dressing.' }, + ], + rating: { average: 4.4, count: 61 }, + visibility: 'public', + isSaved: false, + isCreatedByCurrentUser: false, + createdAt: '2026-08-16T10:00:00Z', + updatedAt: '2026-08-16T10:00:00Z', + }, + { + id: 'norwegian-waffles', + title: 'Norwegian heart waffles', + description: + 'Soft Norwegian waffles served with brown cheese, jam or sour cream.', + category: 'Dessert', + cuisine: 'Norwegian', + difficulty: 'easy', + prepMinutes: 10, + cookMinutes: 20, + servings: 6, + tags: ['waffles', 'dessert', 'norwegian'], + imageUrl: + 'https://images.unsplash.com/photo-1562376552-0d160a2f238d?auto=format&fit=crop&w=900&q=80', + author: emma, + ingredients: [ + { + id: 'waffles-flour', + name: 'Wheat flour', + amount: 400, + unit: 'g', + }, + { + id: 'waffles-milk', + name: 'Milk', + amount: 600, + unit: 'ml', + }, + { + id: 'waffles-eggs', + name: 'Eggs', + amount: 3, + unit: 'pcs', + }, + ], + instructions: [ + { step: 1, text: 'Whisk the ingredients into a smooth batter.' }, + { step: 2, text: 'Let the batter rest for ten minutes.' }, + { step: 3, text: 'Cook in a greased waffle iron.' }, + ], + rating: { average: 4.7, count: 143 }, + visibility: 'public', + isSaved: true, + isCreatedByCurrentUser: false, + createdAt: '2026-08-20T08:30:00Z', + updatedAt: '2026-08-20T08:30:00Z', + }, + { + id: 'sheet-pan-vegetables', + title: + 'Extra colorful sheet-pan vegetables with crispy chickpeas and lemon tahini dressing', + description: + 'A long-title example with roasted seasonal vegetables and chickpeas.', + category: 'Dinner', + cuisine: 'Mediterranean', + difficulty: 'medium', + prepMinutes: 25, + cookMinutes: 40, + servings: 4, + tags: [ + 'vegan', + 'gluten-free', + 'high-protein', + 'meal-prep', + 'vegetables', + 'weeknight', + ], + imageUrl: + 'https://images.unsplash.com/photo-1540420773420-3366772f4999?auto=format&fit=crop&w=900&q=80', + author: nora, + ingredients: [ + { + id: 'sheet-pan-chickpeas', + name: 'Chickpeas', + amount: 400, + unit: 'g', + }, + { + id: 'sheet-pan-vegetables', + name: 'Mixed vegetables', + amount: 800, + unit: 'g', + }, + { + id: 'sheet-pan-tahini', + name: 'Tahini', + amount: 3, + unit: 'tbsp', + }, + ], + instructions: [ + { step: 1, text: 'Cut the vegetables into even pieces.' }, + { step: 2, text: 'Roast vegetables and chickpeas until crisp.' }, + { step: 3, text: 'Serve with lemon tahini dressing.' }, + ], + rating: { average: 4.3, count: 28 }, + visibility: 'public', + isSaved: false, + isCreatedByCurrentUser: false, + createdAt: '2026-08-22T13:00:00Z', + updatedAt: '2026-09-01T12:00:00Z', + }, + { + id: 'tomato-soup', + title: 'Simple tomato soup', + description: + 'A simple tomato soup used to demonstrate a missing recipe image.', + category: 'Soup', + cuisine: 'European', + difficulty: 'easy', + prepMinutes: 5, + cookMinutes: 25, + servings: 4, + tags: ['soup', 'quick', 'vegetarian'], + imageUrl: null, + author: currentUser, + ingredients: [ + { + id: 'tomato-soup-tomatoes', + name: 'Canned tomatoes', + amount: 800, + unit: 'g', + }, + { + id: 'tomato-soup-stock', + name: 'Vegetable stock', + amount: 500, + unit: 'ml', + }, + ], + instructions: [ + { step: 1, text: 'Simmer tomatoes and stock for twenty minutes.' }, + { step: 2, text: 'Blend until smooth and season to taste.' }, + ], + rating: { average: 0, count: 0 }, + visibility: 'private', + isSaved: false, + isCreatedByCurrentUser: true, + createdAt: '2026-08-24T17:00:00Z', + updatedAt: '2026-08-24T17:00:00Z', + }, + { + id: 'falafel-bowl', + title: 'Falafel bowl with hummus', + description: + 'Crispy falafel served with hummus, fresh salad and warm flatbread.', + category: 'Lunch', + cuisine: 'Middle Eastern', + difficulty: 'medium', + prepMinutes: 25, + cookMinutes: 20, + servings: 4, + tags: ['vegetarian', 'lunch', 'protein'], + imageUrl: + 'https://images.unsplash.com/photo-1512621776951-a57141f2eefd?auto=format&fit=crop&w=900&q=80', + author: yusuf, + ingredients: [ + { + id: 'falafel-chickpeas', + name: 'Chickpeas', + amount: 500, + unit: 'g', + }, + { + id: 'falafel-hummus', + name: 'Hummus', + amount: 250, + unit: 'g', + }, + { + id: 'falafel-salad', + name: 'Mixed salad', + amount: 300, + unit: 'g', + }, + ], + instructions: [ + { step: 1, text: 'Shape and cook the falafel.' }, + { step: 2, text: 'Prepare the salad and warm the flatbread.' }, + { step: 3, text: 'Arrange everything in serving bowls.' }, + ], + rating: { average: 4.7, count: 95 }, + visibility: 'public', + isSaved: true, + isCreatedByCurrentUser: false, + createdAt: '2026-08-26T11:30:00Z', + updatedAt: '2026-08-26T11:30:00Z', + }, + { + id: 'apple-cake', + title: 'Norwegian apple cake', + description: + 'A soft cinnamon cake topped with thin apple slices and sugar.', + category: 'Dessert', + cuisine: 'Norwegian', + difficulty: 'medium', + prepMinutes: 20, + cookMinutes: 45, + servings: 8, + tags: ['cake', 'apple', 'baking'], + imageUrl: + 'https://images.unsplash.com/photo-1568571780765-9276ac8b75a2?auto=format&fit=crop&w=900&q=80', + author: currentUser, + ingredients: [ + { + id: 'apple-cake-apples', + name: 'Apples', + amount: 3, + unit: 'pcs', + }, + { + id: 'apple-cake-flour', + name: 'Wheat flour', + amount: 250, + unit: 'g', + }, + { + id: 'apple-cake-butter', + name: 'Butter', + amount: 150, + unit: 'g', + }, + ], + instructions: [ + { step: 1, text: 'Prepare the cake batter.' }, + { step: 2, text: 'Add sliced apples and cinnamon.' }, + { step: 3, text: 'Bake until golden and cooked through.' }, + ], + rating: { average: 4.6, count: 19 }, + visibility: 'public', + isSaved: false, + isCreatedByCurrentUser: true, + createdAt: '2026-08-28T15:00:00Z', + updatedAt: '2026-09-05T16:00:00Z', + }, + { + id: 'thai-green-curry', + title: 'Thai green curry', + description: + 'A fragrant coconut curry with vegetables, basil and green curry paste.', + category: 'Dinner', + cuisine: 'Thai', + difficulty: 'medium', + prepMinutes: 20, + cookMinutes: 30, + servings: 4, + tags: ['curry', 'spicy', 'dairy-free'], + imageUrl: + 'https://images.unsplash.com/photo-1455619452474-d2be8b1e70cd?auto=format&fit=crop&w=900&q=80', + author: nora, + ingredients: [ + { + id: 'thai-curry-coconut', + name: 'Coconut milk', + amount: 400, + unit: 'ml', + }, + { + id: 'thai-curry-paste', + name: 'Green curry paste', + amount: 2, + unit: 'tbsp', + }, + { + id: 'thai-curry-vegetables', + name: 'Mixed vegetables', + amount: 500, + unit: 'g', + }, + ], + instructions: [ + { step: 1, text: 'Fry the curry paste until fragrant.' }, + { step: 2, text: 'Add coconut milk and vegetables.' }, + { step: 3, text: 'Simmer until tender and finish with basil.' }, + ], + rating: { average: 4.5, count: 73 }, + visibility: 'public', + isSaved: false, + isCreatedByCurrentUser: false, + createdAt: '2026-09-01T10:00:00Z', + updatedAt: '2026-09-01T10:00:00Z', + }, + { + id: 'lamb-stew', + title: 'Slow-cooked lamb and vegetable stew', + description: + 'A rich lamb stew developed as a private recipe for future editing.', + category: 'Dinner', + cuisine: 'International', + difficulty: 'hard', + prepMinutes: 30, + cookMinutes: 150, + servings: 6, + tags: ['lamb', 'slow-cooked', 'comfort-food'], + imageUrl: null, + author: currentUser, + ingredients: [ + { + id: 'lamb-stew-lamb', + name: 'Lamb shoulder', + amount: 1, + unit: 'kg', + }, + { + id: 'lamb-stew-potatoes', + name: 'Potatoes', + amount: 600, + unit: 'g', + }, + { + id: 'lamb-stew-carrots', + name: 'Carrots', + amount: 4, + unit: 'pcs', + }, + ], + instructions: [ + { step: 1, text: 'Brown the lamb in batches.' }, + { step: 2, text: 'Add vegetables, stock and seasoning.' }, + { step: 3, text: 'Cook slowly until the lamb is tender.' }, + ], + rating: { average: 0, count: 0 }, + visibility: 'private', + isSaved: false, + isCreatedByCurrentUser: true, + createdAt: '2026-09-03T18:00:00Z', + updatedAt: '2026-09-03T18:00:00Z', + }, +]; diff --git a/apps/web/src/types/recipe.ts b/apps/web/src/types/recipe.ts new file mode 100644 index 0000000..723c7c6 --- /dev/null +++ b/apps/web/src/types/recipe.ts @@ -0,0 +1,50 @@ +export type RecipeVisibility = 'public' | 'private'; + +export type RecipeDifficulty = 'easy' | 'medium' | 'hard'; + +export interface UserSummary { + id: string; + name: string; + avatarUrl?: string; +} + +export interface Ingredient { + id: string; + name: string; + amount: number; + unit: string; + note?: string; +} + +export interface RecipeInstruction { + step: number; + text: string; +} + +export interface RatingSummary { + average: number; + count: number; +} + +export interface Recipe { + id: string; + title: string; + description: string; + category: string; + cuisine: string; + difficulty: RecipeDifficulty; + prepMinutes: number; + cookMinutes: number; + servings: number; + tags: string[]; + imageUrl: string | null; + author: UserSummary; + ingredients: Ingredient[]; + instructions: RecipeInstruction[]; + rating: RatingSummary; + visibility: RecipeVisibility; + isSaved: boolean; + isCreatedByCurrentUser: boolean; + createdAt: string; + updatedAt: string; +}