Merge remote-tracking branch 'origin/WORK-RRE' into WORK-RHA

pull/20/head
Rayhân HASSOU 1 year ago
commit ebd7cbc1ad

@ -28,5 +28,4 @@ steps:
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- export PATH=$SONAR_SCANNER_HOME/bin:$PATH - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
- export SONAR_SCANNER_OPTS="-server" - export SONAR_SCANNER_OPTS="-server"
- sonar-scanner -D sonar.projectKey=LeftOvers -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar - sonar-scanner -D sonar.projectKey=LeftOvers -D sonar.sources=. -D sonar.host.url=https://codefirst.iut.uca.fr/sonar -D sonar.exclusions=**/*.java
depends_on: [ app-build ]

@ -1 +1,9 @@
*.pbxproj -text #
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf
# These are Windows script files and should use crlf
*.bat text eol=crlf

@ -33,3 +33,9 @@ yarn-error.*
# typescript # typescript
*.tsbuildinfo *.tsbuildinfo
# Ignore Gradle project-specific cache directory
.gradle
# Ignore Gradle build output directory
build

@ -1,63 +1,30 @@
import React from 'react'; import React from 'react';
import {StyleSheet, View } from 'react-native'; import { NavigationContainer } from '@react-navigation/native';
import ProfileModification from './components/ProfileModification'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import ValidateButton from './components/ValidateButton';
import { LinearGradient } from 'expo-linear-gradient';
import RecipeSuggestion from './screens/RecipeSuggestion';
import RecipeDetails from './screens/RecipeDetails';
import IngredientSelection from './screens/IngredientSelection';
export default function App() { import HomeStackScreen from './navigation/HomeStackScreen';
const all = [{value: "Mussels"}, {value: "Skimmed Milk"}, {value: "Nuts"}] import ProfilesStackScreen from './navigation/ProfileStackScreen';
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}] import CookingStackScreen from './navigation/CookingStackScreen';
const ingredient = [{value: "Chocolate"}, {value: "Skimmed Milk"}, {value: "Eggs"}, , {value: "Farine"}] import BottomBar from './navigation/BottomBar';
const ustensils = [{value: "Bol"}, {value: "Fouet"}, {value: "Casserole"}] import { ThemeProvider } from './theme/ThemeContext';
const steps = [{value: "Chauffer chocolat"}, import { ColorProvider } from './theme/ColorContext';
{value: "1. Casser oeuf"},
{value: "2. Melanger la farine, le lait et les oeufs"},
{value: "3. Battre fort"},
{value: "4. Voler la montre de Louison"},
{value: "5. Melanger avec le chocolat"},
{value: "6. Mettre au four"},
]
function generateList() {
const list = [];
list.push("Meat");
list.push("Meat");
list.push("Meat");
list.push("Meat");
list.push("Teat");
list.push("Meat");
list.push("Meat");
list.push("Meat");
return list;
}
const ingredients = generateList(); const Tab = createBottomTabNavigator();
export default function App() {
return ( return (
/*<IngredientSelection listIngredient={ingredients}></IngredientSelection>*/ <ThemeProvider>
/*<RecipeSuggestion list={ingredients} diets={die} allergy={all}></RecipeSuggestion>*/ <ColorProvider>
<RecipeDetails id={123}></RecipeDetails> <NavigationContainer>
<Tab.Navigator initialRouteName='HOME' tabBar={ (props) => <BottomBar {...props}/> }>
<Tab.Screen name='PROFILE' component={ProfilesStackScreen} options={{ headerShown: false, title: 'Profile' }} />
<Tab.Screen name='HOME' component={HomeStackScreen} options={{ headerShown: false, title: 'Home' }}/>
<Tab.Screen name='COOKING' component={CookingStackScreen} options={{ headerShown: false, title: 'Cooking' }}/>
</Tab.Navigator>
</NavigationContainer>
</ColorProvider>
</ThemeProvider>
); );
} }
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#3F3C42',
alignItems: 'center',
justifyContent: 'center',
},
linearGradient: {
//height: 844,
//width: 390,
flex: 1,
padding: 10,
paddingTop: 0,
//backgroundColor: "#59BDCD",
//alignItems: 'center',
//justifyContent: 'flex-start',
},
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -1,11 +1,10 @@
import React from 'react'; import React, { useContext } from 'react';
import {StyleSheet,Pressable, Text, View, Image} from 'react-native'; import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
import Separator from '../components/Separator'; import Separator from '../components/Separator';
import ColorContext from '../theme/ColorContext';
interface foodElementImageProps { interface foodElementImageProps {
source : string | null
title : string title : string
} }
@ -14,50 +13,42 @@ const componentWidth = 280;
export default function FoodElementText(props : any) { export default function FoodElementText(props : any) {
const isTextOverflowing = props.title.length * 10 > 260; const {colors, toggleColors } = useContext(ColorContext)
return (
<Pressable style={styles.button}>
<View style={styles.container}>
<View style={styles.view}>
<Text style={styles.text}>{props.title}</Text>
{!isTextOverflowing && <Separator />}
</View>
</View>
</Pressable>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
button: { button: {
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
width : componentWidth, width: "80%",
minHeight: componentHeight,
borderRadius: 5, borderRadius: 5,
backgroundColor: '#E3DEC9', backgroundColor: colors.carrouselBackground,
}, },
text: { text: {
fontSize: 10, fontSize: 10,
fontWeight: 'bold', fontWeight: 'bold',
letterSpacing: 0.25, padding : "2%",
padding: 7, color: colors.cardDetail,
color: 'black',
width: 250,
}, },
view: { view: {
alignItems: 'flex-start', alignItems: 'flex-start',
justifyContent: 'center', justifyContent: 'center',
}, },
container: { container: {
width : componentWidth - 10, width: "100%",
minHeight : componentHeight - 10,
borderRadius: 5, borderRadius: 5,
borderWidth: 1, borderWidth: 1,
borderColor: '#3F3C42', borderColor: colors.cardDetail,
flexDirection: 'column', flexDirection: 'column',
justifyContent: 'center', justifyContent: 'center',
}, },
}); });
return (
<Pressable style={styles.button}>
<View style={styles.container}>
<View style={styles.view}>
<Text style={styles.text}>{props.title}</Text>
</View>
</View>
</Pressable>
);
}

