|
|
@ -119,20 +119,15 @@ export default function RecipeDetails({ route }) {
|
|
|
|
|
|
|
|
|
|
|
|
function getImageForRecipe(recipeName: string) {
|
|
|
|
function getImageForRecipe(recipeName: string) {
|
|
|
|
const categories = [];
|
|
|
|
const categories = [];
|
|
|
|
console.log("NAAAAAME : " + recipeName)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const [category, words] of Object.entries(imagesDictionary)) {
|
|
|
|
for (const [category, words] of Object.entries(imagesDictionary)) {
|
|
|
|
const matchedWords = words.filter((word) => recipeName.toLowerCase().includes(word));
|
|
|
|
const matchedWords = words.filter((word) => recipeName.toLowerCase().includes(word));
|
|
|
|
console.log("Matched Word : " + matchedWords)
|
|
|
|
|
|
|
|
if (matchedWords.length > 0) {
|
|
|
|
if (matchedWords.length > 0) {
|
|
|
|
categories.push(category);
|
|
|
|
categories.push(category);
|
|
|
|
console.log(category)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log("ON ENTRE DANS LA 2EME FONCTION");
|
|
|
|
|
|
|
|
const categoryName = getCategoryFromList(categories);
|
|
|
|
const categoryName = getCategoryFromList(categories);
|
|
|
|
console.log("CategoryName à la fin : " + categoryName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (categoryName) {
|
|
|
|
switch (categoryName) {
|
|
|
|
case 'meat':
|
|
|
|
case 'meat':
|
|
|
@ -179,7 +174,6 @@ export default function RecipeDetails({ route }) {
|
|
|
|
const loadRecipe = async () => {
|
|
|
|
const loadRecipe = async () => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const recipe = await recipesService.getRecipeById(recipeId);
|
|
|
|
const recipe = await recipesService.getRecipeById(recipeId);
|
|
|
|
console.log("Recipe.name: "+recipe.name)
|
|
|
|
|
|
|
|
setResponse(recipe);
|
|
|
|
setResponse(recipe);
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error);
|
|
|
|
console.log(error);
|
|
|
|