Skip to content

Commit

Permalink
Merge branch 'main' into rf-refineAppDesign
Browse files Browse the repository at this point in the history
  • Loading branch information
ryandotfurrer committed Apr 22, 2024
2 parents 07ade27 + 226eb3b commit 9a76004
Show file tree
Hide file tree
Showing 11 changed files with 13,787 additions and 114 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ ENV PYTHONUNBUFFERED 1

COPY ./zbackend/requirements.txt /tmp/requirements.txt
COPY ./zbackend/requirements.dev.txt /tmp/requirements.dev.txt
COPY ./scripts /scripts
COPY ./zbackend /app
WORKDIR /app
EXPOSE 8000


ARG DEV=false
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \


/py/bin/pip install -r /tmp/requirements.txt && \
if [ $DEV = "true" ]; \
then /py/bin/pip install -r /tmp/requirements.dev.txt ; \

fi && \
rm -rf /tmp && \
adduser \
Expand Down
2 changes: 1 addition & 1 deletion components/FavoriteRecipes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useNavigation } from '@react-navigation/native';
const FavoriteRecipesList = ({ scrollEnabled }) => {
const [recipes, setRecipes] = useState([]);
const navigation = useNavigation();
const { userId } = '8950a7c8-20c3-4d77-9a10-3622e07fd3dd';
const { userId } = '1';

useEffect(() => {
const fetchRecipes = async () => {
Expand Down
4 changes: 2 additions & 2 deletions components/RecipeList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Body } from './Typography';
const RecipeList = ({ title, scrollEnabled, numberOfRecipes }) => {
const [recipes, setRecipes] = useState([]);
const navigation = useNavigation();
const { userId } = useContext(AuthContext);
const { userId } = "1";

useEffect(() => {
const fetchRecipes = async () => {
Expand Down Expand Up @@ -49,7 +49,7 @@ const RecipeList = ({ title, scrollEnabled, numberOfRecipes }) => {
<>
{recipes?.length === 0 ? (
<View style={style.noRecipes}>
<Body style={style.noRecipesText}>No Favorite Recipes</Body>
<Body>No Favorite Recipes</Body>
</View>
) : (
<FlatList
Expand Down
10 changes: 9 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ services:
volumes:
- ./zbackend:/app
command: >
sh -c "python manage.py runserver 0.0.0.0:8000"
sh -c "python manage.py wait_for_db &&
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
environment:
- DB_HOST=aws-0-us-west-1.pooler.supabase.com"
- DB_NAME="postgres"
- DB_USER="postgres.xmmvpjtupsyceyyeyfma"
- DB_PASS="!BestTeam123!"
- DB_PORT=5432
13,638 changes: 13,638 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

144 changes: 82 additions & 62 deletions screens/AccountSettingsMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,25 @@ import { View, StyleSheet, Pressable } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import AcctHeader from '../components/AcctHeader';
import Nav from '../components/Nav';
import { Body, ButtonText } from '../components/Typography';
import LogOutIcon from '../components/Icons/LogOutIcon.jsx';
import DoNotEnter from '../components/Icons/DoNotEnter';
import IDCard from '../components/Icons/IDCard.jsx';
import Pot from '../components/Icons/Pot.jsx';
import Button from '../components/Button';
import { MaterialIcons } from '@expo/vector-icons';
import {
Ionicons,
AntDesign,
MaterialCommunityIcons,
} from '@expo/vector-icons';
import { SettingOption } from '../components/SettingOption';
import { useState } from 'react';
import { DietaryAllergenFilterScreen } from './DietaryAllergenFilter';
import { AccountDetailsScreen } from './AccountDetailsScreen';
import { AcctSavedRecipesScreen } from './AcctSavedRecipes';

export const SettingsScreen = {
AccountSettings: 'AccountSettings',
DietaryPreferences: 'DietaryPreferences',
MyDetails: 'MyDetails',
FavoriteRecipes: 'FavoriteRecipes',
};

export const AccountSettingsMenu = () => {
const [showBackButton, setShowBackButton] = useState(false);
Expand All @@ -17,64 +31,70 @@ export const AccountSettingsMenu = () => {
);
return (
<SafeAreaView style={styles.container}>
<View style={styles.innerContainer}>
<AcctHeader />
<View style={styles.menuItemContainer}>
<View style={styles.menuItemInnerContainer}>
<Pressable
onPress={() =>
navigation.navigate('Dietary Preferences & Allergies')
}
style={({ pressed }) => [
{
opacity: pressed ? 0.5 : 1,
},
styles.menuItem,
]}
>
<View style={styles.menuIcon}>
<DoNotEnter />
</View>
<Body>Dietary Preferences & Allergies</Body>
</Pressable>
<Pressable
onPress={() => navigation.navigate('Account Details')}
style={({ pressed }) => [
{
opacity: pressed ? 0.5 : 1,
},
styles.menuItem,
]}
>
<View style={styles.menuIcon}>
<IDCard style={styles.menuIcon} />
</View>
<Body>Account Details</Body>
</Pressable>
<Pressable
onPress={() => navigation.navigate('Saved Recipes')}
style={({ pressed }) => [
{
opacity: pressed ? 0.5 : 1,
},
styles.menuItem,
]}
>
<View style={styles.menuIcon}>
<Pot style={styles.menuIcon} />
</View>
<Body>Saved Recipes</Body>
</Pressable>
</View>
<AcctHeader />

{screenOption != SettingsScreen.AccountSettings && (
<Pressable
style={styles.backButton}
onPress={() => setScreenOption(SettingsScreen.AccountSettings)}
>
<Ionicons
name='chevron-back-circle'
size={26}
color='#72C08F'
style={{ margin: 20 }}
/>
</Pressable>
)}
<View style={styles.menuContainer}>
{screenOption === SettingsScreen.AccountSettings && (
<>
<View style={styles.optionList}>
<SettingOption
title='Dietary Preferences'
icon={<Ionicons name={'ban-outline'} size={18} />}
onPress={() =>
setScreenOption(SettingsScreen.DietaryPreferences)
}
/>
<SettingOption
title='My Details'
icon={<AntDesign name={'idcard'} size={18} />}
onPress={() => setScreenOption(SettingsScreen.MyDetails)}
/>
<SettingOption
title='Favorite Recipes'
icon={
<MaterialCommunityIcons
name={'pot-steam-outline'}
size={18}
/>
}
onPress={() => setScreenOption(SettingsScreen.FavoriteRecipes)}
/>
</View>
<View style={{ paddingHorizontal: 20 }}>
<Button
isFullWidth={true}
onPress={() => navigation.navigate('Login')}
kind='outline'
shape='rounded'
startEnhancer={
<MaterialIcons name={'logout'} size={18} color='#52B175' />
}
>
Log Out
</Button>
</View>
</>
)}

{screenOption == SettingsScreen.DietaryPreferences && (
<DietaryAllergenFilterScreen />
)}
{screenOption == SettingsScreen.MyDetails && <AccountDetailsScreen />}

<Pressable
onPress={() => navigation.navigate('Login')}
style={[styles.buttonContainer, styles.button]}
>
<LogOutIcon style={styles.icon} />
<ButtonText>Log Out</ButtonText>
</Pressable>
</View>
{screenOption == SettingsScreen.FavoriteRecipes && <AcctSavedRecipesScreen />}
</View>
<Nav />
</SafeAreaView>
Expand Down
86 changes: 43 additions & 43 deletions screens/AcctSavedRecipes.jsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
import {
SafeAreaView,
ScrollView,
StyleSheet,
View,
Pressable,
} from 'react-native';
import AcctRecipeBar from '../components/AcctRecipeBar';
import Nav from '../components/Nav';
import { useNavigation } from '@react-navigation/native';

export const AcctSavedRecipesScreen = () => {
const navigation = useNavigation();
return (
<SafeAreaView style={styles.container}>
<View style={{ flex: 1 }}>
<ScrollView contentContainerStyle={styles.scrollContainer}>
<View style={styles.homeContainer}>
<Pressable
onPress={() => navigation.navigate('Recipe', { id: item.id })}
>
<AcctRecipeBar />
</Pressable>
</View>
</ScrollView>
</View>
<Nav />
</SafeAreaView>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
},
scrollContainer: {
flexGrow: 1,
},
homeContainer: {
backgroundColor: '#f2f2f2',
},
});

export default AcctSavedRecipesScreen;
SafeAreaView,
ScrollView,
StyleSheet,
View,
Pressable,
} from 'react-native';
import AcctRecipeBar from '../components/AcctRecipeBar';
import Nav from '../components/Nav';
import { useNavigation } from '@react-navigation/native';
export const AcctSavedRecipesScreen = () => {
const navigation = useNavigation();
return (
<SafeAreaView style={styles.container}>
<View style={{ flex: 1 }}>
<ScrollView contentContainerStyle={styles.scrollContainer}>
<View style={styles.homeContainer}>
<Pressable
onPress={() => navigation.navigate('Recipe', { id: item.id })}
>
<AcctRecipeBar />
</Pressable>
</View>
</ScrollView>
</View>
<Nav />
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
scrollContainer: {
flexGrow: 1,
},
homeContainer: {
backgroundColor: '#f2f2f2',
},
});
export default AcctSavedRecipesScreen;
2 changes: 1 addition & 1 deletion screens/AddIngredient.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const AddIngredientModal = ({
setModalVisible,
onClose,
}) => {
const { userId } = useContext(); // fix later
const { userId } = "1"; // fix when backend integrated
const [showError, setShowError] = useState('');
const [productData, setProductData] = useState({
productName: '',
Expand Down
2 changes: 1 addition & 1 deletion screens/Ingredient.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AddIngredientModal } from './AddIngredient';
const imageUrl = 'https://cdn-icons-png.freepik.com/512/6981/6981367.png';

export const IngredientScreen = () => {
const { userId } = useContext(); // fix later
const { userId } = "1"; // update later when backend working
const [modalVisible, setModalVisible] = useState(false);

const [search, setSearch] = useState('');
Expand Down
2 changes: 1 addition & 1 deletion screens/Recipe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const RecipeScreen = () => {
const route = useRoute();
const { id } = route.params;
const navigation = useNavigation();
const { userId } = useContext(AuthContext);
const { userId } = "1"; // update after backend integration
const [isFavourite, setIsFavourite] = useState(false);
const [isOpenMoreTags, setOpenMoreTags] = useState(false);

Expand Down
4 changes: 4 additions & 0 deletions zbackend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ djangorestframework-simplejwt==5.3.1
gunicorn==21.2.0
django-allauth==0.61.1
drf-yasg==1.21.7
dj-rest-auth==6.0.0
sqlparse==*
psycopg2-binary==*
python-dotenv==1.0.1

0 comments on commit 9a76004

Please sign in to comment.