merge with master
continuous-integration/drone/push Build is passing Details

pull/23/head
Rémi REGNAULT 1 year ago
commit 6e9baa413e

@ -23,25 +23,22 @@ const styles = StyleSheet.create({
width : 150,
height: 40,
borderRadius: 4,
elevation: 3,
backgroundColor: 'rgba(0, 0, 0, 0.7)',
backgroundColor: '#F2F0E4',
},
text: {
fontSize: 15,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'white',
color: '#ACA279',
},
view: {
width : 145,
height: 35,
borderRadius: 4,
elevation: 3,
borderWidth: 1,
borderColor: 'grey',
alignItems: 'center', // Centre le contenu verticalement
justifyContent: 'center', // Centre le contenu horizontalement
borderColor: '#ACA279',
alignItems: 'center',
justifyContent: 'center',
margin: "1%",
},
});

@ -21,33 +21,39 @@ export default function FoodElementText(props : foodElementImageProps) {
width: "80%",
borderRadius: 5,
backgroundColor: colors.carrouselBackground,
marginHorizontal: "3%",
},
text: {
fontSize: 10,
fontWeight: 'bold',
padding : "2%",
color: colors.cardDetail,
fontSize: 15,
lineHeight: 20,
fontWeight: 'bold',
padding : "3%",
color: colors.cardDetail,
},
view: {
alignItems: 'flex-start',
justifyContent: 'center',
alignItems: 'flex-start',
justifyContent: 'center',
marginRight: "3%",
width: "100%"
},
container: {
width: "100%",
borderRadius: 5,
borderWidth: 1,
borderColor: colors.cardDetail,
flexDirection: 'column',
justifyContent: 'center',
width: "100%",
height: 50,
borderRadius: 5,
borderWidth: 2,
borderColor: colors.cardDetail,
flexDirection: 'row',
justifyContent: 'space-between',
},
});
return (
<Pressable style={styles.button}>
<View style={styles.container}>
<View style={styles.view}>
<Text style={styles.text}>{props.title}</Text>
</View>
</View>
</Pressable>
<Pressable style={styles.button}>
<View style={styles.container}>
<View style={styles.view}>
<Text style={styles.text}>{props.title}</Text>
<Separator/>
</View>
</View>
</Pressable>
);
}

@ -0,0 +1,50 @@
import React from 'react';
import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
import Separator from '../components/Separator';
interface foodElementTextProps {
title: string
}
export default function FoodElementTextSimple(props: foodElementTextProps) {
return (
<Pressable style={styles.button}>
<View style={styles.container}>
<View style={styles.view}>
<Text style={styles.text}>{props.title}</Text>
</View>
</View>
</Pressable>
);
}
const styles = StyleSheet.create({
button: {
alignItems: 'center',
justifyContent: 'center',
width: "80%",
borderRadius: 5,
backgroundColor: '#E3DEC9',
},
text: {
fontSize: 10,
fontWeight: 'bold',
padding : "2%",
color: 'black',
},
view: {
alignItems: 'flex-start',
justifyContent: 'center',
},
container: {
width: "100%",
borderRadius: 5,
borderWidth: 1,
borderColor: '#3F3C42',
flexDirection: 'column',
justifyContent: 'center',
},
});

