Merge pull request 'WORK-RHA2' (#21) from WORK-RHA2 into master
continuous-integration/drone/push Build is passing Details

Reviewed-on: #21
pull/22/head
Rayhân HASSOU 1 year ago
commit 4bdd582985

@ -1,20 +1,23 @@
export default class Profil {
private _id: number;
private _name: string;
private _avatar: string;
private _allergy: string[];
private _diets: string[];
constructor(id: number, name: string) {
this._id = id;
constructor( name: string, avatar: string, allergy: string[], diets: string[]) {
this._name = name;
this._avatar = avatar;
this._allergy = allergy;
this._diets = diets;
}
get name(): string {
return this._name;
}
get id(): number{
return this._id;
get avatar(): string{
return this._avatar;
}
get allergy(): string[]{

@ -6,10 +6,12 @@ import ColorContext from '../theme/ColorContext';
type ListProps = {
title: string
content : string[]
val : string[]
setSelected: any;
}
export default function ListSelect(props: ListProps) {
const [selected, setSelected] = React.useState([]);
const {colors} = useContext(ColorContext);
const styles = StyleSheet.create({
@ -74,7 +76,7 @@ export default function ListSelect(props: ListProps) {
},
badgesText: {
fontSize: 15,
color: colors.cardElementText,
color: colors.badgeText,
},
box: {
borderColor: "#3F3C42"
@ -83,7 +85,7 @@ export default function ListSelect(props: ListProps) {
return (
<MultipleSelectList
setSelected={(val) => setSelected(val)}
setSelected={(val) => props.setSelected(val)}
data={props.content}
save="value"
search={false}
@ -98,6 +100,7 @@ export default function ListSelect(props: ListProps) {
checkBoxStyles={styles.box}
notFoundText="All Diets Already Selected"
placeholder={props.title}
labelStyles={styles.title}
label={props.title}/>
);
}

@ -5,12 +5,14 @@ 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);
const styles = StyleSheet.create({
titleBar: {
flexDirection: "row",
@ -58,6 +60,7 @@ export default function ListWithoutSelect(props: ListProps) {
width: "100%",
minWidth: 250,
maxWidth: 250,
backgroundColor: colors.cardElementBackground,
},
itemText: {
fontSize: 13,
@ -71,11 +74,13 @@ export default function ListWithoutSelect(props: ListProps) {
box: {
borderWidth: 0,
flex: 0,
backgroundColor: colors.cardElementBackground,
}
});
return (
<MultipleSelectList
setSelected={(val) => setSelected(val)}
data={props.content}
save="value"
search={false}
@ -84,8 +89,11 @@ export default function ListWithoutSelect(props: ListProps) {
inputStyles={styles.title}
dropdownStyles={styles.itemList}
dropdownItemStyles={styles.itemCell}
disabledItemStyles={styles.itemCell}
dropdownTextStyles={styles.itemText}
disabledTextStyles={styles.itemText}
checkBoxStyles={styles.box}
disabledCheckBoxStyles={styles.box}
notFoundText="None"
placeholder={props.title}
label={props.title}/>

@ -9,6 +9,7 @@ type ProfileProps = {
avatar: string
diets: string[]
allergies: string[]
onModification: () => void
onDeleteProfile: () => void
}
@ -78,10 +79,10 @@ export default function ProfileDetails(props) {
},
modify: {
height: "100%",
width: "100%",
tintColor: colors.cardElementBorder,
resizeMode: 'contain',
flex: 0.1,
marginLeft: "3%",
flex: 1,
},
delete: {
height: "100%",
@ -128,7 +129,9 @@ export default function ProfileDetails(props) {
<View style={styles.pseudoBar}>
<Image source={imageSource} style={styles.avatar}></Image>
<Text style={styles.text}>{props.name}</Text>
<Image source={require("../assets/images/modify.png")} style={styles.modify}></Image>
<Pressable onPress={props.onModification} style={{flex: 0.1, marginRight: "1%",}}>
<Image source={require("../assets/images/modify.png")} style={styles.modify}></Image>
</Pressable>
<Pressable onPress={props.onDeleteProfile} style={{flex: 0.1, marginLeft: "1%",}}>
<Image source={require("../assets/images/delete.png")} style={styles.delete}></Image>
</Pressable>

@ -33,18 +33,15 @@ export default function ProfileElement(props : Profile) {
else{
setSeparator("none")
}
console.log(waiting, separator, props.name)
}
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({

@ -9,8 +9,8 @@ import ColorContext from '../theme/ColorContext';
type ProfileProps = {
name: string
avatar: string
diets: string[]
allergies: string[]
diets: {value: string}[]
allergies: {value: string}[]
}
export default function ProfileModification(props: ProfileProps) {
@ -60,7 +60,7 @@ export default function ProfileModification(props: ProfileProps) {
},
textInput: {
fontSize: 15,
color: colors.cardTitle,
color: colors.cardDetail,
borderRadius: 10,
borderWidth: 2,
borderStyle: 'dashed',
@ -92,11 +92,6 @@ export default function ProfileModification(props: ProfileProps) {
color: colors.cardElementBorder,
flex: 1,
},
nbSelected: {
fontSize: 11,
color: colors.cardDetail,
textAlign: "right",
}
});
return (
@ -108,7 +103,6 @@ export default function ProfileModification(props: ProfileProps) {
</View>
<View style={styles.filterBar}>
<Text style={styles.filters}>Filters</Text>
<Text style={styles.nbSelected}>0 diets selected</Text>
</View>
<ListSelect title="Diets" content={props.diets}></ListSelect>
<View style={{marginTop: "6%"}}/>

@ -19,7 +19,7 @@ export default function CookingStackScreen() {
options={{
headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'},
headerTitle: () => (
<HeaderTitle title='Profile Modification'/>
<HeaderTitle title='Ingredient Selection'/>
)
}}
/>

@ -34,7 +34,10 @@ export default function ProfilesStackScreen({ navigation }) {
}
})
const _handleSearch = () => console.log('Searching');
const _handleSearch = () => {
console.log('Searching');
navigation.navigate('ProfileModification')
}
const _handleHeaderAdd = () => navigation.navigate('ProfileCreation');
return (

@ -17,6 +17,7 @@
"axios": "^1.6.2",
"expo": "~49.0.15",
"expo-blur": "^12.4.1",
"expo-image-picker": "~14.3.2",
"expo-linear-gradient": "~12.3.0",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
@ -9282,6 +9283,25 @@
"expo": "*"
}
},
"node_modules/expo-image-loader": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/expo-image-loader/-/expo-image-loader-4.3.0.tgz",
"integrity": "sha512-2kqJIO+oYM8J3GbvTUHLqTSpt1dLpOn/X0eB4U4RTuzz/faj8l/TyQELsMBLlGAkweNUuG9LqznbaBz+WuSFEw==",
"peerDependencies": {
"expo": "*"
}
},
"node_modules/expo-image-picker": {
"version": "14.3.2",
"resolved": "https://registry.npmjs.org/expo-image-picker/-/expo-image-picker-14.3.2.tgz",
"integrity": "sha512-xr/YeQMIYheXecWP033F2SPwpBlBR5xVCx7YSfSCTH8Y9pw7Z886agqKGbS9QBVGlzJ5qecJktZ6ASSzeslDVg==",
"dependencies": {
"expo-image-loader": "~4.3.0"
},
"peerDependencies": {
"expo": "*"
}
},
"node_modules/expo-keep-awake": {
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-12.3.0.tgz",
@ -24641,6 +24661,20 @@
"fontfaceobserver": "^2.1.0"
}
},
"expo-image-loader": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/expo-image-loader/-/expo-image-loader-4.3.0.tgz",
"integrity": "sha512-2kqJIO+oYM8J3GbvTUHLqTSpt1dLpOn/X0eB4U4RTuzz/faj8l/TyQELsMBLlGAkweNUuG9LqznbaBz+WuSFEw==",
"requires": {}
},
"expo-image-picker": {
"version": "14.3.2",
"resolved": "https://registry.npmjs.org/expo-image-picker/-/expo-image-picker-14.3.2.tgz",
"integrity": "sha512-xr/YeQMIYheXecWP033F2SPwpBlBR5xVCx7YSfSCTH8Y9pw7Z886agqKGbS9QBVGlzJ5qecJktZ6ASSzeslDVg==",
"requires": {
"expo-image-loader": "~4.3.0"
}
},
"expo-keep-awake": {
"version": "12.3.0",
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-12.3.0.tgz",

@ -31,7 +31,8 @@
"react-native-splash-screen": "^3.3.0",
"react-native-virtualized-view": "^1.0.0",
"react-native-web": "~0.19.6",
"typescript": "^5.1.3"
"typescript": "^5.1.3",
"expo-image-picker": "~14.3.2"
},
"devDependencies": {
"@babel/core": "^7.20.0"

@ -1,32 +1,81 @@
import React, { useContext } from 'react';
import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native';
import React, { useContext, useState } from 'react';
import {StyleSheet, View, ScrollView, useWindowDimensions, TextInput, Image, Text, NativeEventEmitter, Pressable} from 'react-native';
import { LinearGradient } from 'expo-linear-gradient';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import ProfileModification from '../components/ProfileModification';
import ValidateButton from '../components/ValidateButton';
import ColorContext from '../theme/ColorContext';
import ListWithoutSelect from '../components/ListWithoutSelect';
import ListSelect from '../components/ListSelect';
import AsyncStorage from '@react-native-async-storage/async-storage';
import EventEmitter from './EventEmitter';
import * as ImagePicker from 'expo-image-picker';
export default function CreateProfile(props) {
const { colors } = useContext(ColorContext)
const all = []
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
const [name, onChangeName] = useState();
const [avatar, setAvatar] = useState<string>('');
const [selectedDiets, setSelectedDiets] = useState([]);
const handleSelectedDiets = (selectedValues) => {
setSelectedDiets(selectedValues);
};
const pickImage = async () => {
// No permissions request is necessary for launching the image library
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
});
console.log(result);
if (!result.canceled) {
setAvatar(result.assets[0].uri);
}
};
let imageSource
if (props.avatar == "plus.png"){
imageSource = {uri: avatar}
}
else if (props.avatar == "plus_small.png"){
imageSource = {uri: avatar}
}
else{
imageSource = {uri: avatar}
}
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
};
const handleCreateProfile = async () => {
try {
// Ton code pour récupérer les profils existants et ajouter un nouveau profil
const newProfile = {
name: name,
avatar: avatar,
diets: selectedDiets,
allergies: all,
};
localStorage.setItem('profile', JSON.stringify(profileData));
console.log("Profil créé :", profileData);
// Mettre à jour AsyncStorage avec le nouveau profil
let existingProfiles = await AsyncStorage.getItem('profiles');
existingProfiles = existingProfiles ? JSON.parse(existingProfiles) : [];
const updatedProfiles = [...existingProfiles, newProfile];
await AsyncStorage.setItem('profiles', JSON.stringify(updatedProfiles));
EventEmitter.emit('profileAdded');
// Redirection vers la page précédente avec un message de confirmation
props.navigation.goBack();
// Affichage d'un message
alert("Profil créé !");
console.log('Profil créé :', newProfile);
props.navigation.goBack();
alert('Profil créé !');
} catch (error) {
console.error('Erreur lors de la création du profil :', error);
}
};
const styles = StyleSheet.create({
@ -36,7 +85,74 @@ export default function CreateProfile(props) {
flex: 1,
padding: "2%",
paddingTop: 0,
},background: {
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 15,
backgroundColor: colors.cardBackground,
padding: "3%",
marginHorizontal: "3%",
borderWidth: 1,
borderColor: colors.blocBorder,
},
pseudoBar: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
width: "100%",
marginHorizontal: "3%",
marginBottom: "3%",
},
avatar: {
padding: "5%",
resizeMode: 'contain',
borderWidth: 2,
borderColor: colors.cardElementBorder,
borderRadius: 45,
height: "100%",
flex: 0.04,
},
textInput: {
fontSize: 15,
color: colors.cardTitle,
borderRadius: 10,
borderWidth: 2,
borderStyle: 'dashed',
borderColor: colors.cardElementBorder,
alignItems: 'center',
textAlign: 'left',
flex: 0.8,
marginLeft: "7%",
padding: "2%",
},
modify: {
height: "100%",
tintColor: colors.cardElementBorder,
resizeMode: 'contain',
flex: 0.1,
marginLeft: "3%",
},
filterBar: {
flexDirection: "row",
width: "85%",
paddingTop: "3%",
paddingBottom: "2%",
alignItems: "flex-end",
justifyContent: "center",
},
filters: {
fontSize: 20,
color: colors.cardElementBorder,
flex: 1,
},
nbSelected: {
fontSize: 11,
color: colors.cardDetail,
textAlign: "right",
}
});
return (
@ -44,7 +160,22 @@ export default function CreateProfile(props) {
<ScrollView>
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={{marginTop: "6%"}}/>
<ProfileModification name="" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
<View style={styles.background}>
<View style={styles.pseudoBar}>
<Pressable onPress={pickImage}>
<Image source={imageSource} style={styles.avatar}></Image>
</Pressable>
<TextInput style={styles.textInput} value={name} onChangeText={onChangeName} placeholder="Name"></TextInput>
</View>
<View style={styles.filterBar}>
<Text style={styles.filters}>Filters</Text>
<Text style={styles.nbSelected}>"0 diets selected</Text>
</View>
<ListSelect title="Diets" content={die} setSelected={handleSelectedDiets}></ListSelect>
<View style={{marginTop: "6%"}}/>
<ListWithoutSelect title="Allergies" content={all}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
</View>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Create Profile" image="plus.png" colour={colors.buttonMain} backColour={colors.cardBackground} todo={handleCreateProfile}></ValidateButton>
<View style={{marginTop: "20%"}}/>

@ -0,0 +1,5 @@
import { NativeEventEmitter } from 'react-native';
const eventEmitter = new NativeEventEmitter();
export default eventEmitter;

@ -70,7 +70,7 @@ export default function HomePage({ navigation, props }) {
},
filters: {
fontSize: 20,
color: colors.cardTitle,
color: colors.cardElementBorder,
flex: 1,
},
nbSelected: {
@ -121,6 +121,16 @@ export default function HomePage({ navigation, props }) {
}
});
const nbActiveProfiles = () => {
let cpt = 0
profiles.forEach((val) => {
if(val.isActive == "flex"){
cpt += 1
}
})
return cpt
}
return (
<SafeAreaProvider style={{flex: 1}}>
<ScrollView>
@ -130,7 +140,7 @@ export default function HomePage({ navigation, props }) {
<View style={{flexDirection: "column", alignItems: "flex-start", justifyContent: "center", width: "100%"}}>
<View style={{flexDirection: "row"}}>
<Text style={styles.text}>Welcome </Text>
<Text style={styles.name}>Rayhân</Text>
<Text style={styles.name}>Louison</Text>
<Text style={styles.text}>,</Text>
</View>
<Text style={styles.text}>Glad to see you again!</Text>
@ -140,7 +150,7 @@ export default function HomePage({ navigation, props }) {
<View style={styles.profilesSelection}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Profiles</Text>
<Text style={styles.nbSelected}>2 selected</Text>
<Text style={styles.nbSelected}>{nbActiveProfiles()} selected</Text>
</View>
<View style={{marginTop: "3%"}}/>
<ProfileSelection listProfile={profiles} disableSelection={true}/>

@ -28,7 +28,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 +40,6 @@ export default function IngredientSelection(props) {
}
};
// Appelée à chaque changement de la recherche
const handleSearch = (query) => {
setSearchQuery(query);
filterIngredients(query);

@ -15,12 +15,12 @@ export default function ModifyProfile(props) {
return (
<SafeAreaProvider style={{flex: 1}}>
<ScrollView style={{minHeight: useWindowDimensions().height}}>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={{marginTop: "6%"}}/>
<ProfileModification name="Johnny Silverhand" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Update Profile" image="update.png" colour={colors.buttonMain} backColour={colors.buttonBackground} todo={() => (console.log("Profile Modified"))}></ValidateButton>
<View style={{marginBottom: "20%"}}/>
<ValidateButton title="Update Profile" image="update.png" colour={colors.buttonMain} backColour={colors.cardBackground} todo={() => (console.log("Profile Modified"))}></ValidateButton>
<View style={{marginTop: "20%"}}/>
</LinearGradient>
</ScrollView>
</SafeAreaProvider>
@ -28,14 +28,6 @@ export default function ModifyProfile(props) {
}
const styles = StyleSheet.create({
container: {
height: "100%",
width: "100%",
flex: 1,
backgroundColor: '#3F3C42',
alignItems: 'center',
justifyContent: 'center',
},
linearGradient: {
height: "100%",
width: "100%",

@ -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,48 +7,86 @@ 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';
import EventEmitter from './EventEmitter';
import Profil from '../Models/Profil';
import { PaperProvider, Portal } from 'react-native-paper';
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 raisePopUp = () => {
const [opacity, setOpacity] = useState(1);
const [profiles, setProfiles] = useState([]);
const [selectedProfileIndex, setSelectedProfileIndex] = useState(null);
const raisePopUp = (index) => {
setSelectedProfileIndex(index)
setVisible(true)
}
const erasePopUp = () => {
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 handleDeleteProfile = async (index) => {
try {
const updatedProfiles = profiles.filter((profile, i) => i !== index);
await AsyncStorage.setItem('profiles', JSON.stringify(updatedProfiles));
fetchProfiles();
setSelectedProfileIndex(index);
erasePopUp();
} catch (error) {
console.error('Erreur lors de la suppression du profil :', error);
}
};
const confirmDelete = () => {
erasePopUp();
};
const handleGetProfiles = async () => {
try {
const existingProfiles = await AsyncStorage.getItem('profiles');
return JSON.parse(existingProfiles) || [];
} catch (error) {
console.log("ça maaaaaaaaarche poaaaaaaaaaaaas");
return [];
}
}
const fetchProfiles = async () => {
const existingProfiles = await handleGetProfiles();
setProfiles(existingProfiles);
};
const subscription = EventEmitter.addListener('profileAdded', async () => {
fetchProfiles();
});
useEffect(() => {
fetchProfiles();
console.log(profiles)
}, []);
const containerStyle = {
//minHeight: useWindowDimensions().height/2,
//width: useWindowDimensions().width,
height: "75%",
width: "100%",
};
};
const styles = StyleSheet.create({
const styles = StyleSheet.create({
container: {
height: "100%",
width: "100%",
@ -164,36 +200,28 @@ 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}}>
<PaperProvider>
<ScrollView>
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={styles.separator}/>
{profileComponents}
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</ScrollView>
name={profile.name}
avatar={profile.avatar}
diets={profile.diets}
allergies={profile.allergies}
onDeleteProfile={() => raisePopUp(index)}
/>
<Portal>
<Modal visible={visible} onDismiss={erasePopUp} contentContainerStyle={containerStyle} style={{marginTop: 0, justifyContent: "flex-start"}}>
<View style={styles.modal}>
<View style={styles.viewModal}>
<View style={styles.profileValidation}>
<ProfileDelete name="Johnny Silverhand" avatar="plus_small.png" diets={dieJohnny} allergies={allJohnny}></ProfileDelete>
{/* <ProfileDelete
name={profiles[selectedProfileIndex].name}
avatar={profiles[selectedProfileIndex].avatar}
diets={profiles[selectedProfileIndex].diets}
allergies={profiles[selectedProfileIndex].allergies}
/> */}
</View>
<View style={styles.decisionBarVertical}>
<Text style={styles.validationQuestion}>Do you really want to delete this profile?</Text>
<View style={styles.decisionBar}>
<Pressable onPress={erasePopUp} style={{flex:0.5}}>
<Pressable onPress={() => handleDeleteProfile(selectedProfileIndex)} style={{flex:0.5}}>
<View style={styles.yesButton}>
<Image source={require("../assets/images/validate.png")} style={{tintColor: "#2DE04A", height: "100%", flex: 0.2, margin: "5%", resizeMode: "contain"}}/>
<Text style={styles.yesText}>Yes</Text>
@ -211,7 +239,24 @@ export default function Profiles({navigation, props}) {
</View>
</Modal>
</Portal>
{index < profiles.length - 1 && <View style={styles.separator} />}
</View>
));
return (
<SafeAreaProvider style={{flex: 1}}>
<PaperProvider>
<ScrollView>
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={styles.separator}/>
{profileComponents}
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</ScrollView>
</PaperProvider>
</SafeAreaProvider>
);
}
}

@ -37,6 +37,7 @@ export interface Theme {
yesButton: string,
letterFilter: string,
foodElementBorder: string,
badgeText: string,
}
export const LightTheme : Theme = {
@ -66,6 +67,7 @@ export const LightTheme : Theme = {
yesButton: Moonstone,
letterFilter: Moonstone,
foodElementBorder: Jet,
badgeText: Jet,
}
export const DarkTheme : Theme = {
@ -95,5 +97,6 @@ export const DarkTheme : Theme = {
yesButton: CarolinaBlue,
letterFilter: CarolinaBlue,
foodElementBorder: CarolinaBlue,
badgeText: Alabaster,
}

Loading…
Cancel
Save