Merge remote-tracking branch 'origin/WORK-LPA' into WORK-RHA
continuous-integration/drone/push Build is passing Details

pull/20/head
Rayhân HASSOU 2 years ago
commit 7f23cb7e42

@ -76,7 +76,7 @@ export default function ListSelect(props: ListProps) {
}, },
badgesText: { badgesText: {
fontSize: 15, fontSize: 15,
color: colors.cardElementText, color: colors.badgeText,
}, },
box: { box: {
borderColor: "#3F3C42" borderColor: "#3F3C42"
@ -100,6 +100,7 @@ export default function ListSelect(props: ListProps) {
checkBoxStyles={styles.box} checkBoxStyles={styles.box}
notFoundText="All Diets Already Selected" notFoundText="All Diets Already Selected"
placeholder={props.title} placeholder={props.title}
labelStyles={styles.title}
label={props.title}/> label={props.title}/>
); );
} }

@ -9,8 +9,15 @@ type ListProps = {
} }
export default function ListWithoutSelect(props: ListProps) { export default function ListWithoutSelect(props: ListProps) {
const [selected, setSelected] = React.useState([]);
const { colors } = useContext(ColorContext); const { colors } = useContext(ColorContext);
let listContent = []
props.content.forEach((val) => {
listContent.push({value: val.value, disabled: true})
})
const styles = StyleSheet.create({ const styles = StyleSheet.create({
titleBar: { titleBar: {
flexDirection: "row", flexDirection: "row",
@ -58,6 +65,7 @@ export default function ListWithoutSelect(props: ListProps) {
width: "100%", width: "100%",
minWidth: 250, minWidth: 250,
maxWidth: 250, maxWidth: 250,
backgroundColor: colors.cardElementBackground,
}, },
itemText: { itemText: {
fontSize: 13, fontSize: 13,
@ -71,12 +79,14 @@ export default function ListWithoutSelect(props: ListProps) {
box: { box: {
borderWidth: 0, borderWidth: 0,
flex: 0, flex: 0,
backgroundColor: colors.cardElementBackground,
} }
}); });
return ( return (
<MultipleSelectList <MultipleSelectList
data={props.content} setSelected={(val) => setSelected(val)}
data={listContent}
save="value" save="value"
search={false} search={false}
arrowicon={<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>} arrowicon={<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>}
@ -84,8 +94,11 @@ export default function ListWithoutSelect(props: ListProps) {
inputStyles={styles.title} inputStyles={styles.title}
dropdownStyles={styles.itemList} dropdownStyles={styles.itemList}
dropdownItemStyles={styles.itemCell} dropdownItemStyles={styles.itemCell}
disabledItemStyles={styles.itemCell}
dropdownTextStyles={styles.itemText} dropdownTextStyles={styles.itemText}
disabledTextStyles={styles.itemText}
checkBoxStyles={styles.box} checkBoxStyles={styles.box}
disabledCheckBoxStyles={styles.box}
notFoundText="None" notFoundText="None"
placeholder={props.title} placeholder={props.title}
label={props.title}/> label={props.title}/>

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

@ -33,7 +33,6 @@ export default function ProfileElement(props : Profile) {
else{ else{
setSeparator("none") setSeparator("none")
} }
console.log(waiting, separator, props.name)
} }
let imageSource let imageSource

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

@ -19,7 +19,7 @@ export default function CookingStackScreen() {
options={{ options={{
headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'}, headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'},
headerTitle: () => ( 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'); const _handleHeaderAdd = () => navigation.navigate('ProfileCreation');
return ( return (

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

@ -1,8 +1,9 @@
import React, { useEffect, useState, useContext } from 'react'; import React, { useEffect, useState, useContext } from 'react';
import { View, StyleSheet, Text, Image, Pressable, ActivityIndicator, FlatList, useWindowDimensions, ScrollView } from 'react-native'; import { View, StyleSheet, Text, Image, Pressable, ActivityIndicator, FlatList, useWindowDimensions } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Searchbar } from 'react-native-paper'; import { Searchbar } from 'react-native-paper';
import FoodElementText from '../components/FoodElementText'; import FoodElementText from '../components/FoodElementText';
import plus from '../assets/images/plus.png'; import plus from '../assets/images/plus.png';
import moins from '../assets/images/minus.png'; import moins from '../assets/images/minus.png';
import Ingredient from '../Models/Ingredient'; import Ingredient from '../Models/Ingredient';
@ -14,7 +15,6 @@ import ValidateButton from '../components/ValidateButton';
export default function IngredientSelection(props) { export default function IngredientSelection(props) {
const alphabetArray: Array<string> = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]; const alphabetArray: Array<string> = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState();
const [response, setResponse] = useState<Ingredient[] | undefined>(undefined); const [response, setResponse] = useState<Ingredient[] | undefined>(undefined);
const [selectedIngredients, setSelectedIngredients] = useState([]); const [selectedIngredients, setSelectedIngredients] = useState([]);
const ingredientService = new IngredientService(); const ingredientService = new IngredientService();
@ -34,7 +34,7 @@ export default function IngredientSelection(props) {
setResponse(filtered); setResponse(filtered);
} }
} catch (error) { } catch (error) {
setError(error); console.log(error);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
@ -50,7 +50,7 @@ const loadIngredients = async () => {
const ingredients = await ingredientService.getAllIngredient(); const ingredients = await ingredientService.getAllIngredient();
setResponse(ingredients); setResponse(ingredients);
} catch (error) { } catch (error) {
setError(error); console.log(error);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
@ -86,19 +86,15 @@ const loadIngredients = async () => {
const SelectIngredient = (newIngredient: Ingredient) => { const SelectIngredient = (newIngredient: Ingredient) => {
const exists = selectedIngredients.find((ingredient) => ingredient.id === newIngredient.id); const exists = selectedIngredients.find((ingredient) => ingredient.id === newIngredient.id);
console.log("Test 1: ", selectedIngredients.length)
if (!exists) { if (!exists) {
setSelectedIngredients([...selectedIngredients, newIngredient]); setSelectedIngredients([...selectedIngredients, newIngredient]);
}
console.log("Test 2: ", selectedIngredients.length)
ChangeAvailableSize(false) ChangeAvailableSize(false)
}
}; };
const RemoveIngredient = (idIngredient: number) => { const RemoveIngredient = (idIngredient: number) => {
console.log("Test 1 Remove: ", selectedIngredients.length)
const updatedIngredients = selectedIngredients.filter((ingredient) => ingredient.id !== idIngredient); const updatedIngredients = selectedIngredients.filter((ingredient) => ingredient.id !== idIngredient);
setSelectedIngredients(updatedIngredients); setSelectedIngredients(updatedIngredients);
console.log("Test 2 Remove: ", selectedIngredients.length)
ChangeAvailableSize(true) ChangeAvailableSize(true)
}; };
@ -141,7 +137,7 @@ const loadIngredients = async () => {
const ingredientsByLetter = await ingredientService.getIngredientByLetter(letter); const ingredientsByLetter = await ingredientService.getIngredientByLetter(letter);
setResponse(ingredientsByLetter); setResponse(ingredientsByLetter);
} catch (error) { } catch (error) {
setError(error); console.log(error);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
@ -213,6 +209,9 @@ const loadIngredients = async () => {
placeholder="Search" placeholder="Search"
onChangeText={handleSearch} onChangeText={handleSearch}
value={searchQuery} value={searchQuery}
iconColor={colors.cardDetail}
inputStyle={{color: colors.cardDetail}}
rippleColor={colors.letterFilter}
style={{margin: "3%", style={{margin: "3%",
backgroundColor: colors.cardBackground, backgroundColor: colors.cardBackground,
borderWidth : 1, borderWidth : 1,

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

@ -24,11 +24,9 @@ export default function Profiles({navigation, props}) {
const raisePopUp = () => { const raisePopUp = () => {
setVisible(true) setVisible(true)
setOpacity(0.3)
} }
const erasePopUp = () => { const erasePopUp = () => {
setVisible(false) setVisible(false)
setOpacity(1)
} }
const handleDeleteProfile = async (index) => { const handleDeleteProfile = async (index) => {

@ -14,7 +14,6 @@ export default function RecipeDetails(props) {
const {colors} = useContext(ColorContext); const {colors} = useContext(ColorContext);
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState();
const [response, setResponse] = useState<Recipes | undefined>(undefined); const [response, setResponse] = useState<Recipes | undefined>(undefined);
const recipesService = new RecipesService(); const recipesService = new RecipesService();
@ -23,7 +22,7 @@ export default function RecipeDetails(props) {
const recipe = await recipesService.getRecipeById(props.id); const recipe = await recipesService.getRecipeById(props.id);
setResponse(recipe); setResponse(recipe);
} catch (error) { } catch (error) {
setError(error); console.log(error);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }

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

Loading…
Cancel
Save