From b1d896411c79b2c54427039b0b1cdfba6e4ea2e0 Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Fri, 1 Dec 2023 15:14:41 +0100 Subject: [PATCH 1/9] Supprimer 'item.value)' --- item.value) | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 item.value) diff --git a/item.value) b/item.value) deleted file mode 100644 index e69de29..0000000 From de4b1432ca2b6da40117a75280b1015c6776f282 Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Fri, 1 Dec 2023 15:14:47 +0100 Subject: [PATCH 2/9] Supprimer '{' --- { | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 { diff --git a/{ b/{ deleted file mode 100644 index e69de29..0000000 From 0bfdb9756901d4821e6f6aa959715cea54c2f971 Mon Sep 17 00:00:00 2001 From: Rayhan Hassou Date: Thu, 30 Nov 2023 13:24:34 +0100 Subject: [PATCH 3/9] add some changes --- LeftOvers/screens/IngredientSelection.tsx | 5 +- LeftOvers/screens/Profiles.tsx | 136 +++++++++++----------- 2 files changed, 71 insertions(+), 70 deletions(-) diff --git a/LeftOvers/screens/IngredientSelection.tsx b/LeftOvers/screens/IngredientSelection.tsx index e119482..9a0a1fe 100644 --- a/LeftOvers/screens/IngredientSelection.tsx +++ b/LeftOvers/screens/IngredientSelection.tsx @@ -3,7 +3,6 @@ import { View, StyleSheet, Text, Image, Pressable, ActivityIndicator, FlatList, import { SafeAreaProvider } from 'react-native-safe-area-context'; import { Searchbar } from 'react-native-paper'; import FoodElementText from '../components/FoodElementText'; - import plus from '../assets/images/plus.png'; import moins from '../assets/images/minus.png'; import Ingredient from '../Models/Ingredient'; @@ -20,7 +19,7 @@ export default function IngredientSelection(props) { const ingredientService = new IngredientService(); const {colors} = useContext(ColorContext); const [availableSize, setAvailableSize] = useState(0); - const [listVisibility, setListVisibility] = useState("none"); + const [listVisibility, setListVisibility] = useState("flex"); const [availableVisibility, setAvailableVisibility] = useState("none"); const [searchQuery, setSearchQuery] = useState(''); @@ -28,7 +27,6 @@ export default function IngredientSelection(props) { try { setIsLoading(true); if (query === '') { - // Si le query (prompt) est vide, charger tous les ingrédients loadIngredients(); } else { const filtered = await ingredientService.getfilteredIngredient(query); @@ -41,7 +39,6 @@ export default function IngredientSelection(props) { } }; - // Appelée à chaque changement de la recherche const handleSearch = (query) => { setSearchQuery(query); filterIngredients(query); diff --git a/LeftOvers/screens/Profiles.tsx b/LeftOvers/screens/Profiles.tsx index 7f88ca0..8c3e8cb 100644 --- a/LeftOvers/screens/Profiles.tsx +++ b/LeftOvers/screens/Profiles.tsx @@ -1,7 +1,5 @@ -import React, { useContext, useState } from 'react'; -import { StyleSheet, View, Pressable, Text, Image, ScrollView, useWindowDimensions } from 'react-native'; - -import {Modal, Portal, PaperProvider} from 'react-native-paper'; +import React, { useContext, useEffect, useState } from 'react'; +import { StyleSheet, View, Modal, Pressable, Text, Image, ScrollView, useWindowDimensions } from 'react-native'; import { LinearGradient } from 'expo-linear-gradient'; import { SafeAreaProvider } from 'react-native-safe-area-context'; @@ -9,17 +7,18 @@ import { SafeAreaProvider } from 'react-native-safe-area-context'; import ProfileDetails from '../components/ProfileDetails'; import ProfileDelete from '../components/ProfileDelete'; import ColorContext from '../theme/ColorContext'; +import AsyncStorage from '@react-native-async-storage/async-storage'; export default function Profiles({navigation, props}) { - const { colors } = useContext(ColorContext) - - const allJohnny = [{value: "Coconut"}, {value: "Skimmed Milk"}, {value: "Nuts"}] - const dieJohnny = [{value: "Gluten free"}, {value: "Porkless"}, {value: "Pescatarian"}] + const { colors, toggleColors } = useContext(ColorContext) - const allJackie = [{value: "Tomato"}, {value: "Relic"}] - const dieJackie = [{value: "Porkless"}, {value: "Vegetarian"}] + const all = [] + const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}] const [visible, setVisible] = useState(false); + const [opacity, setOpacity] = useState(1); + const [profiles, setProfiles] = useState([]); + const raisePopUp = () => { setVisible(true) } @@ -27,28 +26,35 @@ export default function Profiles({navigation, props}) { setVisible(false) } - const profiles = [ - { - name: "Johnny Silverhand", - avatar: "plus_small.png", - diets: dieJohnny, - allergies: allJohnny, - }, - { - name: "Jackie Welles", - avatar: "plus_small.png", - diets: dieJackie, - allergies: allJackie, - }, - // ... Ajoutez d'autres profils ici de la même manière - ]; + const handleDeleteProfiles = async () => { + try { + await AsyncStorage.removeItem('profiles'); + console.log('Données supprimées avec succès !'); + } catch (error) { + console.error('Erreur lors de la suppression des données :', error); + } + }; + + const handleGetProfiles = async () => { + try { + const existingProfiles = await AsyncStorage.getItem('profiles'); + return JSON.parse(existingProfiles) || []; + } catch (error) { + console.log("ça maaaaaaaaarche poaaaaaaaaaaaas"); + return []; + } + } + + useEffect(() => { + const fetchProfiles = async () => { + const existingProfiles = await handleGetProfiles(); + setProfiles(existingProfiles); + }; + + fetchProfiles(); + }, []); - const containerStyle = { - //minHeight: useWindowDimensions().height/2, - //width: useWindowDimensions().width, - height: "75%", - width: "100%", - }; + const styles = StyleSheet.create({ container: { @@ -101,13 +107,11 @@ export default function Profiles({navigation, props}) { borderRadius: 15, alignItems: "center", justifyContent: "center", - backgroundColor: colors.cardBackground, - borderWidth: 1, - borderColor: colors.blocBorder, + backgroundColor: "#F2F0E4", }, validationQuestion: { fontSize: 20, - color: colors.cardElementBorder, + color: '#ACA279', alignItems: 'center', justifyContent: 'center', flex: 0.3, @@ -130,7 +134,7 @@ export default function Profiles({navigation, props}) { borderRadius: 20, alignItems: "center", justifyContent: "center", - backgroundColor: colors.yesButton, + backgroundColor: "#59BDCD", }, yesText: { fontSize: 20, @@ -176,43 +180,43 @@ export default function Profiles({navigation, props}) { return ( - - + + {profileComponents} - - - - - - - - - - - Do you really want to delete this profile? - - - - - Yes + + + + + {/* */} + + + Do you really want to delete this profile? + + + + + Yes + + + + + + No + + - - - - - No - - + - + - - - + + + + ); - } + } \ No newline at end of file From ec6420ece1913fbe31273a245be9dbfe4f8f4218 Mon Sep 17 00:00:00 2001 From: Rayhan Hassou Date: Fri, 1 Dec 2023 09:45:07 +0100 Subject: [PATCH 4/9] add deleting profils but modal for confirmation dont work --- LeftOvers/screens/Profiles.tsx | 42 +++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/LeftOvers/screens/Profiles.tsx b/LeftOvers/screens/Profiles.tsx index 8c3e8cb..f3d89f6 100644 --- a/LeftOvers/screens/Profiles.tsx +++ b/LeftOvers/screens/Profiles.tsx @@ -18,6 +18,7 @@ export default function Profiles({navigation, props}) { const [visible, setVisible] = useState(false); const [opacity, setOpacity] = useState(1); const [profiles, setProfiles] = useState([]); + const [selectedProfileIndex, setSelectedProfileIndex] = useState(null); const raisePopUp = () => { setVisible(true) @@ -26,14 +27,20 @@ export default function Profiles({navigation, props}) { setVisible(false) } - const handleDeleteProfiles = async () => { + const handleDeleteProfile = async (index) => { try { - await AsyncStorage.removeItem('profiles'); - console.log('Données supprimées avec succès !'); + const updatedProfiles = profiles.filter((profile, i) => i !== index); + await AsyncStorage.setItem('profiles', JSON.stringify(updatedProfiles)); + setSelectedProfileIndex(index); + raisePopUp(); // Afficher la boîte de dialogue de confirmation après la suppression } catch (error) { - console.error('Erreur lors de la suppression des données :', error); + console.error('Erreur lors de la suppression du profil :', error); } - }; + }; + + const confirmDelete = () => { + erasePopUp(); + }; const handleGetProfiles = async () => { try { @@ -44,13 +51,17 @@ export default function Profiles({navigation, props}) { return []; } } + + const fetchProfiles = async () => { + const existingProfiles = await handleGetProfiles(); + setProfiles(existingProfiles); + }; + + const subscription = EventEmitter.addListener('profileAdded', async () => { + fetchProfiles(); + }); useEffect(() => { - const fetchProfiles = async () => { - const existingProfiles = await handleGetProfiles(); - setProfiles(existingProfiles); - }; - fetchProfiles(); }, []); @@ -190,14 +201,19 @@ export default function Profiles({navigation, props}) { - {/* */} + Do you really want to delete this profile? - + - + Yes From b1315348eeade480e27bd91373a52f0aa5542f41 Mon Sep 17 00:00:00 2001 From: Rayhan Hassou Date: Fri, 1 Dec 2023 13:34:46 +0100 Subject: [PATCH 5/9] deleting profil works --- LeftOvers/components/ListWithoutSelect.tsx | 9 +-- LeftOvers/screens/Profiles.tsx | 91 +++++++++++++++------- 2 files changed, 65 insertions(+), 35 deletions(-) diff --git a/LeftOvers/components/ListWithoutSelect.tsx b/LeftOvers/components/ListWithoutSelect.tsx index 069534b..1944867 100644 --- a/LeftOvers/components/ListWithoutSelect.tsx +++ b/LeftOvers/components/ListWithoutSelect.tsx @@ -5,18 +5,13 @@ import ColorContext from '../theme/ColorContext'; type ListProps = { title: string - content: {value: string}[] + content: string[] } export default function ListWithoutSelect(props: ListProps) { const [selected, setSelected] = React.useState([]); const { colors } = useContext(ColorContext); - let listContent = [] - - props.content.forEach((val) => { - listContent.push({value: val.value, disabled: true}) - }) const styles = StyleSheet.create({ titleBar: { @@ -86,7 +81,7 @@ export default function ListWithoutSelect(props: ListProps) { return ( setSelected(val)} - data={listContent} + data={props.content} save="value" search={false} arrowicon={} diff --git a/LeftOvers/screens/Profiles.tsx b/LeftOvers/screens/Profiles.tsx index f3d89f6..0373431 100644 --- a/LeftOvers/screens/Profiles.tsx +++ b/LeftOvers/screens/Profiles.tsx @@ -8,6 +8,9 @@ import ProfileDetails from '../components/ProfileDetails'; import ProfileDelete from '../components/ProfileDelete'; import ColorContext from '../theme/ColorContext'; import AsyncStorage from '@react-native-async-storage/async-storage'; +import EventEmitter from './EventEmitter'; +import Profil from '../Models/Profil'; +import { PaperProvider, Portal } from 'react-native-paper'; export default function Profiles({navigation, props}) { const { colors, toggleColors } = useContext(ColorContext) @@ -20,19 +23,30 @@ export default function Profiles({navigation, props}) { const [profiles, setProfiles] = useState([]); const [selectedProfileIndex, setSelectedProfileIndex] = useState(null); - const raisePopUp = () => { + const raisePopUp = (index) => { + setSelectedProfileIndex(index) setVisible(true) } const erasePopUp = () => { setVisible(false) } + const handleDeleteProfiles = async () => { + try { + await AsyncStorage.removeItem('profiles'); + console.log('Données supprimées avec succès !'); + } catch (error) { + console.error('Erreur lors de la suppression des données :', error); + } + }; + const handleDeleteProfile = async (index) => { try { const updatedProfiles = profiles.filter((profile, i) => i !== index); await AsyncStorage.setItem('profiles', JSON.stringify(updatedProfiles)); + fetchProfiles(); setSelectedProfileIndex(index); - raisePopUp(); // Afficher la boîte de dialogue de confirmation après la suppression + erasePopUp(); } catch (error) { console.error('Erreur lors de la suppression du profil :', error); } @@ -63,11 +77,16 @@ export default function Profiles({navigation, props}) { useEffect(() => { fetchProfiles(); + console.log(profiles) }, []); - + const containerStyle = { + height: "75%", + width: "100%", + }; - const styles = StyleSheet.create({ + + const styles = StyleSheet.create({ container: { height: "100%", width: "100%", @@ -118,11 +137,13 @@ export default function Profiles({navigation, props}) { borderRadius: 15, alignItems: "center", justifyContent: "center", - backgroundColor: "#F2F0E4", + backgroundColor: colors.cardBackground, + borderWidth: 1, + borderColor: colors.blocBorder, }, validationQuestion: { fontSize: 20, - color: '#ACA279', + color: colors.cardElementBorder, alignItems: 'center', justifyContent: 'center', flex: 0.3, @@ -145,7 +166,7 @@ export default function Profiles({navigation, props}) { borderRadius: 20, alignItems: "center", justifyContent: "center", - backgroundColor: "#59BDCD", + backgroundColor: colors.yesButton, }, yesText: { fontSize: 20, @@ -206,33 +227,47 @@ export default function Profiles({navigation, props}) { avatar={profiles[selectedProfileIndex].avatar} diets={profiles[selectedProfileIndex].diets} allergies={profiles[selectedProfileIndex].allergies} - /> - - - Do you really want to delete this profile? - - - - - Yes - - - - - - No - - + /> */} + + + Do you really want to delete this profile? + + handleDeleteProfile(selectedProfileIndex)} style={{flex:0.5}}> + + + Yes - + + + + + No + + - + + + + {index < profiles.length - 1 && } + + )); + + + + return ( + + + + + + {profileComponents} - - + + + ); } \ No newline at end of file From a004cbdf58501c37b70799885dc8279f4f49eefa Mon Sep 17 00:00:00 2001 From: Rayhan Hassou Date: Fri, 1 Dec 2023 15:02:57 +0100 Subject: [PATCH 6/9] try to bind images but it dont work --- LeftOvers/components/ProfileElement.tsx | 10 ++++------ LeftOvers/screens/CreateProfile.tsx | 17 ++++++++++++++++- LeftOvers/screens/Profiles.tsx | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/LeftOvers/components/ProfileElement.tsx b/LeftOvers/components/ProfileElement.tsx index 6f65fd9..e78d8e0 100644 --- a/LeftOvers/components/ProfileElement.tsx +++ b/LeftOvers/components/ProfileElement.tsx @@ -36,14 +36,12 @@ export default function ProfileElement(props : Profile) { } let imageSource - if (props.avatar == "plus.png"){ - imageSource = require('../assets/images/plus.png') - } - else if (props.avatar == "plus_small.png"){ - imageSource = require('../assets/images/plus_small.png') + if(props.avatar == null){ + console.log("NUUUULLLLLE" + props.avatar) } else{ - imageSource = require('../assets/images/logo.png') + imageSource = { uri: props.avatar }; + console.log("MAAARCHHEEE" + props.avatar) } const styles = StyleSheet.create({ diff --git a/LeftOvers/screens/CreateProfile.tsx b/LeftOvers/screens/CreateProfile.tsx index db3c9a5..df916b2 100644 --- a/LeftOvers/screens/CreateProfile.tsx +++ b/LeftOvers/screens/CreateProfile.tsx @@ -44,7 +44,22 @@ export default function CreateProfile(props) { - + + + + + + + + + Filters + "0 diets selected + + + + + + diff --git a/LeftOvers/screens/Profiles.tsx b/LeftOvers/screens/Profiles.tsx index 0373431..77b22a5 100644 --- a/LeftOvers/screens/Profiles.tsx +++ b/LeftOvers/screens/Profiles.tsx @@ -227,7 +227,7 @@ export default function Profiles({navigation, props}) { avatar={profiles[selectedProfileIndex].avatar} diets={profiles[selectedProfileIndex].diets} allergies={profiles[selectedProfileIndex].allergies} - /> */} + /> */} Do you really want to delete this profile? From aa8150c4d64b5714014816b3e121ba36fab475f6 Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Mon, 4 Dec 2023 10:51:44 +0100 Subject: [PATCH 7/9] Issue Load Recipes --- LeftOvers/App.tsx | 4 +- .../Services/Recipes/RecipesServices.tsx | 2 +- LeftOvers/navigation/CookingStackScreen.tsx | 22 ++++++++++ LeftOvers/screens/HomePage.tsx | 44 ++++++++++++++++--- LeftOvers/screens/IngredientSelection.tsx | 1 + LeftOvers/screens/Profiles.tsx | 2 +- LeftOvers/screens/RecipeDetails.tsx | 26 ++++++----- LeftOvers/screens/RecipeSuggestion.tsx | 8 ---- 8 files changed, 81 insertions(+), 28 deletions(-) diff --git a/LeftOvers/App.tsx b/LeftOvers/App.tsx index d59933d..44a747e 100644 --- a/LeftOvers/App.tsx +++ b/LeftOvers/App.tsx @@ -18,8 +18,8 @@ export default function App() { - }> - + }> + diff --git a/LeftOvers/Services/Recipes/RecipesServices.tsx b/LeftOvers/Services/Recipes/RecipesServices.tsx index c86d71d..e5100ba 100644 --- a/LeftOvers/Services/Recipes/RecipesServices.tsx +++ b/LeftOvers/Services/Recipes/RecipesServices.tsx @@ -18,7 +18,7 @@ export default class RecipesService implements IRecipesService { async getRecipeById(id: number): Promise{ try { const response = await axios.get(`${this.API_URL}/${id}`); - console.log(response); + //console.log(response.name); return response.data as Recipes; } catch (error) { throw new Error('Erreur lors de la récupération des ingrédients : ' + error.message); diff --git a/LeftOvers/navigation/CookingStackScreen.tsx b/LeftOvers/navigation/CookingStackScreen.tsx index bf1f075..669a8b2 100644 --- a/LeftOvers/navigation/CookingStackScreen.tsx +++ b/LeftOvers/navigation/CookingStackScreen.tsx @@ -5,6 +5,8 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack'; import IngredientSelection from '../screens/IngredientSelection'; import { HeaderTitle } from './Utils'; import ThemeContext from '../theme/ThemeContext'; +import RecipeSuggestion from '../screens/RecipeSuggestion'; +import RecipeDetails from '../screens/RecipeDetails'; const CookingStack = createNativeStackNavigator() @@ -23,6 +25,26 @@ export default function CookingStackScreen() { ) }} /> + ( + + ) + }} + /> + ( + + ) + }} + /> ) } diff --git a/LeftOvers/screens/HomePage.tsx b/LeftOvers/screens/HomePage.tsx index 080f88f..205b2c7 100644 --- a/LeftOvers/screens/HomePage.tsx +++ b/LeftOvers/screens/HomePage.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from 'react'; +import React, { useContext, useState, useEffect } from 'react'; import { StyleSheet, View, Text, Pressable, Image, ScrollView } from 'react-native'; import {LinearGradient} from 'expo-linear-gradient'; import {SafeAreaProvider} from 'react-native-safe-area-context'; @@ -11,17 +11,51 @@ import ColorContext from '../theme/ColorContext'; import bracketLeft from '../assets/images/angle_bracket_left.png'; import bracketRight from '../assets/images/angle_bracket_right.png'; +import AsyncStorage from '@react-native-async-storage/async-storage'; +import EventEmitter from './EventEmitter'; export default function HomePage({ navigation, props }) { const {colors} = useContext(ColorContext); - const profiles = [ + const profilesHand = [ {name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"}, {name: "Panam Palmer", avatar: "plus_small.png", isActive: "none"}, {name: "Goro Takemura", avatar: "plus_small.png", isActive: "none"}, {name: "David Martinez", avatar: "plus_small.png", isActive: "flex"}, ] + const [profiles, setProfiles] = useState([{name: "None", avatar: "plus_small.png", isActive: "none"}]); + console.log(profiles, profiles.length) + + const handleGetProfiles = async () => { + try { + const existingProfiles = await AsyncStorage.getItem('profiles'); + return JSON.parse(existingProfiles) || []; + } catch (error) { + console.log(error); + return []; + } + } + + const fetchProfiles = async () => { + const existingProfiles = await handleGetProfiles(); + setProfiles(existingProfiles); + }; + + const subscription = EventEmitter.addListener('profileAdded', async () => { + fetchProfiles(); + }); + + useEffect(() => { + fetchProfiles(); + console.log(profiles.length) + if(profiles.length == 0){ + setProfiles([{name: "None", avatar: "plus_small.png", isActive: "none"}]) + console.log("Je passe ici") + } + console.log(profiles) + }, []); + const ingredientList = [{title: "Carrot"}, {title: "Potato"}, {title: "Peach"}] const [cpt, setCpt] = useState(0); @@ -155,8 +189,6 @@ export default function HomePage({ navigation, props }) { - navigation.navigate('FiltersSelection')}/> - navigation.navigate('Profiles')}/> @@ -178,9 +210,9 @@ export default function HomePage({ navigation, props }) { - navigation.navigate('IngredientSelection')}/> + console.log('Chnge Selected Ingredient')}/> - navigation.navigate('RecipeSuggestion')}/> + console.log('Go and search for recipe')}/> diff --git a/LeftOvers/screens/IngredientSelection.tsx b/LeftOvers/screens/IngredientSelection.tsx index 9a0a1fe..ee7b49a 100644 --- a/LeftOvers/screens/IngredientSelection.tsx +++ b/LeftOvers/screens/IngredientSelection.tsx @@ -56,6 +56,7 @@ const loadIngredients = async () => { }; useEffect(() => { + console.log("Je passe ici (Ingredient Selection)") loadIngredients(); }, []); diff --git a/LeftOvers/screens/Profiles.tsx b/LeftOvers/screens/Profiles.tsx index 77b22a5..eed71c6 100644 --- a/LeftOvers/screens/Profiles.tsx +++ b/LeftOvers/screens/Profiles.tsx @@ -61,7 +61,7 @@ export default function Profiles({navigation, props}) { const existingProfiles = await AsyncStorage.getItem('profiles'); return JSON.parse(existingProfiles) || []; } catch (error) { - console.log("ça maaaaaaaaarche poaaaaaaaaaaaas"); + console.log(error); return []; } } diff --git a/LeftOvers/screens/RecipeDetails.tsx b/LeftOvers/screens/RecipeDetails.tsx index 74905c8..81913bd 100644 --- a/LeftOvers/screens/RecipeDetails.tsx +++ b/LeftOvers/screens/RecipeDetails.tsx @@ -12,26 +12,32 @@ import ColorContext from '../theme/ColorContext'; export default function RecipeDetails(props) { const {colors} = useContext(ColorContext); - - const [isLoading, setIsLoading] = useState(true); - const [response, setResponse] = useState(undefined); + + const [isLoading, setIsLoading] = useState(true) + const [response, setResponse] = useState(); const recipesService = new RecipesService(); const loadRecipe = async () => { try { - const recipe = await recipesService.getRecipeById(props.id); + const recipe = await recipesService.getRecipeById(120); + console.log("Recipe.name: "+recipe.name) setResponse(recipe); + console.log("Response.name: "+response.name) } catch (error) { console.log(error); - } finally { - setIsLoading(false); + } finally{ + setIsLoading(false) } }; useEffect(() => { + console.log("Je passe ici (useEffect)") loadRecipe(); }, []); + loadRecipe() + console.log("Response.name: " + response.name) + function convertToHoursMinutes(totalMinutes: number): string { const hours = Math.floor(totalMinutes / 60); const minutes = totalMinutes % 60; @@ -58,7 +64,7 @@ export default function RecipeDetails(props) { alignItems: 'center', justifyContent: 'center', borderRadius: 20, - backgroundColor: '#F2F0E4', + backgroundColor: colors.cardBackground, padding: "3%", marginHorizontal: "3%", borderWidth: 1, @@ -75,12 +81,12 @@ export default function RecipeDetails(props) { }, filters: { fontSize: 20, - color: '#ACA279', + color: colors.cardElementBorder, flex: 1, }, nbSelected: { fontSize: 11, - color: "#3F3C42", + color: colors.cardDetail, textAlign: "right", }, }); @@ -88,7 +94,7 @@ export default function RecipeDetails(props) { return ( - + - - From 1efbac082f4d91f46fcad3a268f156cd7441e46b Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Mon, 4 Dec 2023 13:46:58 +0100 Subject: [PATCH 8/9] Fix Merge Issue --- LeftOvers/screens/HomePage.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LeftOvers/screens/HomePage.tsx b/LeftOvers/screens/HomePage.tsx index 205b2c7..73f4e2e 100644 --- a/LeftOvers/screens/HomePage.tsx +++ b/LeftOvers/screens/HomePage.tsx @@ -189,6 +189,8 @@ export default function HomePage({ navigation, props }) { + navigation.navigate('FiltersSelection')}/> + navigation.navigate('Profiles')}/> From dfcf2a646f06fadaa236b6261dbe44a20d980d3f Mon Sep 17 00:00:00 2001 From: Louison PARANT Date: Mon, 4 Dec 2023 14:58:35 +0100 Subject: [PATCH 9/9] Fix Merge Issue --- LeftOvers/screens/Profiles.tsx | 44 +++++++++++------------------ LeftOvers/screens/RecipeDetails.tsx | 11 +++++--- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/LeftOvers/screens/Profiles.tsx b/LeftOvers/screens/Profiles.tsx index 4e144d9..16408ac 100644 --- a/LeftOvers/screens/Profiles.tsx +++ b/LeftOvers/screens/Profiles.tsx @@ -13,7 +13,7 @@ import Profil from '../Models/Profil'; import { PaperProvider, Portal } from 'react-native-paper'; export default function Profiles({navigation, props}) { - const { colors } = useContext(ColorContext) + const { colors, toggleColors } = useContext(ColorContext) const all = [] const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}] @@ -85,7 +85,8 @@ export default function Profiles({navigation, props}) { width: "100%", }; - const styles = StyleSheet.create({ + + const styles = StyleSheet.create({ container: { height: "100%", width: "100%", @@ -105,7 +106,7 @@ export default function Profiles({navigation, props}) { separator: { marginTop: "6%" }, - + modal: { position: 'absolute', top: '0%', @@ -121,7 +122,7 @@ export default function Profiles({navigation, props}) { width: "100%", flex: 1, }, - + profileValidation: { width: "100%", alignItems: "center", @@ -199,29 +200,18 @@ export default function Profiles({navigation, props}) { const profileComponents = profiles.map((profile, index) => ( navigation.navigate('ProfileModification')} - onDeleteProfile={raisePopUp}/> - {index < profiles.length - 1 && } - - )); - - return ( - - - - - - {profileComponents} + name={profile.name} + avatar={profile.avatar} + diets={profile.diets} + allergies={profile.allergies} + onDeleteProfile={() => raisePopUp(index)} + /> + + - - - - - + + {/* ); - } + } \ No newline at end of file diff --git a/LeftOvers/screens/RecipeDetails.tsx b/LeftOvers/screens/RecipeDetails.tsx index 81913bd..595e4ee 100644 --- a/LeftOvers/screens/RecipeDetails.tsx +++ b/LeftOvers/screens/RecipeDetails.tsx @@ -8,13 +8,19 @@ import Recipes from '../Models/Recipes'; import { LinearGradient } from 'expo-linear-gradient'; import ListWithoutSelect from '../components/ListWithoutSelect'; import ColorContext from '../theme/ColorContext'; +import Ingredient from '../Models/Ingredient'; export default function RecipeDetails(props) { const {colors} = useContext(ColorContext); const [isLoading, setIsLoading] = useState(true) - const [response, setResponse] = useState(); + + + + const ingredientList = [new Ingredient(3, "Carrot"), new Ingredient(4, "Potato"), new Ingredient(5, "Peach")] + + const [response, setResponse] = useState(new Recipes (120, "Carrot", "Delicious", 90, ["Fork", "Fish", "Knife"], ingredientList)) const recipesService = new RecipesService(); const loadRecipe = async () => { @@ -35,9 +41,6 @@ export default function RecipeDetails(props) { loadRecipe(); }, []); - loadRecipe() - console.log("Response.name: " + response.name) - function convertToHoursMinutes(totalMinutes: number): string { const hours = Math.floor(totalMinutes / 60); const minutes = totalMinutes % 60;