start to binding profiles
continuous-integration/drone/push Build is passing Details

pull/20/head
Rayhân HASSOU 1 year ago
parent d1f941c154
commit dea2c7d0e1

@ -12,6 +12,23 @@ export default function CreateProfile(props) {
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: {
height: "100%",
@ -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>

@ -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}>

@ -8,7 +8,7 @@ import RecipeElement from '../components/RecipeElement';
import SelectedIngredient from '../components/SelectedIngredient';
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';

Loading…
Cancel
Save