@ -1,48 +1,30 @@
import React from 'react'; import React, { useContext } from 'react';
import {StyleSheet, Text, TextInput, View, Image, FlatList} from 'react-native'; import {StyleSheet, Text, TextInput, View, Image, FlatList} from 'react-native';
import ValidateButton from './ValidateButton'; import ValidateButton from './ValidateButton';
import HeaderFlatList from './HeaderFlatList'; import HeaderFlatList from './HeaderFlatList';
import { MultipleSelectList, SelectList } from 'react-native-dropdown-select-list' import { MultipleSelectList, SelectList } from 'react-native-dropdown-select-list'
import ColorContext from '../theme/ColorContext';
type ListProps = { type ListProps = {
title: string title: string
content : list<string> content : string[]
} }
export default function ListSelect(props: ListProps) { export default function ListSelect(props: ListProps) {
const [selected, setSelected] = React.useState([]); const [selected, setSelected] = React.useState([]);
return ( const { colors, toggleColors } = useContext(ColorContext);
<MultipleSelectList
setSelected={(val) => setSelected(val)}
data={props.content}
save="value"
search={false}
arrowicon={<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>}
boxStyles={styles.titleBar}
inputStyles={styles.title}
dropdownStyles={styles.itemList}
dropdownItemStyles={styles.itemCell}
dropdownTextStyles={styles.itemText}
badgeStyles={styles.badges}
badgeTextStyles={styles.badgesText}
notFoundText="All Diets Already Selected"
placeholder={props.title}
label={props.title}/>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
titleBar: { titleBar: {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
justifyContent: "stretch", backgroundColor: colors.cardElementTitleBackground,
backgroundColor: "#F2F0E4",
borderTopRightRadius: 15, borderTopRightRadius: 15,
borderTopLeftRadius: 15, borderTopLeftRadius: 15,
borderBottomRightRadius: 0, borderBottomRightRadius: 0,
borderBottomLeftRadius: 0, borderBottomLeftRadius: 0,
borderWidth: 2, borderWidth: 2,
borderColor: "#ACA279", borderColor: colors.cardElementBorder,
minWidth: "92%", minWidth: "92%",
maxWidth: "92%", maxWidth: "92%",
marginBottom: 0, marginBottom: 0,
@ -50,12 +32,12 @@ const styles = StyleSheet.create({
}, },
arrow: { arrow: {
resizeMode: 'contain', resizeMode: 'contain',
tintColor: "#3F3C42", tintColor: colors.cardElementTitle,
flex: 0.1, flex: 0.1,
}, },
title: { title: {
fontSize: 15, fontSize: 15,
color: '#3F3C42', color: colors.cardElementTitle,
alignItems: 'center', alignItems: 'center',
textAlign: "left", textAlign: "left",
flex: 0.9, flex: 0.9,
@ -64,13 +46,12 @@ const styles = StyleSheet.create({
itemList: { itemList: {
flexDirection: "row", flexDirection: "row",
alignItems: "flex-start", alignItems: "flex-start",
justifyContent: "stretch",
borderWidth: 0, borderWidth: 0,
borderTopRightRadius: 0, borderTopRightRadius: 0,
borderTopLeftRadius: 0, borderTopLeftRadius: 0,
borderBottomRightRadius: 15, borderBottomRightRadius: 15,
borderBottomLeftRadius: 15, borderBottomLeftRadius: 15,
backgroundColor: "#E3DEC9", backgroundColor: colors.cardElementBackground,
minWidth: "92%", minWidth: "92%",
maxWidth: "92%", maxWidth: "92%",
}, },
@ -87,14 +68,35 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
padding: "1%", padding: "1%",
paddingLeft: "3%", paddingLeft: "3%",
color: "#3F3C42", color: colors.cardElementText,
}, },
badges: { badges: {
backgroundColor: "#59BDCD", backgroundColor: colors.cardElementBackground,
}, },
badgesText: { badgesText: {
fontSize: 15, fontSize: 15,
color: "#F2F0E4", color: colors.cardElementText,
}, },
}); });
return (
<MultipleSelectList
setSelected={(val) => setSelected(val)}
data={props.content}
save="value"
search={false}
arrowicon={<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>}
boxStyles={styles.titleBar}
inputStyles={styles.title}
dropdownStyles={styles.itemList}
dropdownItemStyles={styles.itemCell}
dropdownTextStyles={styles.itemText}
badgeStyles={styles.badges}
badgeTextStyles={styles.badgesText}
notFoundText="All Diets Already Selected"
placeholder={props.title}
label={props.title}/>
);
}

@ -1,46 +1,30 @@
import React from 'react'; import React, { useContext } from 'react';
import {StyleSheet, Text, TextInput, View, Image, FlatList, Pressable} from 'react-native'; import {StyleSheet, Text, TextInput, View, Image, FlatList, Pressable} from 'react-native';
import ValidateButton from './ValidateButton'; import ValidateButton from './ValidateButton';
import HeaderFlatList from './HeaderFlatList'; import HeaderFlatList from './HeaderFlatList';
import { MultipleSelectList, SelectList } from 'react-native-dropdown-select-list' import { MultipleSelectList, SelectList } from 'react-native-dropdown-select-list'
import ColorContext from '../theme/ColorContext';
type ListProps = { type ListProps = {
title: string title: string
content : list<string> content: string[]
} }
export default function ListWithoutSelect(props: ListProps) { export default function ListWithoutSelect(props: ListProps) {
const [selected, setSelected] = React.useState([]); const [selected, setSelected] = React.useState([]);
return ( const { colors, toggleColors } = useContext(ColorContext);
<MultipleSelectList
data={props.content}
save="value"
search={false}
arrowicon={<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>}
boxStyles={styles.titleBar}
inputStyles={styles.title}
dropdownStyles={styles.itemList}
dropdownItemStyles={styles.itemCell}
dropdownTextStyles={styles.itemText}
checkBoxStyles={styles.box}
notFoundText="None"
placeholder={props.title}
label={props.title}/>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
titleBar: { titleBar: {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
justifyContent: "stretch", backgroundColor: colors.cardElementTitleBackground,
backgroundColor: "#F2F0E4",
borderTopRightRadius: 15, borderTopRightRadius: 15,
borderTopLeftRadius: 15, borderTopLeftRadius: 15,
borderBottomRightRadius: 0, borderBottomRightRadius: 0,
borderBottomLeftRadius: 0, borderBottomLeftRadius: 0,
borderWidth: 2, borderWidth: 2,
borderColor: "#ACA279", borderColor: colors.cardElementBorder,
minWidth: "92%", minWidth: "92%",
maxWidth: "92%", maxWidth: "92%",
marginBottom: 0, marginBottom: 0,
@ -48,12 +32,12 @@ const styles = StyleSheet.create({
}, },
arrow: { arrow: {
resizeMode: 'contain', resizeMode: 'contain',
tintColor: "#3F3C42", tintColor: colors.cardElementTitle,
flex: 0.1, flex: 0.1,
}, },
title: { title: {
fontSize: 15, fontSize: 15,
color: '#3F3C42', color: colors.cardElementTitle,
alignItems: 'center', alignItems: 'center',
textAlign: "left", textAlign: "left",
flex: 0.9, flex: 0.9,
@ -62,13 +46,12 @@ const styles = StyleSheet.create({
itemList: { itemList: {
flexDirection: "row", flexDirection: "row",
alignItems: "flex-start", alignItems: "flex-start",
justifyContent: "stretch",
borderWidth: 0, borderWidth: 0,
borderTopRightRadius: 0, borderTopRightRadius: 0,
borderTopLeftRadius: 0, borderTopLeftRadius: 0,
borderBottomRightRadius: 15, borderBottomRightRadius: 15,
borderBottomLeftRadius: 15, borderBottomLeftRadius: 15,
backgroundColor: "#E3DEC9", backgroundColor: colors.cardElementBackground,
minWidth: "92%", minWidth: "92%",
maxWidth: "92%", maxWidth: "92%",
}, },
@ -93,3 +76,22 @@ const styles = StyleSheet.create({
flex: 0, flex: 0,
} }
}); });
return (
<MultipleSelectList
data={props.content}
save="value"
search={false}
arrowicon={<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>}
boxStyles={styles.titleBar}
inputStyles={styles.title}
dropdownStyles={styles.itemList}
dropdownItemStyles={styles.itemCell}
dropdownTextStyles={styles.itemText}
checkBoxStyles={styles.box}
notFoundText="None"
placeholder={props.title}
label={props.title}/>
);
}

@ -1,17 +1,21 @@
import {React, useState} from 'react'; import React, { useContext, useState } from 'react';
import {StyleSheet, Text, TextInput, View, Image, Pressable} from 'react-native'; import { StyleSheet, Text, View, Image, Pressable } from 'react-native';
import ValidateButton from './ValidateButton'; import { useNavigation } from '@react-navigation/native';
import ListWithoutSelect from './ListWithoutSelect'; import ListWithoutSelect from './ListWithoutSelect';
import ColorContext from '../theme/ColorContext';
type ProfileProps = { type ProfileProps = {
name: string name: string
avatar: string avatar: string
diets: list<string> diets: string[]
allergies: list<string> allergies: string[]
onDeleteProfile: () => void onDeleteProfile: () => void
} }
export default function ProfileDetails(props: ProfileProps) { export default function ProfileDetails(props) {
const { colors, toggleColors } = useContext(ColorContext)
const navigation = useNavigation()
const [display, setDisplay] = useState("none") const [display, setDisplay] = useState("none")
const changeListVisibility = () => { const changeListVisibility = () => {
if (display == "none"){ if (display == "none"){
@ -24,50 +28,23 @@ export default function ProfileDetails(props: ProfileProps) {
let imageSource let imageSource
if (props.avatar == "plus.png"){ if (props.avatar === "plus.png"){
imageSource = require('../assets/images/plus.png') imageSource = require('../assets/images/plus.png')
} }
else if (props.avatar == "plus_small.png"){ else if (props.avatar === "plus_small.png"){
imageSource = require('../assets/images/plus_small.png') imageSource = require('../assets/images/plus_small.png')
} }
else{ else{
imageSource = require('../assets/images/logo.png') imageSource = require('../assets/images/logo.png')
} }
return (
<View style={styles.background}>
<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.onDeleteProfile} style={{flex: 0.1, marginLeft: "1%",}}>
<Image source={require("../assets/images/delete.png")} style={styles.delete}></Image>
</Pressable>
</View>
<Pressable onPress={changeListVisibility} style={{height: "5%", marginTop: "6%", flex: 1, marginBottom: "3%"}}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Filters</Text>
<Text style={styles.nbSelected}>{props.diets.length} selected</Text>
<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>
</View>
</Pressable>
<View style={{display: display, alignItems: "center", justifyContent: "center"}}>
<ListWithoutSelect title="Diets" content={props.diets}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
<ListWithoutSelect title="Allergies" content={props.allergies}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
</View>
</View>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
background: { background: {
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 15, borderRadius: 15,
backgroundColor: '#F2F0E4', backgroundColor: colors.cardBackground,
padding: "3%", padding: "3%",
marginHorizontal: "3%", marginHorizontal: "3%",
}, },
@ -84,7 +61,7 @@ const styles = StyleSheet.create({
padding: "5%", padding: "5%",
resizeMode: 'contain', resizeMode: 'contain',
borderWidth: 2, borderWidth: 2,
borderColor: "#ACA279", borderColor: colors.cardElementBorder,
borderRadius: 45, borderRadius: 45,
height: "100%", height: "100%",
flex: 0.03, flex: 0.03,
@ -92,7 +69,7 @@ const styles = StyleSheet.create({
text: { text: {
flex: 1, flex: 1,
fontSize: 20, fontSize: 20,
color: '#ACA279', color: colors.cardElementBorder,
alignItems: 'center', alignItems: 'center',
textAlign: 'left', textAlign: 'left',
marginLeft: "3%", marginLeft: "3%",
@ -101,7 +78,7 @@ const styles = StyleSheet.create({
}, },
modify: { modify: {
height: "100%", height: "100%",
tintColor: "#ACA279", tintColor: colors.cardElementBorder,
resizeMode: 'contain', resizeMode: 'contain',
flex: 0.1, flex: 0.1,
marginLeft: "3%", marginLeft: "3%",
@ -109,7 +86,7 @@ const styles = StyleSheet.create({
delete: { delete: {
height: "100%", height: "100%",
width: "100%", width: "100%",
tintColor: "#ACA279", tintColor: colors.cardElementBorder,
resizeMode: 'contain', resizeMode: 'contain',
flex: 1, flex: 1,
}, },
@ -125,7 +102,7 @@ const styles = StyleSheet.create({
}, },
filters: { filters: {
fontSize: 20, fontSize: 20,
color: '#ACA279', color: colors.cardElementBorder,
flex: 1, flex: 1,
padding: "2%", padding: "2%",
paddingLeft: 0, paddingLeft: 0,
@ -134,14 +111,42 @@ const styles = StyleSheet.create({
nbSelected: { nbSelected: {
fontSize: 11, fontSize: 11,
flex: 1, flex: 1,
color: "#3F3C42", color: colors.cardDetail,
textAlign: "right", textAlign: "right",
marginRight: "3%", marginRight: "3%",
}, },
arrow: { arrow: {
height: "100%", height: "100%",
resizeMode: 'contain', resizeMode: 'contain',
tintColor: "#3F3C42", tintColor: colors.cardDetail,
flex: 0.1, flex: 0.1,
}, },
}); });
return (
<View style={styles.background}>
<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.onDeleteProfile} style={{flex: 0.1, marginLeft: "1%",}}>
<Image source={require("../assets/images/delete.png")} style={styles.delete}></Image>
</Pressable>
</View>
<Pressable onPress={changeListVisibility} style={{height: "5%", marginTop: "6%", flex: 1, marginBottom: "3%"}}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Filters</Text>
<Text style={styles.nbSelected}>{props.diets.length} selected</Text>
<Image source={require("../assets/images/arrow.png")} style={styles.arrow}></Image>
</View>
</Pressable>
<View style={{display: display === 'flex' ? 'flex' : 'none', alignItems: "center", justifyContent: "center"}}>
<ListWithoutSelect title="Diets" content={props.diets}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
<ListWithoutSelect title="Allergies" content={props.allergies}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
</View>
</View>
);
}

@ -1,5 +1,6 @@
import {React, useState} from 'react'; import React, { useContext, useState } from 'react';
import {StyleSheet,Pressable, Text, View, Image} from 'react-native'; import {StyleSheet,Pressable, Text, View, Image} from 'react-native';
import ColorContext from '../theme/ColorContext';
type Profile = { type Profile = {
name: string name: string
@ -9,6 +10,8 @@ type Profile = {
} }
export default function ProfileElement(props : Profile) { export default function ProfileElement(props : Profile) {
const { colors, toggleColors } = useContext(ColorContext)
const [waiting, setWaiting] = useState("none") const [waiting, setWaiting] = useState("none")
const [separator, setSeparator] = useState("none") const [separator, setSeparator] = useState("none")
const changeStatus = () => { const changeStatus = () => {
@ -44,27 +47,6 @@ export default function ProfileElement(props : Profile) {
imageSource = require('../assets/images/logo.png') imageSource = require('../assets/images/logo.png')
} }
return (
<Pressable onPress={changeStatus} style={styles.button}>
<View>
<View style={styles.pseudoBar}>
<Image source={imageSource} style={styles.avatar}></Image>
<Text style={styles.text}>{props.name}</Text>
</View>
<View style={styles.pseudoBar}>
<View style={[styles.active, {display: props.isActive}]}>
<Text style={styles.textActive}>Activated</Text>
</View>
<View style={{flex: 0.3, display: separator}}/>
<View style={[styles.waiting, {display: waiting}]}>
<Text style={styles.textWaiting}>Waiting...</Text>
</View>
</View>
</View>
</Pressable>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
button: { button: {
alignItems: 'center', alignItems: 'center',
@ -85,14 +67,14 @@ const styles = StyleSheet.create({
padding: "5%", padding: "5%",
resizeMode: 'contain', resizeMode: 'contain',
borderWidth: 2, borderWidth: 2,
borderColor: "#ACA279", borderColor: colors.carrouselText,
borderRadius: 45, borderRadius: 45,
height: "100%", height: "100%",
flex: 0.01, flex: 0.01,
}, },
text: { text: {
fontSize: 15, fontSize: 15,
color: '#ACA279', color: colors.carrouselText,
alignItems: 'center', alignItems: 'center',
textAlign: 'left', textAlign: 'left',
flex: 0.9, flex: 0.9,
@ -103,12 +85,12 @@ const styles = StyleSheet.create({
active: { active: {
borderWidth: 1, borderWidth: 1,
borderRadius: 20, borderRadius: 20,
borderColor: "#59BDCD", borderColor: colors.carrouselDetail,
padding: "1%", padding: "1%",
}, },
textActive: { textActive: {
fontSize: 10, fontSize: 10,
color: "#59BDCD", color: colors.carrouselDetail,
}, },
waiting: { waiting: {
@ -122,3 +104,24 @@ const styles = StyleSheet.create({
color: "#ACA279", color: "#ACA279",
}, },
}); });
return (
<Pressable onPress={changeStatus} style={styles.button}>
<View>
<View style={styles.pseudoBar}>
<Image source={imageSource} style={styles.avatar}></Image>
<Text style={styles.text}>{props.name}</Text>
</View>
<View style={styles.pseudoBar}>
<View style={[styles.active, {display: props.isActive}]}>
<Text style={styles.textActive}>Activated</Text>
</View>
<View style={{flex: 0.3, display: separator}}/>
<View style={[styles.waiting, {display: waiting}]}>
<Text style={styles.textWaiting}>Waiting...</Text>
</View>
</View>
</View>
</Pressable>
);
}

@ -1,18 +1,21 @@
import {React, useState} from 'react'; import React, { useContext, useState } from 'react';
import {StyleSheet, Text, TextInput, View, Image} from 'react-native'; import {StyleSheet, Text, TextInput, View, Image} from 'react-native';
import ValidateButton from './ValidateButton'; import ValidateButton from './ValidateButton';
import ListSelect from './ListSelect'; import ListSelect from './ListSelect';
import ListWithoutSelect from './ListWithoutSelect'; import ListWithoutSelect from './ListWithoutSelect';
import ColorContext from '../theme/ColorContext';
type ProfileProps = { type ProfileProps = {
name: string name: string
avatar: string avatar: string
diets: list<string> diets: string[]
allergies: list<string> allergies: string[]
} }
export default function ProfileModification(props: ProfileProps) { export default function ProfileModification(props: ProfileProps) {
const [name, onChangeName] = useState(props.name); const [name, onChangeName] = useState(props.name);
const { colors, toggleColors } = useContext(ColorContext);
let imageSource let imageSource
if (props.avatar == "plus.png"){ if (props.avatar == "plus.png"){
@ -25,33 +28,13 @@ export default function ProfileModification(props: ProfileProps) {
imageSource = require('../assets/images/logo.png') imageSource = require('../assets/images/logo.png')
} }
return (
<View style={styles.background}>
<View style={styles.pseudoBar}>
<Image source={imageSource} style={styles.avatar}></Image>
<TextInput style={styles.textInput} value={name} onChangeText={onChangeName} placeholder="Name"></TextInput>
<Image source={require("../assets/images/modify.png")} style={styles.modify}></Image>
</View>
<View style={styles.filterBar}>
<Text style={styles.filters}>Filters</Text>
<Text style={styles.nbSelected}>3 selected</Text>
</View>
<ListSelect title="Diets" content={props.diets}></ListSelect>
<View style={{marginTop: "6%"}}/>
<ListWithoutSelect title="Allergies" content={props.allergies}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Add Allergy" image="plus.png" colour="#59BDCD" backColour="#E3DEC9"></ValidateButton>
</View>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
background: { background: {
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 15, borderRadius: 15,
backgroundColor: '#F2F0E4', backgroundColor: colors.cardBackground,
padding: "3%", padding: "3%",
marginHorizontal: "3%", marginHorizontal: "3%",
}, },
@ -68,18 +51,18 @@ const styles = StyleSheet.create({
padding: "5%", padding: "5%",
resizeMode: 'contain', resizeMode: 'contain',
borderWidth: 2, borderWidth: 2,
borderColor: "#ACA279", borderColor: colors.cardTitle,
borderRadius: 45, borderRadius: 45,
height: "100%", height: "100%",
flex: 0.04, flex: 0.04,
}, },
textInput: { textInput: {
fontSize: 15, fontSize: 15,
color: '#ACA279', color: colors.cardTitle,
borderRadius: 10, borderRadius: 10,
borderWidth: 2, borderWidth: 2,
borderStyle: 'dashed', borderStyle: 'dashed',
borderColor: '#ACA279', borderColor: colors.cardTitle,
alignItems: 'center', alignItems: 'center',
textAlign: 'left', textAlign: 'left',
flex: 0.8, flex: 0.8,
@ -88,7 +71,7 @@ const styles = StyleSheet.create({
}, },
modify: { modify: {
height: "100%", height: "100%",
tintColor: "#ACA279", tintColor: colors.cardTitle,
resizeMode: 'contain', resizeMode: 'contain',
flex: 0.1, flex: 0.1,
marginLeft: "3%", marginLeft: "3%",
@ -104,12 +87,33 @@ const styles = StyleSheet.create({
}, },
filters: { filters: {
fontSize: 20, fontSize: 20,
color: '#ACA279', color: colors.cardTitle,
flex: 1, flex: 1,
}, },
nbSelected: { nbSelected: {
fontSize: 11, fontSize: 11,
color: "#3F3C42", color: colors.cardDetail,
textAlign: "right", textAlign: "right",
} }
}); });
return (
<View style={styles.background}>
<View style={styles.pseudoBar}>
<Image source={imageSource} style={styles.avatar}></Image>
<TextInput style={styles.textInput} value={name} onChangeText={onChangeName} placeholder="Name"></TextInput>
<Image source={require("../assets/images/modify.png")} style={styles.modify}></Image>
</View>
<View style={styles.filterBar}>
<Text style={styles.filters}>Filters</Text>
<Text style={styles.nbSelected}>3 selected</Text>
</View>
<ListSelect title="Diets" content={props.diets}></ListSelect>
<View style={{marginTop: "6%"}}/>
<ListWithoutSelect title="Allergies" content={props.allergies}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Add Allergy" image="plus.png" colour={colors.buttonDetail} backColour={colors.buttonBackground} todo={() => console.log("Create Profile...")}/>
</View>
);
}

@ -1,8 +1,11 @@
import {React, useState} from 'react'; import React, { useContext, useState } from 'react';
import {View, StyleSheet, Pressable, Image, Text} from 'react-native'; import {View, StyleSheet, Pressable, Image} from 'react-native';
import ProfileElement from './ProfileElement'
import ColorContext from '../theme/ColorContext';
import bracketLeft from '../assets/images/angle_bracket_left.png'; import bracketLeft from '../assets/images/angle_bracket_left.png';
import bracketRight from '../assets/images/angle_bracket_right.png'; import bracketRight from '../assets/images/angle_bracket_right.png';
import ProfileElement from './ProfileElement'
type ProfileSelectionProps = { type ProfileSelectionProps = {
listProfile: Profile[] listProfile: Profile[]
@ -16,6 +19,8 @@ type Profile = {
} }
export default function ProfileSelection(props: ProfileSelectionProps) { export default function ProfileSelection(props: ProfileSelectionProps) {
const { colors, toggleColors } = useContext(ColorContext);
const [cpt, setCpt] = useState(0); const [cpt, setCpt] = useState(0);
const decreaseCounter = () => { const decreaseCounter = () => {
if (cpt > 0) { if (cpt > 0) {
@ -34,29 +39,29 @@ export default function ProfileSelection(props: ProfileSelectionProps) {
} }
}; };
return (
<View style={styles.background}>
<Pressable onPress={decreaseCounter}>
<Image source={bracketLeft} style={{width: 40, height: 40, resizeMode: "contain"}}/>
</Pressable>
<ProfileElement name={props.listProfile[cpt].name} avatar={props.listProfile[cpt].avatar} isActive={props.listProfile[cpt].isActive} disableSelection={props.disableSelection}/>
<Pressable onPress={increaseCounter}>
<Image source={bracketRight} style={{width: 40, height: 40, resizeMode: "contain"}}/>
</Pressable>
</View>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
background: { background: {
width: "92%", width: "92%",
height: 80, height: 80,
borderRadius: 20, borderRadius: 20,
borderWidth: 2, borderWidth: 2,
borderColor: '#ACA279', borderColor: colors.carrouselText,
backgroundColor: '#E3DEC9', backgroundColor: colors.carrouselBackground,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}, },
}); });
return (
<View style={styles.background}>
<Pressable onPress={decreaseCounter}>
<Image source={bracketLeft} style={{width: 40, height: 40, resizeMode: "contain"}} tintColor={colors.carrouselText}/>
</Pressable>
<ProfileElement name={props.listProfile[cpt].name} avatar={props.listProfile[cpt].avatar} isActive={props.listProfile[cpt].isActive} disableSelection={props.disableSelection}/>
<Pressable onPress={increaseCounter}>
<Image source={bracketRight} style={{width: 40, height: 40, resizeMode: "contain"}} tintColor={colors.carrouselText}/>
</Pressable>
</View>
);
}

@ -7,17 +7,16 @@ interface TopBarProps{
} }
export default function TopBar(props) { export default function TopBar(props) {
const _goBack = () => console.log('Went back');
const _handleSearch = () => console.log('Searching'); const _handleSearch = () => console.log('Searching');
const _handleMore = () => console.log('Shown more'); const _handleMore = () => console.log('Shown more');
return ( return (
<Appbar.Header style={{backgroundColor: '#F2F0E4'}} > <Appbar.Header style={{backgroundColor: '#F2F0E4'}} >
<Appbar.BackAction onPress={_goBack} />
<Appbar.Content title={props.title} /> <Appbar.Content title={props.title} />
{props.isVisible && ( {props.isVisible && (
<><Appbar.Action icon="magnify" onPress={_handleSearch} /> <>
<Appbar.Action icon="magnify" onPress={_handleSearch} />
<Appbar.Action icon="dots-vertical" onPress={_handleMore} /> <Appbar.Action icon="dots-vertical" onPress={_handleMore} />
</> </>
)} )}

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import {StyleSheet, Pressable, Text, View, Image} from 'react-native'; import {StyleSheet, Pressable, Text, View, Image, GestureResponderEvent} from 'react-native';
type ValidateButtonProps = { type ValidateButtonProps = {
@ -7,6 +7,7 @@ type ValidateButtonProps = {
image: string image: string
colour: string colour: string
backColour: string backColour: string
todo: (event: GestureResponderEvent) => void
} }
export default function ValidateButton(props: ValidateButtonProps) { export default function ValidateButton(props: ValidateButtonProps) {
@ -52,11 +53,15 @@ export default function ValidateButton(props: ValidateButtonProps) {
} }
return ( return (
<Pressable style={{ <Pressable
style={{
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 20,}}> borderRadius: 20,
<View style={{ }}
onPress={props.todo}>
<View
style={{
borderRadius: 30, borderRadius: 30,
borderWidth: 2, borderWidth: 2,
borderColor: props.colour, borderColor: props.colour,
@ -66,14 +71,15 @@ export default function ValidateButton(props: ValidateButtonProps) {
flexDirection: "row", flexDirection: "row",
padding: "2%", padding: "2%",
paddingRight: "3%",}}> paddingRight: "3%",}}>
<Image source={imageSource} style={{ <Image
source={imageSource}
style={{
height: "90%", height: "90%",
width: "9%", width: "9%",
marginLeft: "2%", marginLeft: "2%",
marginRight: "3%", marginRight: "3%",
resizeMode: "contain", resizeMode: "contain",}}
tintColor: props.colour,}}> tintColor={props.colour}/>
</Image>
<Text style={{ <Text style={{
fontSize: 15, fontSize: 15,
color: props.colour, color: props.colour,

@ -0,0 +1,135 @@
import React, { useContext, useState } from 'react';
import { View, Text, TouchableOpacity, Image, Pressable } from 'react-native';
import { GestureResponderEvent, StyleSheet } from 'react-native';
import { BlurView } from 'expo-blur';
import ThemeContext from '../theme/ThemeContext';
import ColorContext from '../theme/ColorContext';
import { LightTheme, DarkTheme } from '../theme/colors';
import HomeIcon from '../assets/images/home.png';
import ProfileIcon from '../assets/images/person_icon.png';
import CookingIcon from '../assets/images/cook.png';
import LightIcon from '../assets/images/sun.png';
import DarkIcon from '../assets/images/moon.png';
export default function BottomBar({ state, descriptors, navigation }) {
const {theme, toggleTheme} = useContext(ThemeContext);
const {colors, toggleColors} = useContext(ColorContext)
const [iconThemeButton, setThemeIconButton] = useState(( theme === 'dark' ) ? LightIcon : DarkIcon)
const [textThemeButton, setTextThemeButton] = useState(( theme === 'dark' ) ? 'Light' : 'Dark');
const onThemeButtonPress = (event: GestureResponderEvent) => {
if (textThemeButton === "Light") {
setThemeIconButton(DarkIcon);
setTextThemeButton("Dark");
toggleTheme('light');
toggleColors(LightTheme)
} else {
setThemeIconButton(LightIcon);
setTextThemeButton("Light");
toggleTheme('dark')
toggleColors(DarkTheme)
}
console.log('TextThemeButton is now: ' + textThemeButton);
}
const styles = StyleSheet.create({
BottomBarMainContainer: {
position: 'absolute',
bottom: 0,
right: 0,
left: 0,
height: 70,
backgroundColor: theme === 'dark' ? "#3F3C42" : "transparent"
},
BottomBarBlurContainer: {
flexDirection: 'row',
alignItems: 'center',
alignContent: 'space-around',
padding: 2,
borderBlockColor: theme === 'light' ? '#F2F0E4' : '#222222',
borderWidth: 3,
borderLeftColor: theme === 'light'? '#F2F0E4' : '#222222',
borderLeftWidth: 3,
borderRightColor: theme === 'light'? '#F2F0E4' : '#222222',
borderRightWidth: 3
},
BottomBarIcon: {
width: 35,
height: 35
},
BottomBarElementContainer: {
flexDirection: 'column',
alignItems: 'center',
margin: 3
}
})
return (
<View style={styles.BottomBarMainContainer}>
<BlurView
style={[StyleSheet.absoluteFill, styles.BottomBarBlurContainer]}
tint='dark'
intensity={theme === 'light' ? 50 : 0}
>
{state.routes.map((route, index) => {
const { options } = descriptors[route.key];
const label =
options.tabBarLabel !== undefined
? options.tabBarLabel
: options.title !== undefined
? options.title
: route.name;
let icon;
if (route.name === 'HOME') {
icon = HomeIcon;
} else if (route.name === 'PROFILE') {
icon = ProfileIcon;
} else if (route.name === 'COOKING') {
icon = CookingIcon;
}
const isFocused = state.index === index;
const onPress = () => {
const event = navigation.emit({
type: 'tabPress',
target: route.key,
canPreventDefault: true,
});
if (!isFocused && !event.defaultPrevented) {
navigation.navigate(route.name, route.params);
}
};
return (
<TouchableOpacity
accessibilityRole="button"
accessibilityState={isFocused ? { selected: true } : {}}
accessibilityLabel={options.tabBarAccessibilityLabel}
testID={options.tabBarTestID}
onPress={onPress}
style={[styles.BottomBarElementContainer, { flex: 1 }]}
key={route.name}
>
<Image source={icon} style={[styles.BottomBarIcon, {tintColor: isFocused ? (theme === 'light' ? '#59BDCD': '#8DB4D9'): '#F2F0E4'}]} />
<Text style={{ color: isFocused ? '#59BDCD' : '#F2F0E4' }}>
{label}
</Text>
</TouchableOpacity>
);
})}
<Pressable onPress={ onThemeButtonPress }>
<Image source={iconThemeButton} style={[styles.BottomBarIcon, {tintColor: '#F2F0E4'}]} />
<Text style={{color: '#F2F0E4'}}>
{textThemeButton}
</Text>
</Pressable>
</BlurView>
</View>
);
}

@ -0,0 +1,34 @@
import React, { useContext } from 'react'
import { StyleSheet } from 'react-native'
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import IngredientSelection from '../screens/IngredientSelection';
import { HeaderTitle } from './Utils';
import ThemeContext from '../theme/ThemeContext';
const CookingStack = createNativeStackNavigator()
export default function CookingStackScreen() {
const {theme, toggleTheme} = useContext(ThemeContext);
return (
<CookingStack.Navigator>
<CookingStack.Screen
name='IngredientSelection'
component={IngredientSelection}
options={{
headerStyle: {backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42'},
headerTitle: () => (
<HeaderTitle title='Profile Modification'/>
)
}}
/>
</CookingStack.Navigator>
)
}
const styles = StyleSheet.create({
headerBarContainer: {
backgroundColor: '#F2F0E4',
},
})

@ -0,0 +1,81 @@
import React, { useContext } from 'react';
import { Image, Text, StyleSheet } from 'react-native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomePage from '../screens/HomePage';
import Profiles from '../screens/Profiles';
import CreateProfile from '../screens/CreateProfile';
import ModifyProfile from '../screens/ModifyProfile';
import ThemeContext from '../theme/ThemeContext';
import ColorContext from '../theme/ColorContext';
import { HeaderTitle } from './Utils';
import appLogo from '../assets/images/logo.png';
const HomeStack = createNativeStackNavigator()
function AppIcon() {
return (
<Image
source={appLogo}
style={styles.headerAppIcon}/>
)
}
export default function HomeStackScreen() {
const {theme, toggleTheme} = useContext(ThemeContext)
const {colors, toggleColors} = useContext(ColorContext)
return (
<HomeStack.Navigator>
<HomeStack.Screen
name='Home'
component={HomePage}
options={{
headerStyle: {backgroundColor: colors.cardBackground},
headerLeft: () => (
<AppIcon/>
),
headerTitle: () => (
<HeaderTitle title='LeftOvers'/>
),
headerTitleAlign: 'center',
headerRight: () => (
<AppIcon/>
),
}}
/>
<HomeStack.Screen
name='Profiles'
component={Profiles}
options={{
headerStyle: {backgroundColor: colors.cardBackground},
headerTitle: () => (
<HeaderTitle title='Profiles'/>
)
}}
/>
<HomeStack.Screen
name='ProfileModification'
component={ModifyProfile}
options={{
headerStyle: {backgroundColor: colors.cardBackground},
headerTitle: () => (
<HeaderTitle title='Profile Modification'/>
)
}}
/>
</HomeStack.Navigator>
)
}
const styles = StyleSheet.create({
headerAppIcon: {
width: 45,
height: 45,
marginHorizontal: 10,
}
})

@ -0,0 +1,91 @@
import React, { useContext } from 'react'
import { StyleSheet, View, Image, Pressable } from 'react-native'
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import Profiles from '../screens/Profiles';
import CreateProfile from '../screens/CreateProfile';
import ModifyProfile from '../screens/ModifyProfile';
import ThemeContext from '../theme/ThemeContext';
import { HeaderTitle } from './Utils';
import SearchIcon from '../assets/images/search.png';
import AddIcon from '../assets/images/plus.png'
const ProfilesStack = createNativeStackNavigator()
export default function ProfilesStackScreen({ navigation }) {
const {theme, toggleTheme} = useContext(ThemeContext);
const styles = StyleSheet.create({
headerBarContainer: {
backgroundColor: theme === 'light' ? '#F2F0E4' : '#3F3C42',
},
headerBarRightContainer: {
display: 'flex',
flexDirection: 'row',
alignContent: 'space-between',
marginHorizontal: 10,
},
headerBarIcon: {
width: 30,
height: 30,
marginHorizontal: 10
}
})
const _handleSearch = () => console.log('Searching');
const _handleHeaderAdd = () => navigation.navigate('ProfileCreation');
return (
<ProfilesStack.Navigator>
<ProfilesStack.Screen
name='Profiles'
component={Profiles}
options={{
headerStyle: styles.headerBarContainer,
headerTitle: () => (
<HeaderTitle title='Profiles'/>
),
headerRight: () => (
<View style={styles.headerBarRightContainer}>
<Pressable onPress={_handleSearch}>
<Image
source={SearchIcon}
style={styles.headerBarIcon}
tintColor={theme === 'light' ? '#3F3C42' : '#F2F0E4'}/>
</Pressable>
<Pressable onPress={_handleHeaderAdd}>
<Image
source={AddIcon}
style={styles.headerBarIcon}
tintColor={theme === 'light' ? '#3F3C42' : '#F2F0E4'}/>
</Pressable>
</View>
)
}}
/>
<ProfilesStack.Screen
name='ProfileCreation'
component={CreateProfile}
options={{
headerStyle: styles.headerBarContainer,
headerTitle: () => (
<HeaderTitle title='Profile Creation'/>
)
}}
/>
<ProfilesStack.Screen
name='ProfileModification'
component={ModifyProfile}
options={{
headerStyle: styles.headerBarContainer,
headerTitle: () => (
<HeaderTitle title='Profile Modification'/>
)
}}
/>
</ProfilesStack.Navigator>
)
}

@ -0,0 +1,23 @@
import React, { useContext } from 'react';
import { Text, StyleSheet } from 'react-native';
import ColorContext from '../theme/ColorContext';
export function HeaderTitle(props) {
const {colors, toggleColors} = useContext(ColorContext)
const styles = StyleSheet.create({
headerTitle: {
fontSize: 20,
fontWeight: "bold",
color: colors.cardDetail,
}
})
return (
<Text
style={styles.headerTitle}>
{props.title}
</Text>
)
}

File diff suppressed because it is too large Load Diff

@ -10,9 +10,14 @@
}, },
"dependencies": { "dependencies": {
"@expo/webpack-config": "^19.0.0", "@expo/webpack-config": "^19.0.0",
"@react-native-async-storage/async-storage": "^1.18.2",
"@react-navigation/bottom-tabs": "^6.5.11",
"@react-navigation/native": "^6.1.9",
"@react-navigation/native-stack": "^6.9.17",
"@types/react": "~18.2.14", "@types/react": "~18.2.14",
"axios": "^1.6.2", "axios": "^1.6.2",
"expo": "~49.0.15", "expo": "~49.0.15",
"expo-blur": "^12.4.1",
"expo-linear-gradient": "~12.3.0", "expo-linear-gradient": "~12.3.0",
"expo-splash-screen": "~0.20.5", "expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0", "expo-status-bar": "~1.6.0",
@ -21,6 +26,8 @@
"react-native": "0.72.6", "react-native": "0.72.6",
"react-native-dropdown-select-list": "^2.0.5", "react-native-dropdown-select-list": "^2.0.5",
"react-native-paper": "^5.11.1", "react-native-paper": "^5.11.1",
"react-native-safe-area-context": "^4.6.3",
"react-native-screens": "^3.22.0",
"react-native-splash-screen": "^3.3.0", "react-native-splash-screen": "^3.3.0",
"react-native-web": "~0.19.6", "react-native-web": "~0.19.6",
"typescript": "^5.1.3" "typescript": "^5.1.3"

@ -1,23 +1,35 @@
import React from 'react'; import React, { useContext } from 'react';
import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native'; import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native';
import ProfileModification from '../components/ProfileModification';
import ValidateButton from '../components/ValidateButton';
import TopBar from '../components/TopBar';
import { LinearGradient } from 'expo-linear-gradient'; import { LinearGradient } from 'expo-linear-gradient';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import ProfileModification from '../components/ProfileModification';
import ValidateButton from '../components/ValidateButton';
import ColorContext from '../theme/ColorContext';
export default function CreateProfile(props) { export default function CreateProfile(props) {
const { colors, toggleColors } = useContext(ColorContext)
const all = [] const all = []
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}] const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
const styles = StyleSheet.create({
linearGradient: {
height: "100%",
width: "100%",
flex: 1,
padding: "2%",
paddingTop: 0,
},
});
return ( return (
<SafeAreaProvider style={{flex: 1}}> <SafeAreaProvider style={{flex: 1}}>
<TopBar title="Create Profile" isVisible="true"/>
<ScrollView> <ScrollView>
<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="" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification> <ProfileModification name="" avatar="plus_small.png" diets={die} allergies={all}></ProfileModification>
<View style={{marginTop: "3%"}}/> <View style={{marginTop: "3%"}}/>
<ValidateButton title="Create Profile" image="plus.png" colour="#ACA279" backColour="#F2F0E4"></ValidateButton> <ValidateButton title="Create Profile" image="plus.png" colour={colors.cardTitle} backColour={colors.cardBackground} todo={() => (console.log("Profile Created"))}></ValidateButton>
<View style={{marginTop: "20%"}}/> <View style={{marginTop: "20%"}}/>
</LinearGradient> </LinearGradient>
</ScrollView> </ScrollView>
@ -25,20 +37,3 @@ export default function CreateProfile(props) {
); );
} }
const styles = StyleSheet.create({
container: {
height: "100%",
width: "100%",
flex: 1,
backgroundColor: '#3F3C42',
alignItems: 'center',
justifyContent: 'center',
},
linearGradient: {
height: "100%",
width: "100%",
flex: 1,
padding: "2%",
paddingTop: 0,
},
});

@ -1,13 +1,13 @@
import React from 'react'; import React from 'react';
import {StyleSheet, View, Text, ScrollView, useWindowDimensions} from 'react-native'; import {StyleSheet, View, Text, ScrollView, useWindowDimensions} from 'react-native';
import ProfileModification from '../components/ProfileModification'; import {LinearGradient} from 'expo-linear-gradient';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import ValidateButton from '../components/ValidateButton'; import ValidateButton from '../components/ValidateButton';
import TopBar from '../components/TopBar'; import TopBar from '../components/TopBar';
import ListSelect from '../components/ListSelect'; import ListSelect from '../components/ListSelect';
import ListWithoutSelect from '../components/ListWithoutSelect'; import ListWithoutSelect from '../components/ListWithoutSelect';
import ProfileSelection from '../components/ProfileSelection'; import ProfileSelection from '../components/ProfileSelection';
import {LinearGradient} from 'expo-linear-gradient';
import {SafeAreaProvider} from 'react-native-safe-area-context';
export default function FiltersSelection(props) { export default function FiltersSelection(props) {
const profiles = [ const profiles = [
@ -55,7 +55,7 @@ export default function FiltersSelection(props) {
<View style={{marginTop: "3%"}}/> <View style={{marginTop: "3%"}}/>
<ProfileSelection listProfile={profiles} disableSelection={false}/> <ProfileSelection listProfile={profiles} disableSelection={false}/>
<View style={{marginTop: "4%"}}/> <View style={{marginTop: "4%"}}/>
<ValidateButton title="Change Selected Profiles" image="update.png" colour="#59BDCD" backColour="#E3DEC9"></ValidateButton> <ValidateButton title="Change Selected Profiles" image="update.png" colour="#59BDCD" backColour="#E3DEC9" todo={ () => console.log("change selected profile")}></ValidateButton>
</View> </View>
<View style={{marginTop: "6%"}}/> <View style={{marginTop: "6%"}}/>
<View style={styles.background}> <View style={styles.background}>
@ -76,10 +76,10 @@ export default function FiltersSelection(props) {
<View style={{marginTop: "3%"}}/> <View style={{marginTop: "3%"}}/>
<ListWithoutSelect title="Allergies" content={allAdd}></ListWithoutSelect> <ListWithoutSelect title="Allergies" content={allAdd}></ListWithoutSelect>
<View style={{marginTop: "3%"}}/> <View style={{marginTop: "3%"}}/>
<ValidateButton title="Add Allergy" image="plus.png" colour="#59BDCD" backColour="#E3DEC9"></ValidateButton> <ValidateButton title="Add Allergy" image="plus.png" colour="#59BDCD" backColour="#E3DEC9" todo={() => console.log("add allergy")}></ValidateButton>
</View> </View>
<View style={{marginTop: "6%"}}/> <View style={{marginTop: "6%"}}/>
<ValidateButton title="Save Filters" image="save.png" colour="#ACA279" backColour="#F2F0E4"></ValidateButton> <ValidateButton title="Save Filters" image="save.png" colour="#ACA279" backColour="#F2F0E4" todo={() => console.log("save filters")}></ValidateButton>
<View style={{marginTop: "20%"}}/> <View style={{marginTop: "20%"}}/>
</LinearGradient> </LinearGradient>
</ScrollView> </ScrollView>

@ -1,18 +1,19 @@
import React from 'react'; import React, { useContext, useState } from 'react';
import {StyleSheet, View, Text, Pressable, Image, ScrollView, SafeAreaView} from 'react-native'; import { StyleSheet, View, Text, Pressable, Image, ScrollView } from 'react-native';
import ProfileModification from '../components/ProfileModification';
import ValidateButton from '../components/ValidateButton';
import TopBar from '../components/TopBar';
import ListSelect from '../components/ListSelect';
import ListWithoutSelect from '../components/ListWithoutSelect';
import ProfileSelection from '../components/ProfileSelection';
import FoodElementText from '../components/FoodElementText';
import {LinearGradient} from 'expo-linear-gradient'; import {LinearGradient} from 'expo-linear-gradient';
import {SafeAreaProvider} from 'react-native-safe-area-context'; import {SafeAreaProvider} from 'react-native-safe-area-context';
import ProfileSelection from '../components/ProfileSelection';
import FoodElementText from '../components/FoodElementText';
import ColorContext from '../theme/ColorContext';
import bracketLeft from '../assets/images/angle_bracket_left.png'; import bracketLeft from '../assets/images/angle_bracket_left.png';
import bracketRight from '../assets/images/angle_bracket_right.png'; import bracketRight from '../assets/images/angle_bracket_right.png';
export default function HomePage(props) {
export default function HomePage({ navigation, props }) {
const {colors, toggleColors} = useContext(ColorContext);
const profiles = [ const profiles = [
{name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"}, {name: "Johnny Silverhand", avatar: "plus_small.png", isActive: "flex"},
{name: "Panam Palmer", avatar: "plus_small.png", isActive: "none"}, {name: "Panam Palmer", avatar: "plus_small.png", isActive: "none"},
@ -22,7 +23,7 @@ export default function HomePage(props) {
const ingredientList = [{title: "Carrot"}, {title: "Potato"}, {title: "Peach"}] const ingredientList = [{title: "Carrot"}, {title: "Potato"}, {title: "Peach"}]
const [cpt, setCpt] = React.useState(0); const [cpt, setCpt] = useState(0);
const decreaseCounter = () => { const decreaseCounter = () => {
if (cpt > 0) { if (cpt > 0) {
setCpt(cpt - 1); setCpt(cpt - 1);
@ -137,7 +138,7 @@ const styles = StyleSheet.create({
}, },
filters: { filters: {
fontSize: 20, fontSize: 20,
color: '#ACA279', color: colors.cardTitle,
padding: 5, padding: 5,
paddingLeft: 0, paddingLeft: 0,
paddingBottom: 0, paddingBottom: 0,
@ -145,7 +146,7 @@ const styles = StyleSheet.create({
}, },
nbSelected: { nbSelected: {
fontSize: 11, fontSize: 11,
color: "#3F3C42", color: colors.cardDetail,
textAlign: "right", textAlign: "right",
}, },
@ -153,7 +154,7 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 20, borderRadius: 20,
backgroundColor: '#F2F0E4', backgroundColor: colors.cardBackground,
marginHorizontal: "3%", marginHorizontal: "3%",
paddingBottom: "3%", paddingBottom: "3%",
}, },
@ -162,19 +163,19 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 20, borderRadius: 20,
backgroundColor: '#F2F0E4', backgroundColor: colors.cardBackground,
paddingVertical: "3%", paddingVertical: "3%",
paddingHorizontal: "7%", paddingHorizontal: "7%",
marginHorizontal: "3%", marginHorizontal: "3%",
}, },
text: { text: {
fontSize: 20, fontSize: 20,
color: '#ACA279', color: colors.welcomeText,
}, },
name: { name: {
fontSize: 20, fontSize: 20,
fontWeight: "bold", fontWeight: "bold",
color: '#59BDCD', color: colors.welcomeName,
}, },
ingredientSelection: { ingredientSelection: {
@ -182,26 +183,72 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
borderRadius: 20, borderRadius: 20,
backgroundColor: '#E3DEC9', backgroundColor: colors.carrouselBackground,
borderWidth: 2, borderWidth: 2,
borderColor: "#ACA279", borderColor: colors.carrouselText,
padding: "2%" padding: "2%"
}, }
appName: {
fontSize: 20,
fontWeight: "bold",
color: '#3F3C42',
textAlign: "center",
flex: 0.8,
},
topBar: {
flexDirection: 'row',
width: "100%",
height: "11%",
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#F2F0E4',
paddingTop: "8%",
},
}); });
return (
<SafeAreaProvider style={{flex: 1}}>
<ScrollView>
<LinearGradient colors={[colors.primary, colors.primaryComplement]} style={styles.linearGradient}>
<View style={styles.separator}/>
<View style={styles.welcome}>
<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.text}>,</Text>
</View>
<Text style={styles.text}>Glad to see you again!</Text>
</View>
</View>
<View style={styles.separator}/>
<View style={styles.profilesSelection}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Profiles</Text>
<Text style={styles.nbSelected}>2 selected</Text>
</View>
<View style={{marginTop: "3%"}}/>
<ProfileSelection listProfile={profiles} disableSelection={true}/>
<View style={{marginTop: "4%"}}/>
<ValidateButton title="Modify Profiles" image="parameter.png" colour={colors.buttonDetail} backColour={colors.buttonBackground} todo={() => navigation.navigate('Profiles')}/>
</View>
<View style={styles.separator}/>
<View style={styles.profilesSelection}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Ingredient Stocks</Text>
</View>
<View style={{marginTop: "4%"}}/>
<ValidateButton title="Manage Stocks" image="warehouse.png" colour={colors.buttonDetail} backColour={colors.buttonBackground} todo={() => console.log('ManageStocks')}/>
</View>
<View style={styles.separator}/>
<View style={styles.profilesSelection}>
<View style={styles.filterBar}>
<Text style={styles.filters}>Cooking</Text>
</View>
<View style={{marginTop: "3%"}}/>
<View style={styles.ingredientSelection}>
<Text style={{fontSize: 15, color: colors.carrouselText}}>Selected Ingredient</Text>
<View style={{flexDirection: "row", padding: "4%", justifyContent: "center", alignItems: "center"}}>
<Pressable onPress={decreaseCounter}>
<Image source={bracketLeft} style={{width: 40, height: 40, resizeMode: "contain"}} tintColor={colors.carrouselText}/>
</Pressable>
<FoodElementText title={ingredientList[cpt].title}/>
<Pressable onPress={increaseCounter}>
<Image source={bracketRight} style={{width: 40, height: 40, resizeMode: "contain"}} tintColor={colors.carrouselText} />
</Pressable>
</View>
</View>
<View style={{marginTop: "4%"}}/>
<ValidateButton title="Change Selected Ingredients" image="cook.png" colour={colors.buttonDetail} backColour={colors.buttonBackground} todo={ () => console.log('Chnge Selected Ingredient')}/>
<View style={{marginTop: "3%"}}/>
<ValidateButton title="Search Recipes" image="search.png" colour={colors.buttonDetail} backColour={colors.buttonBackground} todo={ () => console.log('Go and search for recipe')}/>
</View>
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</ScrollView>
</SafeAreaProvider>
);

@ -5,6 +5,7 @@ import TopBar from '../components/TopBar';
import { Searchbar } from 'react-native-paper'; import { Searchbar } from 'react-native-paper';
import FoodElementText from '../components/FoodElementText'; import FoodElementText from '../components/FoodElementText';
import CustomButton from '../components/CustomButton'; import CustomButton from '../components/CustomButton';
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';

@ -1,23 +1,22 @@
import React from 'react'; import React from 'react';
import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native'; import {StyleSheet, View, ScrollView, useWindowDimensions} from 'react-native';
import ProfileModification from '../components/ProfileModification';
import ValidateButton from '../components/ValidateButton';
import TopBar from '../components/TopBar';
import { LinearGradient } from 'expo-linear-gradient'; import { LinearGradient } from 'expo-linear-gradient';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import ProfileModification from '../components/ProfileModification';
import ValidateButton from '../components/ValidateButton';
export default function ModifyProfile(props) { export default function ModifyProfile(props) {
const all = [{value: "Mussels"}, {value: "Skimmed Milk"}, {value: "Nuts"}] const all = [{value: "Mussels"}, {value: "Skimmed Milk"}, {value: "Nuts"}]
const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}] const die = [{value: "Dairy free"}, {value: "Gluten free"}, {value: "Porkless"}, {value: "Vegan"}, {value: "Vegetarian"}, {value: "Pescatarian"}]
return ( return (
<SafeAreaProvider style={{flex: 1}}> <SafeAreaProvider style={{flex: 1}}>
<TopBar title="Modify Profile" isVisible="true"/>
<ScrollView style={{minHeight: useWindowDimensions().height}}> <ScrollView style={{minHeight: useWindowDimensions().height}}>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}> <LinearGradient colors={['#2680AA', '#59BDCD']} 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="#ACA279" backColour="#F2F0E4"></ValidateButton> <ValidateButton title="Update Profile" image="update.png" colour="#ACA279" backColour="#F2F0E4" todo={() => (console.log("Profile Modified"))}></ValidateButton>
<View style={{marginBottom: "20%"}}/> <View style={{marginBottom: "20%"}}/>
</LinearGradient> </LinearGradient>
</ScrollView> </ScrollView>

@ -1,12 +1,16 @@
import React from 'react'; import React, { useContext, useState } from 'react';
import { StyleSheet, View, Modal, Pressable, Text, Image, ScrollView, useWindowDimensions } from 'react-native'; import { StyleSheet, View, Modal, Pressable, Text, Image, ScrollView, useWindowDimensions } from 'react-native';
import ProfileDetails from '../components/ProfileDetails';
import ProfileDelete from '../components/ProfileDelete';
import TopBar from '../components/TopBar';
import { LinearGradient } from 'expo-linear-gradient'; import { LinearGradient } from 'expo-linear-gradient';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
export default function Profiles(props) { import ProfileDetails from '../components/ProfileDetails';
import ProfileDelete from '../components/ProfileDelete';
import ColorContext from '../theme/ColorContext';
export default function Profiles({navigation, props}) {
const { colors, toggleColors } = useContext(ColorContext)
const allJohnny = [{value: "Coconut"}, {value: "Skimmed Milk"}, {value: "Nuts"}] const allJohnny = [{value: "Coconut"}, {value: "Skimmed Milk"}, {value: "Nuts"}]
const dieJohnny = [{value: "Gluten free"}, {value: "Porkless"}, {value: "Pescatarian"}] const dieJohnny = [{value: "Gluten free"}, {value: "Porkless"}, {value: "Pescatarian"}]
@ -19,8 +23,8 @@ export default function Profiles(props) {
const allViktor = [{value: "Pasta"}, {value: "Fish"}] const allViktor = [{value: "Pasta"}, {value: "Fish"}]
const dieViktor = [{value: "Dairy free"}, {value: "Vegan"}] const dieViktor = [{value: "Dairy free"}, {value: "Vegan"}]
const [visible, setVisible] = React.useState(false); const [visible, setVisible] = useState(false);
const [opacity, setOpacity] = React.useState(1); const [opacity, setOpacity] = useState(1);
const raisePopUp = () => { const raisePopUp = () => {
setVisible(true) setVisible(true)
setOpacity(0.3) setOpacity(0.3)
@ -30,56 +34,6 @@ export default function Profiles(props) {
setOpacity(1) setOpacity(1)
} }
return (
<SafeAreaProvider style={{flex: 1}}>
<ScrollView>
<View style={{opacity: opacity, height: "100%", width: "100%", flex: 1, backgroundColor: '#3F3C42',}}>
<TopBar title="Profiles" isVisible="true"/>
<LinearGradient colors={['#2680AA', '#59BDCD']} style={[styles.linearGradient, {minHeight: useWindowDimensions().height}]}>
<View style={styles.separator}/>
<ProfileDetails name="Johnny Silverhand" avatar="plus_small.png" diets={dieJohnny} allergies={allJohnny} onDeleteProfile={raisePopUp}></ProfileDetails>
<View style={styles.separator}/>
<ProfileDetails name="Jackie Welles" avatar="plus_small.png" diets={dieJackie} allergies={allJackie} onDeleteProfile={raisePopUp}></ProfileDetails>
<View style={styles.separator}/>
<ProfileDetails name="Goro Takemura" avatar="plus_small.png" diets={dieGoro} allergies={allGoro} onDeleteProfile={raisePopUp}></ProfileDetails>
<View style={styles.separator}/>
<ProfileDetails name="Viktor Vector" avatar="plus_small.png" diets={dieViktor} allergies={allViktor} onDeleteProfile={raisePopUp}></ProfileDetails>
<View style={styles.modal}>
<Modal visible={visible} onRequestClose={erasePopUp} animationType="fade" transparent={true}>
<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>
</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}}>
<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>
</View>
</Pressable>
<Pressable onPress={erasePopUp} style={{flex:0.5}}>
<View style={styles.noButton}>
<Image source={require("../assets/images/cross.png")} style={{tintColor: "#E02D2D", height: "100%", flex: 0.2, margin: "5%", resizeMode: "contain"}}/>
<Text style={styles.noText}>No</Text>
</View>
</Pressable>
</View>
</View>
</View>
</View>
</Modal>
</View>
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</View>
</ScrollView>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
height: "100%", height: "100%",
@ -116,6 +70,7 @@ const styles = StyleSheet.create({
width: "100%", width: "100%",
flex: 1, flex: 1,
}, },
profileValidation: { profileValidation: {
width: "100%", width: "100%",
alignItems: "center", alignItems: "center",
@ -187,3 +142,72 @@ const styles = StyleSheet.create({
padding: "4%", padding: "4%",
}, },
}); });
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} />
<View style={styles.modal}>
<Modal visible={visible} onRequestClose={erasePopUp} animationType="fade" transparent={true}>
<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>
</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}}>
<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>
</View>
</Pressable>
<Pressable onPress={erasePopUp} style={{flex:0.5}}>
<View style={styles.noButton}>
<Image source={require("../assets/images/cross.png")} style={{tintColor: "#E02D2D", height: "100%", flex: 0.2, margin: "5%", resizeMode: "contain"}}/>
<Text style={styles.noText}>No</Text>
</View>
</Pressable>
</View>
</View>
</View>
</View>
</Modal>
</View>
<View style={{marginBottom: "20%"}}/>
</LinearGradient>
</View>
</ScrollView>
</SafeAreaProvider>
);
}

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { View, StyleSheet, Text} from 'react-native'; import { View, StyleSheet, Text} from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import TopBar from '../components/TopBar';
import RecipeElementReduce from '../components/RecipeElementReduce'; import RecipeElementReduce from '../components/RecipeElementReduce';
import AllergiesTab from '../components/ListWithoutSelect'; import AllergiesTab from '../components/ListWithoutSelect';
import RecipesService from '../Services/Recipes/RecipesServices'; import RecipesService from '../Services/Recipes/RecipesServices';
@ -43,9 +43,6 @@ export default function RecipeDetails(props) {
return ( return (
<SafeAreaProvider> <SafeAreaProvider>
{response && (
<>
<TopBar title="Recipe Detail"/>
<View style={styles.page}> <View style={styles.page}>
<RecipeElementReduce <RecipeElementReduce
title={response.name} title={response.name}
@ -79,9 +76,6 @@ export default function RecipeDetails(props) {
</View> </View>
</View> </View>
</>
)}
</SafeAreaProvider> </SafeAreaProvider>
); );
} }

@ -2,16 +2,18 @@ import React, { useState } from 'react';
import { View, StyleSheet, Text, Image, Pressable} from 'react-native'; import { View, StyleSheet, Text, Image, Pressable} from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context'; import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Modal, Portal, PaperProvider} from 'react-native-paper'; import { Modal, Portal, PaperProvider} from 'react-native-paper';
import TopBar from '../components/TopBar'; import TopBar from '../components/TopBar';
import RecipeElement from '../components/RecipeElement'; import RecipeElement from '../components/RecipeElement';
import SelectedIngredient from '../components/SelectedIngredient'; import SelectedIngredient from '../components/SelectedIngredient';
import FoodElementText from '../components/FoodElementText'; import FoodElementText from '../components/FoodElementText';
import CustomButton from '../components/CustomButton';
import DietsTab from '../components/DietsTab';
import brochette from '../assets/images/brochette.png'; import brochette from '../assets/images/brochette.png';
import ParameterTopBar from '../components/ParameterTopBar'; import ParameterTopBar from '../components/ParameterTopBar';
import bracketLeft from '../assets/images/angle_bracket_left.png'; import bracketLeft from '../assets/images/angle_bracket_left.png';
import bracketRight from '../assets/images/angle_bracket_right.png'; import bracketRight from '../assets/images/angle_bracket_right.png';
import CustomButton from '../components/CustomButton';
import DietsTab from '../components/ListSelect';
export default function RecipeSuggestion(props) { export default function RecipeSuggestion(props) {

@ -0,0 +1,42 @@
import React, {createContext, useState, useEffect} from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { LightTheme, Theme } from './colors';
interface ColorContextType {
colors: Theme,
toggleColors: (Theme) => void
};
const ColorContext = createContext<ColorContextType | null>(null);
export const ColorProvider = ({ children }) => {
const [colors, setColors] = useState(LightTheme);
useEffect(() => {
const getColors = async () => {
try {
const savedColors = await AsyncStorage.getItem('colors');
if (savedColors) {
setColors(JSON.parse(savedColors));
}
} catch (error) {
console.log('Error loading colors:', error);
}
};
getColors();
}, []);
const toggleColors = (newColors: Theme) => {
setColors(newColors);
AsyncStorage.setItem('colors', JSON.stringify(newColors))
};
return (
<ColorContext.Provider value={{colors, toggleColors}}>
{children}
</ColorContext.Provider>
);
};
export default ColorContext;

@ -0,0 +1,42 @@
import React, {createContext, useState, useEffect} from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
interface ThemeContextType {
theme: string,
toggleTheme: (any)=> void
};
const ThemeContext = createContext<ThemeContextType | null>(null);
export const ThemeProvider = ({ children }) => {
const [theme, setTheme] = useState('light');
useEffect(() => {
// Load saved theme from storage
const getTheme = async () => {
try {
const savedTheme = await AsyncStorage.getItem('theme');
if (savedTheme) {
setTheme(savedTheme);
}
} catch (error) {
console.log('Error loading theme:', error);
}
};
getTheme();
}, []);
const toggleTheme = newTheme => {
setTheme(newTheme);
AsyncStorage.setItem('theme', newTheme)
};
return (
<ThemeContext.Provider value={{theme, toggleTheme}}>
{children}
</ThemeContext.Provider>
);
};
export default ThemeContext;

@ -0,0 +1,81 @@
const Ecru = '#ACA279'
const Alabaster = '#F2F0E4'
const Jet = '#3F3C42'
const Moonstone = '#59BDCD'
const Cerulean = '#2680AA'
const Celeste = '#ADF3EA'
const Tan = '#E0C293'
const Pearl = '#E3DEC9'
const EerieBlack = '#222222'
const CarolinaBlue = '#8DB4D9'
const SteelBlue = '#5882A8'
export interface Theme {
primary: string,
primaryComplement: string,
cardBackground: string,
cardTitle: string,
cardDetail: string,
cardElementBackground: string,
cardElementText: string,
cardElementBorder: string,
cardElementTitle: string,
cardElementTitleBackground: string,
ingredientBackground: string,
ingredientContent: string,
ingredientBorder: string,
buttonBackground: string,
buttonDetail: string,
welcomeText: string,
welcomeName: string,
carrouselBackground: string,
carrouselText: string,
carrouselDetail: string
}
export const LightTheme : Theme = {
primary: Cerulean,
primaryComplement: Moonstone,
cardBackground: Alabaster,
cardTitle: Ecru,
cardDetail: Jet,
cardElementBackground: Pearl,
cardElementText: Jet,
cardElementBorder: Ecru,
cardElementTitle: Jet,
cardElementTitleBackground: Alabaster,
ingredientBackground: Pearl,
ingredientBorder: EerieBlack,
ingredientContent: Jet,
buttonBackground: Pearl,
buttonDetail: Moonstone,
welcomeText: Ecru,
welcomeName: Moonstone,
carrouselBackground: Pearl,
carrouselText: Ecru,
carrouselDetail: Moonstone
}
export const DarkTheme : Theme = {
primary: EerieBlack,
primaryComplement: Jet,
cardBackground: Jet,
cardTitle: Alabaster,
cardDetail: Alabaster,
cardElementBackground: SteelBlue,
cardElementText: Jet,
cardElementTitle: Alabaster,
cardElementBorder: SteelBlue,
cardElementTitleBackground: CarolinaBlue,
ingredientBackground: EerieBlack,
ingredientBorder: SteelBlue,
ingredientContent: Alabaster,
buttonBackground: Jet,
buttonDetail: CarolinaBlue,
welcomeText: SteelBlue,
welcomeName:Alabaster,
carrouselBackground: CarolinaBlue,
carrouselText: SteelBlue,
carrouselDetail: Alabaster
}

17222
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,13 +0,0 @@
{
"dependencies": {
"@eva-design/eva": "^2.2.0",
"@ui-kitten/components": "^5.3.1",
"expo": "^49.0.17",
"react-native-svg": "^13.14.0",
"typescript": "^5.1.3",
"@types/react": "~18.2.14",
"react-native-web": "~0.19.6",
"react-dom": "18.2.0",
"@expo/webpack-config": "^19.0.0"
}
}
Loading…
Cancel
Save