Skip to content

Commit 218a63f

Browse files
committed
[WIP]
1 parent 6d8122f commit 218a63f

File tree

6 files changed

+90
-49
lines changed

6 files changed

+90
-49
lines changed

frontend/src/App.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import { createSignal } from 'solid-js';
22

33
import TopBar from './components/TopBar';
44
import DrawerMenu from './components/DrawerMenu';
5+
import { RecipeProvider } from './contexts/RecipeContext';
56

67
function App(props) {
78
const [menuOpen, setMenuOpen] = createSignal(false);
89

910
return (
10-
<div>
11+
<RecipeProvider>
1112
<header>
1213
<TopBar menuOpen={menuOpen} setMenuOpen={setMenuOpen} />
1314
<DrawerMenu menuOpen={menuOpen} setMenuOpen={setMenuOpen} />
@@ -17,7 +18,7 @@ function App(props) {
1718
</main>
1819
<footer>
1920
</footer>
20-
</div>
21+
</RecipeProvider>
2122
);
2223
}
2324

frontend/src/assets/dummy-data.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const chicken_korma = {
2+
title: 'Chicken Korma',
3+
author: 'Izzah',
4+
description: 'Looking for a Chicken Korma recipe that’s the real deal? This one-pot chicken korma is made in the Pakistani and North Indian way but without the fuss. All the mind-blowing flavor of korma – yet ready in much less time. After making & testing this korma for years, I’ve perfected it to the point that I can confidently call it the BEST chicken korma.',
5+
source_url: 'https://www.teaforturmeric.com/authentic-chicken-korma/',
6+
servings: 6,
7+
prep_time: 15,
8+
cook_time: 45,
9+
ingredients: [
10+
'1/3 cup neutral oil',
11+
'2 tbsp ghee, or sub more oil',
12+
'2 (~500 g) large onions, sliced*',
13+
'2 lbs bone-in, cut up, skinless chicken (or sub chicken thighs), cleaned and excess skin removed',
14+
'2 bay leaves',
15+
'1 tsp cumin seeds',
16+
'1/8 tsp whole black peppercorns',
17+
'3 green cardamom pods',
18+
'5 whole cloves',
19+
'1 1-inch cinnamon stick',
20+
'8-10 cloves garlic, crushed',
21+
'1 inch piece ginger, crushed',
22+
'2 small tomatoes* (optional), quartered',
23+
'3/4 cup plain, whole-milk yogurt',
24+
'2 tsp coriander powder',
25+
'1 tsp cumin powder',
26+
'1 tsp red chili powder or to taste',
27+
'1/2 tsp turmeric powder',
28+
'1/2 tsp paprika powder or Kashmiri red chili powder, optional – for color',
29+
'2 1/8 tsp salt, or to taste depending on amount of chicken',
30+
'2-3 green chili peppers, chopped',
31+
'1-2 black cardamom pods (optional)',
32+
'1 piece whole mace, or sub pinch ground mace or cinnamon',
33+
'½ tsp garam masala',
34+
'pinch nutmeg powder',
35+
'1/2 tsp diluted kewra essence, or sub rose water',
36+
'1/4 cup cilantro leaves, chopped, optional – for garnish',
37+
'10-12 blanched almonds, for garnish',
38+
],
39+
instructions: [
40+
'Heat a large, heavy-bottomed pan over high heat. Once hot, add the oil and onions and sauté the onions until they are golden brown (~20-25 minutes depending on quantity). Remove the onions from the pan and transfer them to a food processor. Add tomatoes (if using) and yogurt to the food processor and process until mostly smooth.',
41+
'In the same pan used to brown onions, heat ghee (or oil) and add the whole spices, garlic, and ginger. Sauté for 30 seconds or until the garlic and ginger begin to darken. Add the chicken and fry it until it changes color (~5 minutes).',
42+
'Add the yogurt mixture to chicken along with the ground spices, salt, and green chili peppers and sauté until the mixture comes to a light simmer (~2-3 minutes).',
43+
'Lower the heat to medium-low, cover, and allow it to cook for 15 minutes. Uncover and stir in the black cardamom (if using), mace, garam masala, and nutmeg powder. Cover and cook again for 10 minutes.',
44+
'Raise the heat to high. Add 1/2 to 3/4 cup of water (depending on how thin you\'d like the curry) and bring to a boil. Lower the heat and allow chicken to simmer for another 2-3 minutes. The oil will have risen to the top. Sprinkle the kewra essence and stir. Turn off the heat and garnish with cilantro and blanched almonds.',
45+
],
46+
};
47+
48+
export { chicken_korma };
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { createContext, useContext } from 'solid-js';
2+
3+
import { recipeStore } from '../stores/RecipeStore';
4+
5+
const RecipeContext = createContext();
6+
7+
function RecipeProvider(props) {
8+
return (
9+
<RecipeContext.Provider
10+
value={{
11+
recipeStore,
12+
}}
13+
>
14+
{props.children}
15+
</RecipeContext.Provider>
16+
);
17+
}
18+
19+
function useRecipeContext() {
20+
return useContext(RecipeContext);
21+
}
22+
23+
export { RecipeProvider, useRecipeContext };

frontend/src/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { render } from 'solid-js/web';
77
import { Router, Route } from '@solidjs/router';
88

9-
// NOTE: Ordered so local styles will override global styles.
9+
// Local styles will override global styles.
1010
import 'beercss';
1111
import './index.css';
1212

frontend/src/pages/Recipe.jsx

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,10 @@
11
import './Recipe.css';
22

3+
import { useRecipeContext } from '../contexts/RecipeContext';
4+
35
function Recipe() {
4-
const recipe = {
5-
title: 'Chicken Korma',
6-
author: 'Izzah',
7-
description: 'Looking for a Chicken Korma recipe that’s the real deal? This one-pot chicken korma is made in the Pakistani and North Indian way but without the fuss. All the mind-blowing flavor of korma – yet ready in much less time. After making & testing this korma for years, I’ve perfected it to the point that I can confidently call it the BEST chicken korma.',
8-
source_url: 'https://www.teaforturmeric.com/authentic-chicken-korma/',
9-
servings: 6,
10-
prep_time: 15,
11-
cook_time: 45,
12-
ingredients: [
13-
'1/3 cup neutral oil',
14-
'2 tbsp ghee, or sub more oil',
15-
'2 (~500 g) large onions, sliced*',
16-
'2 lbs bone-in, cut up, skinless chicken (or sub chicken thighs), cleaned and excess skin removed',
17-
'2 bay leaves',
18-
'1 tsp cumin seeds',
19-
'1/8 tsp whole black peppercorns',
20-
'3 green cardamom pods',
21-
'5 whole cloves',
22-
'1 1-inch cinnamon stick',
23-
'8-10 cloves garlic, crushed',
24-
'1 inch piece ginger, crushed',
25-
'2 small tomatoes* (optional), quartered',
26-
'3/4 cup plain, whole-milk yogurt',
27-
'2 tsp coriander powder',
28-
'1 tsp cumin powder',
29-
'1 tsp red chili powder or to taste',
30-
'1/2 tsp turmeric powder',
31-
'1/2 tsp paprika powder or Kashmiri red chili powder, optional – for color',
32-
'2 1/8 tsp salt, or to taste depending on amount of chicken',
33-
'2-3 green chili peppers, chopped',
34-
'1-2 black cardamom pods (optional)',
35-
'1 piece whole mace, or sub pinch ground mace or cinnamon',
36-
'½ tsp garam masala',
37-
'pinch nutmeg powder',
38-
'1/2 tsp diluted kewra essence, or sub rose water',
39-
'1/4 cup cilantro leaves, chopped, optional – for garnish',
40-
'10-12 blanched almonds, for garnish',
41-
],
42-
instructions: [
43-
'Heat a large, heavy-bottomed pan over high heat. Once hot, add the oil and onions and sauté the onions until they are golden brown (~20-25 minutes depending on quantity). Remove the onions from the pan and transfer them to a food processor. Add tomatoes (if using) and yogurt to the food processor and process until mostly smooth.',
44-
'In the same pan used to brown onions, heat ghee (or oil) and add the whole spices, garlic, and ginger. Sauté for 30 seconds or until the garlic and ginger begin to darken. Add the chicken and fry it until it changes color (~5 minutes).',
45-
'Add the yogurt mixture to chicken along with the ground spices, salt, and green chili peppers and sauté until the mixture comes to a light simmer (~2-3 minutes).',
46-
'Lower the heat to medium-low, cover, and allow it to cook for 15 minutes. Uncover and stir in the black cardamom (if using), mace, garam masala, and nutmeg powder. Cover and cook again for 10 minutes.',
47-
'Raise the heat to high. Add 1/2 to 3/4 cup of water (depending on how thin you\'d like the curry) and bring to a boil. Lower the heat and allow chicken to simmer for another 2-3 minutes. The oil will have risen to the top. Sprinkle the kewra essence and stir. Turn off the heat and garnish with cilantro and blanched almonds.',
48-
],
49-
};
6+
const { recipeStore } = useRecipeContext();
7+
const recipe = recipeStore.recipeList[0];
508

519
const closeRecipe = () => {
5210
console.warn('Not implemented yet.')

frontend/src/stores/RecipeStore.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { createStore } from 'solid-js/store';
2+
3+
import { chicken_korma } from '../assets/dummy-data';
4+
5+
const [ recipeStore, setRecipeStore ] = createStore({
6+
recipeList: [
7+
chicken_korma,
8+
],
9+
});
10+
11+
export { recipeStore, setRecipeStore };

0 commit comments

Comments
 (0)