@ -1,27 +1,19 @@
import React from 'react';
import { Appbar } from 'react-native-paper';
interface TopBarProps{
source : string
firstImage : string
lastImage : string
}
interface ParameterTopBarProps{
onEventIngredient: () => void
onEventFilter: () => void
colorIngredients: string
colorFilters: string
}
export default function ParameterTopBar(props : any) {
const goFilter = () =>{
props.onEventFilter('Hello');
}
const goIngredients = () =>{
props.onEventIngredient('Hello');
}
export default function ParameterTopBar(props : ParameterTopBarProps) {
return (
<Appbar.Header style={{backgroundColor: '#F2F0E4', justifyContent: 'center'}} >
<Appbar.Action icon="magnify" onPress={goIngredients} />
<Appbar.Action icon="dots-vertical" onPress={goFilter} />
</Appbar.Header>
<Appbar.Header style={{backgroundColor: '#F2F0E4', height: "10%", justifyContent: "center", borderTopLeftRadius: 20, borderTopRightRadius: 20,}}>
<Appbar.Action icon="magnify" onPress={props.onEventIngredient} color={props.colorIngredients}/>
<Appbar.Action icon="dots-vertical" onPress={props.onEventFilter} color={props.colorFilters}/>
</Appbar.Header>
);
}

@ -15,7 +15,7 @@ type ProfileSelectionProps = {
type Profile = {
name: string
avatar: string
isActive: boolean
isActive: string
}
export default function ProfileSelection(props: ProfileSelectionProps) {

@ -6,63 +6,40 @@ import Union_right from '../assets/images/Union_right.png';
import background from '../assets/images/Background.png';
interface recipeElementProps {
number : number
title : string
description : string
imageList : string[]
image : string
number: string
title: string
textList: string[]
description: string
}
export default function RecipeElement(props : any) {
const totalContentCount = props.imageList.length + 11;
const dynamicHeight = totalContentCount * 40;
const scrollViewHeight = 100;
export default function RecipeElement(props: recipeElementProps) {
return (
<Pressable style={[styles.button, { height: dynamicHeight }]}>
<View style={[styles.view, { height: dynamicHeight - 10}]}>
<Pressable style={styles.button}>
<View style={styles.view}>
<Text style={styles.text}>{props.number}</Text>
<Text style={styles.title}>{props.title}</Text>
<Image source={props.image ? props.image : brochette} style={{ width: 100, height: 100 }}/>
<View style={styles.horizontalAlignement}>
<Image source={Union_left} style={{ width: 70, height: 4, marginRight: 6 }} />
<Image source={props.image ? props.image : brochette} style={{width: 100, resizeMode: "contain"}}/>
<View style={styles.horizontalAlignment}>
<Image source={Union_left} style={{width: "25%", marginRight: "3%", resizeMode: "contain"}} />
<Text style={styles.text}>Ingredients</Text>
<Image source={Union_right} style={{ width: 70, height: 4, marginLeft: 6 }} />
</View>
<View style={styles.horizontalAlignement}>
{props.imageList.length > 0 && props.imageList.map((source, index) => (
<Image key={index} source={source} style={{ width: 40, height: 40 }} />
))}
<Image source={Union_right} style={{ width: "25%", marginLeft: "3%", resizeMode: "contain"}} />
</View>
<View style={styles.horizontalAlignment}>
{props.textList.length > 0 && props.textList.map((source, index) => (
<Text key={index} style={styles.smallText}>- {source.title} -</Text>
))}
</View>
{props.imageList.length <= 0 ? (
<View style={styles.horizontalAlignement}>
{props.textList.length > 0 && props.textList.map((source, index) => (
<Text key={index} style={styles.smallText}>{source}</Text>
))}
</View>
) : null}
<View style={styles.scrollViewContainer}>
<SafeAreaView>
<View style={styles.horizontalAlignement}>
<Image source={Union_left} style={{ width: 70, height: 4, marginRight: 6 }} />
<Text style={styles.text}>Description</Text>
<Image source={Union_right} style={{ width: 70, height: 4, marginLeft: 6 }} />
<View style={styles.horizontalAlignment}>
<Image source={Union_left} style={{width: "27%", marginRight: "3%", resizeMode: "contain"}}/>
<Text style={styles.text}>Description</Text>
<Image source={Union_right} style={{width: "27%", marginLeft: "3%", resizeMode: "contain"}}/>
</View>
<ScrollView style={{ marginTop: 5, height: scrollViewHeight }}>
<Text style={styles.smallText}>{props.description}</Text>
<ScrollView style={{marginTop: "3%", overflow: "hidden"}}>
<Text style={styles.smallText}>{props.description}</Text>
</ScrollView>
</SafeAreaView>
</View>
<Image source={background} style={{width: 210, height: 20, marginTop: dynamicHeight - 50, position: 'absolute'}}></Image>
<Image source={background} style={{width: "80%", resizeMode: "contain"}}></Image>
</View>
</Pressable>
);
@ -73,54 +50,47 @@ const styles = StyleSheet.create({
button: {
alignItems: 'center',
justifyContent: 'center',
width : 300,
width: 300,
height: "90%",
borderRadius: 40,
elevation: 3,
backgroundColor: '#E3DEC9',
},
text: {
fontSize: 14,
lineHeight: 21,
fontSize: 15,
fontWeight: 'bold',
letterSpacing: 0.25,
color: '#756C28',
marginTop: 10,
marginTop: "4%",
},
smallText: {
fontSize: 12,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: '#71662A',
textAlign: "center",
margin : 5
margin : "2%"
},
title:{
fontSize: 18,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: '#524B1A',
},
view: {
width : 290,
width : "95%",
height: "96.5%",
borderRadius: 40,
elevation: 3,
borderWidth: 2,
borderColor: 'grey',
alignItems: 'center', // Centre le contenu verticalement
display: "flex",
flexWrap: "wrap",
padding: "5%",
borderColor: '#73692A',
alignItems: 'center',
justifyContent: "center",
},
horizontalAlignement: {
horizontalAlignment: {
display: "flex",
flexDirection : 'row',
alignItems: 'center',
justifyContent: 'space-between',
marginTop : 5,
marginTop : "2%",
flexWrap: 'wrap',
},
scrollViewContainer: {
flex: 1, // Assurez-vous que le reste du contenu occupe l'espace restant
flex: 1,
},
});

@ -7,25 +7,22 @@ import background from '../assets/images/Background.png';
interface recipeElementReduceProps {
number : number
title : string
image : string
duree : string
image : string | null
duration : string
}
export default function RecipeElementReduce(props : any) {
export default function RecipeElementReduce(props: recipeElementReduceProps) {
return (
<Pressable style={styles.button}>
<View style={styles.button}>
<View style={styles.view}>
<Text style={styles.text}>{props.number}</Text>
<Text style={styles.title}>{props.title}</Text>
<Image source={props.image ? props.image : brochette} style={{ width: 100, height: 100 }}/>
<View style={{marginTop: 200, position: 'absolute'}}>
<Image source={background} style={{width: 210, height: 20}}></Image>
<Text style={styles.smallText}>{props.duree}</Text>
</View>
<Image source={props.image ? props.image : brochette} style={{ width: 100, height: 100, resizeMode: "contain", zIndex: 2}}/>
<View style={{marginBottom: "20%"}}/>
<Image source={background} style={{width: "80%", resizeMode: "contain", position: "absolute", zIndex: 1, top: "90%"}}></Image>
<Text style={styles.smallText}>{props.duration}</Text>
</View>
</Pressable>
</View>
);
}
@ -37,48 +34,39 @@ const styles = StyleSheet.create({
width : 250,
height: 250,
borderRadius: 40,
elevation: 3,
backgroundColor: '#E3DEC9',
},
text: {
fontSize: 14,
lineHeight: 21,
fontSize: 15,
fontWeight: 'bold',
letterSpacing: 0.25,
color: '#756C28',
marginTop: 10,
marginTop: "4%",
zIndex: 2
},
smallText: {
position: 'absolute',
textAlign: 'center',
left: 0,
right: 0,
marginHorizontal: 'auto',
color: '#E3DEC9',
position: "absolute",
fontSize: 12,
color: '#F2F0E4',
textAlign: "center",
margin : "2%",
zIndex: 2,
fontWeight: "bold",
top: "89.25%"
},
title:{
fontSize: 18,
lineHeight: 21,
fontWeight: 'bold',
letterSpacing: 0.25,
color: '#524B1A',
fontSize: 18,
fontWeight: 'bold',
color: '#524B1A',
zIndex: 2
},
view: {
width : 240,
height: 240,
borderRadius: 40,
elevation: 3,
borderWidth: 2,
borderColor: 'grey',
alignItems: 'center', // Centre le contenu verticalement
display: "flex",
flexWrap: "wrap",
width : "95%",
height: "95%",
borderRadius: 40,
borderWidth: 2,
padding: "5%",
borderColor: '#73692A',
alignItems: 'center',
justifyContent: "center",
},
horizontalAlignement: {
display: "flex",
flexDirection : 'row',
alignItems: 'center',
marginTop: 10,
}
});

@ -1,58 +1,51 @@
import React, { useState } from 'react';
import { View, StyleSheet, Pressable, Image, Text } from 'react-native';
import {View, StyleSheet, Pressable, Image, Text} from 'react-native';
import bracketLeft from '../assets/images/angle_bracket_left.png';
import bracketRight from '../assets/images/angle_bracket_right.png';
import parameter from '../assets/images/parameter.png';
import FoodElementText from './FoodElementText';
interface SelectedIngredientProps {
listeIngredient: string[];
listeImage: string[];
onEvent: (value: string) => void;
ingredientList: string[]
onEvent: () => void
}
export default function SelectedIngredient(props: SelectedIngredientProps) {
const [cpt, setCpt] = useState(0);
const decreaseCounter = () => {
if (cpt > 0) {
if(cpt > 0){
setCpt(cpt - 1);
} else {
setCpt(props.listeIngredient.length - 1);
}
else{
setCpt(props.ingredientList.length - 1);
}
};
const increaseCounter = () => {
if (cpt < props.listeIngredient.length - 1) {
if(cpt < props.ingredientList.length - 1){
setCpt(cpt + 1);
} else {
}
else{
setCpt(0);
}
};
const handlePress = () => {
// Supposons que vous voulez envoyer la valeur 'Hello' au parent
props.onEvent('Hello');
};
return (
<View style={styles.view}>
<View id="Top" style={styles.horizontalAlignement}>
<View style={styles.horizontalAlignment}>
<Text style={styles.text}>Selected ingredients</Text>
<Pressable onPress={handlePress}>
<Image source={parameter} style={{ width: 15, height: 15 }} />
<Pressable onPress={props.onEvent}>
<Image source={parameter} style={{tintColor: "#3F3C42", resizeMode: "contain", flex: 1, marginRight: "8%"}}/>
</Pressable>
</View>
<View id="IngredientList" style={styles.horizontalAlignement}>
<Pressable onPress={decreaseCounter} id="GoLeft" style={{}}>
<Image source={bracketLeft} style={{ width: 40, height: 40 }} />
<View style={styles.horizontalAlignment}>
<Pressable onPress={decreaseCounter}>
<Image source={bracketLeft} style={{width: 40, height: 40, tintColor: "#3F3C42", resizeMode: "contain"}}/>
</Pressable>
<FoodElementText title={props.listeIngredient[cpt]} />
<Pressable onPress={increaseCounter} id="GoRight" style={{}}>
<Image source={bracketRight} style={{ width: 40, height: 40 }} />
<FoodElementText title={props.ingredientList[cpt].title}/>
<Pressable onPress={increaseCounter}>
<Image source={bracketRight} style={{width: 40, height: 40, tintColor: "#3F3C42", resizeMode: "contain"}}/>
</Pressable>
</View>
</View>
@ -61,30 +54,26 @@ export default function SelectedIngredient(props: SelectedIngredientProps) {
const styles = StyleSheet.create({
view: {
width: 350,
height: 110,
width: "90%",
paddingBottom: "5%",
borderRadius: 15,
elevation: 3,
borderWidth: 1,
borderColor: 'black',
display: 'flex',
flexWrap: 'wrap',
borderColor: '#3F3C42',
backgroundColor: '#E3DEC9',
alignItems: "center",
justifyContent: "center",
},
horizontalAlignement: {
display: 'flex',
height: 30,
width: 350,
horizontalAlignment: {
width: "90%",
flexDirection: 'row',
justifyContent: 'space-around',
justifyContent: 'space-evenly',
alignItems: 'center',
marginTop: 10,
marginTop: "3%",
},
text: {
fontSize: 14,
lineHeight: 21,
fontSize: 15,
fontWeight: 'bold',
letterSpacing: 0.25,
color: 'black',
color: '#3F3C42',
flex: 1,
marginLeft: "8%",
},
});

@ -12,13 +12,12 @@ export default function TopBar(props) {
return (
<Appbar.Header style={{backgroundColor: '#F2F0E4'}} >
<Appbar.Content title={props.title} />
{props.isVisible && (
<>
<Appbar.Action icon="magnify" onPress={_handleSearch} />
<Appbar.Action icon="dots-vertical" onPress={_handleMore} />
</>
<Appbar.BackAction onPress={_goBack} color={"#3F3C42"}/>
<Appbar.Content title={props.title} color={"#3F3C42"}/>
{props.isVisible &&(
<><Appbar.Action icon="magnify" onPress={_handleSearch} color={"#3F3C42"}/>
<Appbar.Action icon="dots-vertical" onPress={_handleMore} color={"#3F3C42"}/>
</>
)}
</Appbar.Header>
);

@ -11,6 +11,23 @@ export default function CreateProfile(props) {
const colors = useContext(ColorContext).colors
const all = []
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
const handleCreateProfile = () => {
const profileData = {
name: "Nom du profil", // Remplacez par le nom du profil
avatar: "Lien de l'avatar", // Remplacez par le lien de l'avatar
diets: die.map(item => item.value), // Liste des régimes
allergies: all, // Liste des allergies
};
localStorage.setItem('profile', JSON.stringify(profileData));
console.log("Profil créé :", profileData);
// Redirection vers la page précédente avec un message de confirmation
props.navigation.goBack();
// Affichage d'un message
alert("Profil créé !");
};
const styles = StyleSheet.create({
linearGradient: {
@ -29,7 +46,7 @@ export default function CreateProfile(props) {
<View style={{marginTop: "6%"}}/>
<ProfileModification name="" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Create Profile" image="plus.png" colour={colors.cardTitle} backColour={colors.cardBackground} todo={() => (console.log("Profile Created"))}></ValidateButton>
<ValidateButton title="Create Profile" image="plus.png" colour={colors.cardTitle} backColour={colors.cardBackground} todo={handleCreateProfile}></ValidateButton>
<View style={{marginTop: "20%"}}/>
</LinearGradient>
</ScrollView>

@ -1,7 +1,8 @@
import React, { useContext, useEffect, useState } from 'react';
import { View, StyleSheet, Text, Image, Pressable, ActivityIndicator, FlatList } from 'react-native';
import React, { useEffect, useState, useContext } from 'react';
import { View, StyleSheet, Text, Image, Pressable, ActivityIndicator, FlatList, ScrollView, useWindowDimensions } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Searchbar } from 'react-native-paper';
import { LinearGradient } from 'expo-linear-gradient';
import FoodElementText from '../components/FoodElementText';
import CustomButton from '../components/CustomButton';
@ -47,8 +48,7 @@ export default function IngredientSelection(props) {
filterIngredients(query);
};
const loadIngredients = async () => {
const loadIngredients = async () => {
try {
const ingredients = await ingredientService.getAllIngredient();
setResponse(ingredients);
@ -65,7 +65,7 @@ export default function IngredientSelection(props) {
const AvailableItem = ({ value }: { value: Ingredient }) => (
<>
<View style={styles.horizontalAlignement}>
<View style={styles.horizontalAlignment}>
<FoodElementText title={value.name} />
<Pressable onPress={() => SelectIngredient(value)}>
<Image source={plus} style={{ width: 20, height: 20 }} />
@ -77,7 +77,7 @@ export default function IngredientSelection(props) {
const ChooseItem = ({ value }: { value: Ingredient }) => (
<>
<View style={styles.horizontalAlignement}>
<View style={styles.horizontalAlignment}>
<FoodElementText title={value.name} />
<Pressable onPress={() => RemoveIngredient(value.id)}>
<Image source={moins} style={{ width: 20, height: 20 }} />
@ -112,94 +112,91 @@ export default function IngredientSelection(props) {
};
return (
<SafeAreaProvider>
<View style={[styles.page, { backgroundColor: colors.primary }]}>
<View style={[styles.element, { backgroundColor: colors.cardBackground}]}>
<View style={[styles.horizontalAlignement, { margin: 10 }]}>
{alphabetArray.map((source, index) => (
<Pressable key={index} onPress={() => handleLetterPress(source)}>
<Text style={{ color: colors.cardDetail }}>{source}</Text>
</Pressable>
))}
</View>
<View>
<Searchbar
placeholder="Rechercher"
onChangeText={handleSearch}
value={searchQuery}
style={{
margin: 10,
backgroundColor: colors.cardBackground,
borderWidth: 1,
borderColor:colors.cardTitle,
borderRadius: 15,
height: 50,
}} />
</View>
<View style={{ alignItems: 'center', height: 300}}>
<FlatList
data={response ? response : []}
renderItem={({ item }) => (
<AvailableItem value={item} />
)}
keyExtractor={(item, index) => index.toString()}
ListEmptyComponent={() => (
isLoading ? <ActivityIndicator size="large" /> : <Text>Erreur lors du traitement des données</Text>
)}
style={{ flex: 1 }}
/>
</View>
<View style={{ height: 20 }}></View>
</View>
<View style={[styles.element, { marginTop: 40, backgroundColor: colors.cardBackground }]}>
<View style={[styles.horizontalAlignement, { justifyContent: "flex-start", marginLeft: 10 }]}>
<Text style={{ fontSize: 20, color: colors.cardTitle }}>Selected</Text>
</View>
<View style={{ height: 5 }}></View>
<View style={{ alignItems: 'center', maxHeight: 200}}>
<FlatList
data={selectedIngredients}
renderItem={({ item }) => (
<ChooseItem value={item} />
)}
keyExtractor={(item, index) => index.toString()}
style={{ flex: 1 }}
/>
</View>
<View style={{ height: 20 }}></View>
</View>
<View style={{ height: 15 }}></View>
<CustomButton title="Find a recipe" />
</View>
<SafeAreaProvider style={{flex: 1}}>
<ScrollView>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={{marginTop: "6%"}}/>
<View style={styles.element}>
<View style={[styles.horizontalAlignment, { margin: 10 }]}>
{alphabetArray.map((source, index) => (
<Pressable key={index} onPress={() => handleLetterPress(source)}>
<Text style={{ color: "blue" }}>{source}</Text>
</Pressable>
))}
</View>
<View>
<Searchbar
placeholder="Search"
onChangeText={handleSearch}
value={searchQuery}
style={{margin: "3%",
backgroundColor: '#F2F0E4',
borderWidth : 1,
borderColor: "#ACA279",
borderRadius: 15,
}}/>
</View>
<View style={{flex: 1, maxHeight: 300}}>
<FlatList
data={response ? response : []}
renderItem={({ item }) => (
<AvailableItem value={item} />
)}
keyExtractor={(item, index) => index.toString()}
ListEmptyComponent={() => (
isLoading ? <ActivityIndicator size="large" /> : <Text>Erreur lors du traitement des données</Text>
)}
style={{ flex: 1 }}
/>
<View style={{ marginTop: '6%' }}></View>
</View>
</View>
<View style={{marginTop: "6%"}}/>
<View style={styles.element}>
<View style={[styles.horizontalAlignment, {justifyContent: "flex-start", marginLeft: "5%"}]}>
<Text style={{fontSize: 20, color: '#ACA279'}}>Available</Text>
</View>
<View style={{flex: 1, maxHeight: 300}}>
<FlatList
data={selectedIngredients}
renderItem={({ item }) => (
<ChooseItem value={item} />
)}
keyExtractor={(item, index) => index.toString()}
style={{ flex: 1 }}
/>
<View style={{ height: 20 }}></View>
</View>
</View>
<View style={{marginTop: "8%"}}></View>
<CustomButton title="Find a recipe"/>
<View style={{marginBottom: "20%"}}></View>
</LinearGradient>
</ScrollView>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({
page: {
flex: 1,
alignItems: 'center',
display: 'flex',
flexWrap: 'wrap',
padding: 20,
linearGradient: {
width: "100%",
flex: 1,
padding: "3%",
paddingTop: 0,
alignItems: "center",
justifyContent: "flex-start",
},
element: {
width: "100%",
backgroundColor:'#F2F0E4',
borderRadius: 30,
},
horizontalAlignement: {
display: 'flex',
height: 30,
width: 350,
horizontalAlignment: {
width: "100%",
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
marginTop: 15,
marginTop: "3%",
}
});
});

@ -34,6 +34,23 @@ export default function Profiles({navigation, props}) {
setOpacity(1)
}
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 styles = StyleSheet.create({
container: {
height: "100%",
@ -143,39 +160,26 @@ export default function Profiles({navigation, props}) {
},
});
const profileComponents = profiles.map((profile, index) => (
<View key={index}>
<ProfileDetails
name={profile.name}
avatar={profile.avatar}
diets={profile.diets}
allergies={profile.allergies}
onDeleteProfile={raisePopUp}
/>
{index < profiles.length - 1 && <View style={styles.separator} />}
</View>
));
return (
<SafeAreaProvider style={{flex: 1}}>
<ScrollView>
<View style={{opacity: opacity, height: "100%", width: "100%", flex: 1}}>
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={styles.separator}/>
<ProfileDetails
name="Johnny Silverhand"
avatar="plus_small.png"
diets={dieJohnny}
allergies={allJohnny}
onDeleteProfile={raisePopUp}/>
<View style={styles.separator}/>
<ProfileDetails
name="Jackie Welles"
avatar="plus_small.png"
diets={dieJackie}
allergies={allJackie}
onDeleteProfile={raisePopUp} />
<View style={styles.separator}/>
<ProfileDetails
name="Goro Takemura"
avatar="plus_small.png"
diets={dieGoro}
allergies={allGoro}
onDeleteProfile={raisePopUp} />
<View style={styles.separator}/>
<ProfileDetails
name="Viktor Vector"
avatar="plus_small.png"
diets={dieViktor}
allergies={allViktor}
onDeleteProfile={raisePopUp} />
{profileComponents}
<View style={styles.modal}>
<Modal visible={visible} onRequestClose={erasePopUp} animationType="fade" transparent={true}>
<View style={styles.modal}>
@ -210,4 +214,4 @@ export default function Profiles({navigation, props}) {
</ScrollView>
</SafeAreaProvider>
);
}
}

@ -1,11 +1,13 @@
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Text} from 'react-native';
import { View, StyleSheet, Text, ScrollView, useWindowDimensions} from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import RecipeElementReduce from '../components/RecipeElementReduce';
import AllergiesTab from '../components/ListWithoutSelect';
import RecipesService from '../Services/Recipes/RecipesServices';
import Recipes from '../Models/Recipes';
import { LinearGradient } from 'expo-linear-gradient';
import ListWithoutSelect from '../components/ListWithoutSelect';
export default function RecipeDetails(props) {
@ -43,64 +45,75 @@ export default function RecipeDetails(props) {
return (
<SafeAreaProvider>
<View style={styles.page}>
<RecipeElementReduce
title={response.name}
<ScrollView>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={{marginTop: "6%"}}>
<RecipeElementReduce
title={response.name}
number={response.id}
duree={convertToHoursMinutes(response.time_to_cook)}/>
<View style={{height: 20}}></View>
<View style={styles.element}>
<View style={[styles.horizontalAlignement, {justifyContent: "flex-start", marginLeft: 10}]}>
<Text style={{fontSize: 20, color: '#ACA279'}}>Preparation</Text>
</View>
<View style={{margin: 20}}>
<AllergiesTab title="Ingredient" content={response.ingredients.map(ingredient => `- ${ingredient.name}`)}></AllergiesTab>
<View style={{height: 5}}></View>
{/* <AllergiesTab title="Ustensils" content={null}></AllergiesTab>*/}
</View>
</View >
<View style={{height: 20}}></View>
<View style={styles.element}>
<View style={[styles.horizontalAlignement, {justifyContent: "flex-start", marginLeft: 10}]}>
<Text style={{fontSize: 20, color: '#ACA279'}}>Cooking</Text>
</View>
<View style={{margin: 20}}>
<AllergiesTab title="Steps" content={response.steps.map((step, index) => `${index + 1} - ${step}`)}></AllergiesTab>
</View>
</View>
</View>
duration={convertToHoursMinutes(response.time_to_cook)} image={''}/>
</View>
<View style={styles.separator}/>
<View style={styles.background}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Preparation</Text>
</View>
<ListWithoutSelect title="Ingredients" content={response.ingredients.map(ingredient => `- ${ingredient.name}`)}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
</View>
<View style={styles.separator}/>
<View style={styles.background}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Cooking</Text>
</View>
<ListWithoutSelect title="Steps" content={response.steps.map((step, index) => `${index + 1} - ${step}`)}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
</View>
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</ScrollView>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({
page: {
flex: 1,
backgroundColor: '#59BDCD',
alignItems: 'center',
display: 'flex',
flexWrap: 'wrap',
padding: 20,
linearGradient: {
width: "100%",
flex: 1,
alignItems: "center",
justifyContent: "flex-start"
},
element: {
backgroundColor:'#F2F0E4',
borderRadius: 30,
separator: {
marginTop: "6%",
},
background: {
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 20,
backgroundColor: '#F2F0E4',
padding: "3%",
marginHorizontal: "3%",
},
filterBar: {
flexDirection: "row",
width: "85%",
paddingTop: "3%",
paddingBottom: "2%",
alignItems: "flex-end",
justifyContent: "center",
},
filters: {
fontSize: 20,
color: '#ACA279',
flex: 1,
},
nbSelected: {
fontSize: 11,
color: "#3F3C42",
textAlign: "right",
},
horizontalAlignement: {
display: 'flex',
height: 30,
width: 350,
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
marginTop: 10,
}
});

@ -1,176 +1,242 @@
import React, { useState } from 'react';
import { View, StyleSheet, Text, Image, Pressable} from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Modal, Portal, PaperProvider} from 'react-native-paper';
import {View, StyleSheet, Text, Image, Pressable, useWindowDimensions, ScrollView} from 'react-native';
import {SafeAreaProvider } from 'react-native-safe-area-context';
import {Modal, Portal, PaperProvider} from 'react-native-paper';
import {LinearGradient} from 'expo-linear-gradient';
import TopBar from '../components/TopBar';
import RecipeElement from '../components/RecipeElement';
import SelectedIngredient from '../components/SelectedIngredient';
import FoodElementTextSimple from '../components/FoodElementTextSimple';
import FoodElementText from '../components/FoodElementText';
import CustomButton from '../components/CustomButton';
import DietsTab from '../components/DietsTab';
import DietsTab from '../components/ListSelect';
import brochette from '../assets/images/brochette.png';
import ParameterTopBar from '../components/ParameterTopBar';
import ListSelect from '../components/ListSelect';
import ListWithoutSelect from '../components/ListWithoutSelect';
import ValidateButton from '../components/ValidateButton';
import bracketLeft from '../assets/images/angle_bracket_left.png';
import bracketRight from '../assets/images/angle_bracket_right.png';
import plus from '../assets/images/plus_small.png';
import minus from '../assets/images/minus.png';
export default function RecipeSuggestion(props) {
const imageList = [];
const [visible, setVisible] = React.useState(false);
const [visibleFilters, setVisibleFilters] = React.useState(false);
const [visibleIngredients, setVisibleIngredients] = React.useState(true);
const [minCpt, setMinCpt] = useState(0);
const [maxCpt, setMaxCpt] = useState(4);
const listeIngredient = props.list;
const limitedList = listeIngredient.slice(minCpt, maxCpt);
const showModal = () => setVisible(true);
const hideModal = () => setVisible(false);
const ingredientList = [{title: "Steak"}, {title: "Sheep Ribs"}, {title: "Rabbit Thigh"}, {title: "Ham"}, {title: "Cream (Liquid)"}, {title: "Pepper Bell"}]
const ingredientListV2 = [{title: "Smoked Salmon"}, {title: "Tomato"}, {title: "Carrot"}]
const limitedList = ingredientList.slice(minCpt, maxCpt);
const [colorIngredients, setColorIngredients] = useState("#59BDCD");
const [colorFilters, setColorFilters] = useState("#3F3C42");
const die = [{value: "Gluten free"}, {value: "Porkless"}, {value: "Gluten free"}, {value: "Porkless"}]
const all = []
const containerStyle = {
backgroundColor: 'white',
height: 450,
width: 380,
//minHeight: useWindowDimensions().height/2,
//width: useWindowDimensions().width,
height: "75%",
width: "100%",
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
};
const handleChildEvent = (value) => {
setVisible(!visible)
};
const handleChildEventGoFilters = (value) => {
const handleChildEvent = () => {
setVisible(!visible)
}
const handleChildEventGoFilters = () => {
setVisibleIngredients(false);
setVisibleFilters(true);
setColorFilters("#59BDCD")
setColorIngredients("#3F3C42")
}
const handleChildEventGoIngredients = (value) => {
const handleChildEventGoIngredients = () => {
setVisibleFilters(false);
setVisibleIngredients(true);
console.log("jai change pour iingredient");
setColorFilters("#3F3C42")
setColorIngredients("#59BDCD")
}
const decreaseCounter = () => {
if (minCpt > 0) {
setMinCpt(minCpt - 4);
setMaxCpt(maxCpt - 4)
}
};
}
else{
setMaxCpt(ingredientList.length+ingredientList.length%4)
var cpt=ingredientList.length-(ingredientList.length%4)
setMinCpt(cpt)
}
}
const increaseCounter = () => {
if (maxCpt < listeIngredient.length) {
if (maxCpt < ingredientList.length) {
setMinCpt(minCpt + 4);
setMaxCpt(maxCpt + 4)
}
};
}
else{
setMinCpt(0)
setMaxCpt(4)
}
}
const imageElements = limitedList.map((source, index) => (
<View style={[styles.horizontalAlignement, { marginBottom: 10 }]}>
<FoodElementText key={index} title={source} />
<Image source={brochette} style={{ width: 20, height: 20 }} />
<Image source={brochette} style={{ width: 20, height: 20 }} />
<View style={[styles.horizontalAlignment, {marginVertical: "3%"}]}>
<FoodElementTextSimple title={source.title}/>
<Image source={plus} style={{width: 20, resizeMode: "contain"}}/>
<Image source={minus} style={{width: 20, resizeMode: "contain"}}/>
</View>
));
return (
<SafeAreaProvider>
<SafeAreaProvider style={{flex: 1}}>
<PaperProvider>
<TopBar title="Recipes" isVisible="true"/>
<View style={styles.page}>
<SelectedIngredient
listeIngredient={props.list}
listeImage={imageList}
onEvent={handleChildEvent}
/>
<View style={{ marginTop: 100 }}>
<RecipeElement
number="13"
title="Pizza with Pineapples"
imageList={imageList}
textList={props.list}
description="delicious plate that will please you"
style={styles.element}
/>
</View>
</View>
<View style={styles.modal}>
<PaperProvider>
<Portal>
<Modal visible={visible} onDismiss={hideModal} contentContainerStyle={containerStyle}>
<ParameterTopBar onEventFilter={handleChildEventGoFilters} onEventIngredient={handleChildEventGoIngredients}></ParameterTopBar>
{visibleIngredients && (
<View style={[styles.page, { justifyContent: 'space-between' }]}>
{imageElements}
<View id="IngredientList" style={[styles.horizontalAlignement, {marginTop: 10}]}>
<Pressable onPress={decreaseCounter} id="GoLeft" >
<Image source={bracketLeft} style={{ width: 20, height: 20 }} />
</Pressable>
<Pressable onPress={increaseCounter} id="GoRight">
<Image source={bracketRight} style={{ width: 20, height: 20 }} />
</Pressable>
</View>
<View>
<CustomButton title="Save"></CustomButton>
</View>
<ScrollView>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={{marginTop: "6%"}}/>
<SelectedIngredient
ingredientList={ingredientList}
onEvent={handleChildEvent}/>
<ScrollView style={{marginTop: "6%"}} horizontal={true}>
<View style={{marginHorizontal: 10}}/>
<RecipeElement
number="63"
title="Meat Stick"
textList={ingredientList}
description="Delicious stick with 4 meats. Accessible for beginners. 20 min or less to cook."/>
<View style={{marginHorizontal: 10}}/>
<RecipeElement
number="03"
title="Vichyssoise"
textList={ingredientListV2}
description="Cold soup of vegetables. Difficult recipe. Not advised to beginners. 1h or more."/>
<View style={{marginHorizontal: 10}}/>
</ScrollView>
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</ScrollView>
<Portal>
<Modal visible={visible} onDismiss={handleChildEvent} contentContainerStyle={containerStyle} style={{marginTop: 0, justifyContent: "flex-end"}}>
<ParameterTopBar onEventFilter={handleChildEventGoFilters} onEventIngredient={handleChildEventGoIngredients} colorFilters={colorFilters} colorIngredients={colorIngredients}/>
{visibleIngredients &&(
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {paddingHorizontal: "3%"}]}>
{imageElements}
<View style={[styles.horizontalAlignment, {marginTop: "6%"}]}>
<Pressable onPress={decreaseCounter}>
<Image source={bracketLeft} style={{width: 30, height: "100%", resizeMode: "contain", tintColor: "#3F3C42"}}/>
</Pressable>
<CustomButton title="Save"></CustomButton>
<Pressable onPress={increaseCounter}>
<Image source={bracketRight} style={{width: 30, height: "100%", resizeMode: "contain", tintColor: "#3F3C42"}}/>
</Pressable>
</View>
)}
{visibleFilters &&(
<View style={[styles.page, { justifyContent: 'space-between', alignContent: 'center'}]}>
<View style={{backgroundColor: '#F2F0E4', zIndex: 2}}>
<View style={[styles.horizontalAlignement, {justifyContent: "flex-start", marginLeft: 20}]}>
<Text style={{fontSize: 20, color: '#ACA279'}}>Available</Text>
</View>
<View style={{alignContent: 'center', justifyContent: 'space-between', margin: 10}}>
<DietsTab title="Diets" content={props.diets}></DietsTab>
<View style={{height: 5}}></View>
<DietsTab title="Allergy" content={props.allergy}></DietsTab>
</View>
</LinearGradient>
)}
{visibleFilters &&(
<ScrollView>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {paddingHorizontal: "3%"}]}>
<View style={{marginTop: "10%"}}/>
<View style={styles.background}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Additional Filters</Text>
<Text style={styles.nbSelected}>{die.length} selected</Text>
</View>
<View style={{zIndex: 1, position: 'absolute', marginTop: 300}} >
<CustomButton title="Save"></CustomButton>
</View>
</View>
)}
</Modal>
</Portal>
</PaperProvider>
</View>
<ListWithoutSelect title="Diets" content={die}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
<ListWithoutSelect title="Allergies" content={all}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Add Allergy" image="plus.png" colour="#59BDCD" backColour="#E3DEC9"></ValidateButton>
</View>
<View style={{marginTop: "6%"}}/>
<View>
<CustomButton title="Save"></CustomButton>
</View>
<View style={{marginTop: "43%"}}/>
</LinearGradient>
</ScrollView>
)}
</Modal>
</Portal>
</PaperProvider>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({
page: {
flex: 1,
backgroundColor: '#59BDCD',
alignItems: 'center',
display: 'flex',
flexWrap: 'wrap',
padding: 20,
linearGradient: {
width: "100%",
flex: 1,
//padding: "2%",
paddingTop: 0,
alignItems: "center",
justifyContent: "center"
},
background: {
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 20,
backgroundColor: '#F2F0E4',
padding: "3%",
marginHorizontal: "3%",
},
filterBar: {
flexDirection: "row",
width: "85%",
paddingTop: "3%",
paddingBottom: "2%",
alignItems: "flex-end",
justifyContent: "center",
},
element: {
marginTop: 20,
filters: {
fontSize: 20,
color: '#ACA279',
flex: 1,
},
backdrop: {
backgroundColor: 'rgba(0, 0, 0, 0.5)',
nbSelected: {
fontSize: 11,
color: "#3F3C42",
textAlign: "right",
},
page: {
flex: 1,
backgroundColor: '#59BDCD',
alignItems: 'center',
paddingHorizontal: "3%",
},
modal :{
position: 'absolute',
top: '50%', // Centre verticalement
left: '50%', // Centre horizontalement
transform: [{ translateX: -185 }, { translateY: -90 }], // Ajustez en fonction de la moitié de la hauteur et de la largeur
top: '50%',
height: "50%",
width: "100%",
borderWidth: 1,
borderColor: "red",
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
},
horizontalAlignement: {
horizontalAlignment: {
display: 'flex',
height: 30,
width: '80%',
height: "10%",
width: "100%",
flexDirection: 'row',
justifyContent: 'space-around',
justifyContent: 'space-between',
alignItems: 'center',
marginTop: 10,
}
},
recipes: {
flexDirection: "row",
overflow: "scroll",
alignItems: "flex-start",
justifyContent: "center",
},
});

@ -0,0 +1,4 @@
{
"compilerOptions": {},
"extends": "expo/tsconfig.base"
}
Loading…
Cancel
Save